diff --git a/interfaces/innerkits/native/BUILD.gn b/interfaces/innerkits/native/BUILD.gn index bc2f205eab24e14dde0066f63b08239cbf1c51a1..84838bca0142cb6eaa42c2eabc07db4a84bce742 100644 --- a/interfaces/innerkits/native/BUILD.gn +++ b/interfaces/innerkits/native/BUILD.gn @@ -66,6 +66,16 @@ ohos_shared_library("fileshare_native") { } ohos_shared_library("fileuri_native") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "../../common/src/common_func.cpp", "../../common/src/json_utils.cpp", @@ -110,6 +120,16 @@ config("remote_file_share_config") { } ohos_shared_library("remote_file_share_native") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "../../common/src/json_utils.cpp", "../../common/src/sandbox_helper.cpp", @@ -143,6 +163,16 @@ config("sandbox_helper_config") { } ohos_shared_library("sandbox_helper_native") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + sources = [ "../../common/src/json_utils.cpp", "../../common/src/sandbox_helper.cpp", diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index ee1a7758bfeacf36173dac4576abcf81e97d47f1..5b2fa6ab31014c000b4173e9334891a5cb7584d4 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -52,6 +52,16 @@ ohos_shared_library("remotefileshare") { } ohos_shared_library("fileshare") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ ".", "../../common/include", @@ -92,6 +102,16 @@ ohos_shared_library("fileshare") { } ohos_shared_library("fileuri") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [ ".", "../../common/include", @@ -133,6 +153,16 @@ ohos_shared_library("fileuri") { } ohos_shared_library("backup") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + relative_install_dir = "module/file" subsystem_name = "filemanagement" part_name = "app_file_service" diff --git a/tests/moduletests/backup_kit_inner/BUILD.gn b/tests/moduletests/backup_kit_inner/BUILD.gn index d506df4c41f044637b0dba40f6db09bb71c700c8..6573d6c7c122aadd42ffcb1ad7205875f457152f 100644 --- a/tests/moduletests/backup_kit_inner/BUILD.gn +++ b/tests/moduletests/backup_kit_inner/BUILD.gn @@ -47,6 +47,12 @@ ohos_unittest("b_session_test") { "ipc:ipc_core", "samgr:samgr_proxy", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } use_exceptions = true } diff --git a/tests/unittests/backup_api/backup_impl/BUILD.gn b/tests/unittests/backup_api/backup_impl/BUILD.gn index 33b29384ee0bf179780c506f58a45eae1f24a5cb..478b257385da8d135f602df1103ec7f0c89b7ede 100644 --- a/tests/unittests/backup_api/backup_impl/BUILD.gn +++ b/tests/unittests/backup_api/backup_impl/BUILD.gn @@ -72,6 +72,12 @@ ohos_unittest("backup_sa_impl_test") { "samgr:samgr_proxy", ] + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + use_exceptions = true } diff --git a/tests/unittests/backup_sa/module_ipc/BUILD.gn b/tests/unittests/backup_sa/module_ipc/BUILD.gn index 2d3ac401c264f8013ecfad54147bf7918ce399bf..a93e52b4da21cbab3fb5caa6481e7784a455cf82 100644 --- a/tests/unittests/backup_sa/module_ipc/BUILD.gn +++ b/tests/unittests/backup_sa/module_ipc/BUILD.gn @@ -50,6 +50,12 @@ ohos_unittest("module_ipc_test") { "storage_service:storage_manager_sa_proxy", ] + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + use_exceptions = true } @@ -186,6 +192,12 @@ ohos_unittest("backup_service_scheduler_test") { "storage_service:storage_manager_sa_proxy", ] + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + use_exceptions = true } diff --git a/tests/unittests/backup_utils/BUILD.gn b/tests/unittests/backup_utils/BUILD.gn index 6148f4aa316140e8cef0fe39e69276210686a120..7e2e8eb4c82ef69d13d27407ca1970c5e0ff1dd6 100644 --- a/tests/unittests/backup_utils/BUILD.gn +++ b/tests/unittests/backup_utils/BUILD.gn @@ -77,6 +77,12 @@ ohos_unittest("b_json_test") { "hilog:libhilog", ] + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + use_exceptions = true } diff --git a/tools/backup_tool/BUILD.gn b/tools/backup_tool/BUILD.gn index b164c2006f9131c71d997ab472746d43c661ed9b..bdf86c51efd4edf55ac211387920667048b9dc57 100644 --- a/tools/backup_tool/BUILD.gn +++ b/tools/backup_tool/BUILD.gn @@ -15,6 +15,16 @@ import("//build/ohos.gni") import("//foundation/filemanagement/app_file_service/backup.gni") ohos_executable("backup_tool") { + stack_protector_ret = true + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + debug = false + } + include_dirs = [] deps = [] defines = []