From 2b5378e07346813477c576ab4f38ef25caca0857 Mon Sep 17 00:00:00 2001 From: l00635678 Date: Fri, 12 Sep 2025 16:56:44 +0800 Subject: [PATCH] =?UTF-8?q?Fuzz=E7=94=A8=E4=BE=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: l00635678 --- services/ethernetmanager/BUILD.gn | 5 +++++ .../fuzztest/ethernetclient_fuzzer/BUILD.gn | 2 ++ .../ethernetclient_fuzzer/cfi_blocklist.txt | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 test/ethernetmanager/fuzztest/ethernetclient_fuzzer/cfi_blocklist.txt diff --git a/services/ethernetmanager/BUILD.gn b/services/ethernetmanager/BUILD.gn index 428838f5..01167aac 100644 --- a/services/ethernetmanager/BUILD.gn +++ b/services/ethernetmanager/BUILD.gn @@ -102,6 +102,11 @@ ohos_shared_library("ethernet_manager") { ohos_static_library("ethernet_manager_static") { testonly = true + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } branch_protector_ret = "pac_ret" sources = [ "$ETHERNETMANAGER_INNERKITS_SOURCE_DIR/src/proxy/interface_state_callback_proxy.cpp", diff --git a/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/BUILD.gn b/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/BUILD.gn index 80f4b505..a306be88 100644 --- a/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/BUILD.gn +++ b/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/BUILD.gn @@ -22,6 +22,7 @@ ohos_fuzztest("EthernetClientFuzzTest") { module_out_path = fuzz_test_path fuzz_config_file = "$NETMANAGER_EXT_ROOT/test/ethernetmanager/fuzztest/ethernetclient_fuzzer" + _cfi_blocklist_path = "./cfi_blocklist.txt" include_dirs = [ "$EXT_INNERKITS_ROOT/include", @@ -42,6 +43,7 @@ ohos_fuzztest("EthernetClientFuzzTest") { "-fsanitize=cfi", "-fsanitize-cfi-cross-dso", "-fvisibility=hidden", + "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir), ] ldflags = [ diff --git a/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/cfi_blocklist.txt b/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/cfi_blocklist.txt new file mode 100644 index 00000000..95a2ddbe --- /dev/null +++ b/test/ethernetmanager/fuzztest/ethernetclient_fuzzer/cfi_blocklist.txt @@ -0,0 +1,18 @@ +# Copyright (C) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[cfi] +type:*OHOS::Parcel* +type:*OHOS::RefBase* +type:*OHOS::NetManagerStandard* +fun:*Marshalling* \ No newline at end of file -- Gitee