From 5927ec164d8c9adc5e65f69f22eceab19b30ed83 Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Thu, 23 Jan 2025 19:17:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E5=90=88=E8=A7=84=E4=B8=93?= =?UTF-8?q?=E9=A1=B9=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- av_transport/av_trans_engine/av_receiver/BUILD.gn | 10 +++++++++- av_transport/av_trans_engine/av_sender/BUILD.gn | 10 +++++++++- .../histreamer_ability_querier/BUILD.gn | 9 ++++++++- av_transport/framework/BUILD.gn | 9 ++++++++- interfaces/inner_kits/BUILD.gn | 8 +++++++- interfaces/kits/napi/BUILD.gn | 15 ++++++++++++++- services/distributedhardwarefwkservice/BUILD.gn | 8 +++++++- utils/BUILD.gn | 8 +++++++- 8 files changed, 69 insertions(+), 8 deletions(-) diff --git a/av_transport/av_trans_engine/av_receiver/BUILD.gn b/av_transport/av_trans_engine/av_receiver/BUILD.gn index a41c37e9..2e2c26c3 100644 --- a/av_transport/av_trans_engine/av_receiver/BUILD.gn +++ b/av_transport/av_trans_engine/av_receiver/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -112,14 +112,22 @@ ohos_shared_library("distributed_av_receiver") { "//build/config/compiler:no_rtti", "//build/config/compiler:no_exceptions", ] + cflags = [ "-O2", "-fPIC", "-Wall", "-fexceptions", + "-fstack-protector-strong", ] cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + part_name = "distributed_hardware_fwk" subsystem_name = "distributedhardware" } diff --git a/av_transport/av_trans_engine/av_sender/BUILD.gn b/av_transport/av_trans_engine/av_sender/BUILD.gn index 02c2c582..37a4483c 100644 --- a/av_transport/av_trans_engine/av_sender/BUILD.gn +++ b/av_transport/av_trans_engine/av_sender/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -106,14 +106,22 @@ ohos_shared_library("distributed_av_sender") { "//build/config/compiler:no_rtti", "//build/config/compiler:no_exceptions", ] + cflags = [ "-O2", "-fPIC", "-Wall", "-fexceptions", + "-fstack-protector-strong", ] cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + part_name = "distributed_hardware_fwk" subsystem_name = "distributedhardware" } diff --git a/av_transport/av_trans_handler/histreamer_ability_querier/BUILD.gn b/av_transport/av_trans_handler/histreamer_ability_querier/BUILD.gn index 2abf0097..cf00397a 100644 --- a/av_transport/av_trans_handler/histreamer_ability_querier/BUILD.gn +++ b/av_transport/av_trans_handler/histreamer_ability_querier/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -72,10 +72,17 @@ ohos_shared_library("histreamer_ability_querier") { "-fexceptions", "-Wno-unused-but-set-variable", "-Wno-format", + "-fstack-protector-strong", ] cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + remove_configs = [ "//build/config/compiler:no_rtti", "//build/config/compiler:no_exceptions", diff --git a/av_transport/framework/BUILD.gn b/av_transport/framework/BUILD.gn index e9285316..c4672acf 100644 --- a/av_transport/framework/BUILD.gn +++ b/av_transport/framework/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -85,9 +85,16 @@ ohos_shared_library("distributed_av_pipeline_fwk") { "-O2", "-Wall", "-Wno-c++20-extensions", + "-fstack-protector-strong", ] cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + part_name = "distributed_hardware_fwk" subsystem_name = "distributedhardware" } diff --git a/interfaces/inner_kits/BUILD.gn b/interfaces/inner_kits/BUILD.gn index 998f5639..cf6108c5 100644 --- a/interfaces/inner_kits/BUILD.gn +++ b/interfaces/inner_kits/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-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 @@ -90,6 +90,12 @@ ohos_shared_library("libdhfwk_sdk") { "-O2", ] + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + subsystem_name = "distributedhardware" part_name = "distributed_hardware_fwk" diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index 55425a97..e5ad6f8d 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -15,6 +15,13 @@ import("//build/ohos.gni") import("../../../distributedhardwarefwk.gni") ohos_shared_library("hardwaremanager") { + sanitize = { + boundary_sanitize = true + integer_overflow = true + ubsan = true + } + branch_protector_ret = "pac_ret" + include_dirs = [ "include", "${common_path}/log/include", @@ -52,6 +59,12 @@ ohos_shared_library("hardwaremanager") { cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + external_deps = [ "access_token:libtokenid_sdk", "bundle_framework:appexecfwk_base", diff --git a/services/distributedhardwarefwkservice/BUILD.gn b/services/distributedhardwarefwkservice/BUILD.gn index ea3349e6..b3b10248 100644 --- a/services/distributedhardwarefwkservice/BUILD.gn +++ b/services/distributedhardwarefwkservice/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -129,6 +129,12 @@ ohos_shared_library("distributedhardwarefwksvr") { cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + if (distributed_hardware_fwk_low_latency) { defines += [ "DHARDWARE_LOW_LATENCY" ] } diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 3a30e04b..4ffdda81 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -66,6 +66,12 @@ ohos_shared_library("distributedhardwareutils") { cflags_cc = cflags + ldflags = [ + "-fpie", + "-Wl,-z,relro", + "-Wl,-z,now", + ] + external_deps = [ "cJSON:cjson", "c_utils:utils", -- Gitee