From 9f3557da853bebcd6b574a9089ed12d1fd9da86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Sat, 25 May 2024 16:54:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?cfi=20crash=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/firmware/check/include/firmware_icheck.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/firmware/check/include/firmware_icheck.h b/services/firmware/check/include/firmware_icheck.h index 85f2536e..713034fc 100644 --- a/services/firmware/check/include/firmware_icheck.h +++ b/services/firmware/check/include/firmware_icheck.h @@ -54,7 +54,6 @@ const std::string PARAM_NAME_FOR_SEARCH = "update.serverip.search"; using CheckCallback = std::function &firmwareCheckResultList, const CheckAndAuthInfo &checkAndAuthInfo)>; -using cJSONPtr = std::unique_ptr; struct FirmwareCheckCallback { CheckCallback callback; }; @@ -118,10 +117,11 @@ private: { response.content.assign(buffer.begin(), buffer.end()); response.status = static_cast(HttpConstant::SUCCESS); - cJSONPtr root(cJSON_Parse(buffer.data()), cJSON_Delete); + cJSON *root= cJSON_Parse(buffer.data()); ENGINE_CHECK(root != nullptr, return -1, "Error get root"); - cJSON *item = cJSON_GetObjectItem(root.get(), "searchStatus"); - ENGINE_CHECK(root != nullptr, return -1, "Error get searchStatus"); + cJSON *item = cJSON_GetObjectItem(root, "searchStatus"); + ENGINE_CHECK(item != nullptr, cJSON_Delete(root); + return -1, "Error get searchStatus"); if (!cJSON_IsNumber(item)) { FIRMWARE_LOGE("Error json parse"); return -1; -- Gitee From 0111dd14c249cafca73aef695aa06cbb4ea17662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Sat, 25 May 2024 09:14:34 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/check/include/firmware_icheck.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/firmware/check/include/firmware_icheck.h b/services/firmware/check/include/firmware_icheck.h index 713034fc..370f115e 100644 --- a/services/firmware/check/include/firmware_icheck.h +++ b/services/firmware/check/include/firmware_icheck.h @@ -117,7 +117,7 @@ private: { response.content.assign(buffer.begin(), buffer.end()); response.status = static_cast(HttpConstant::SUCCESS); - cJSON *root= cJSON_Parse(buffer.data()); + cJSON *root = cJSON_Parse(buffer.data()); ENGINE_CHECK(root != nullptr, return -1, "Error get root"); cJSON *item = cJSON_GetObjectItem(root, "searchStatus"); ENGINE_CHECK(item != nullptr, cJSON_Delete(root); -- Gitee From ae852fe51462c7295fac91a488cc30dd0ff28097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 28 May 2024 15:43:48 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9cfi=20=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/engine/BUILD.gn | 1 + services/engine/cfi_blocklist.txt | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 services/engine/cfi_blocklist.txt diff --git a/services/engine/BUILD.gn b/services/engine/BUILD.gn index 767bc87b..7cd0289d 100644 --- a/services/engine/BUILD.gn +++ b/services/engine/BUILD.gn @@ -40,6 +40,7 @@ ohos_shared_library("$updateengine_library_name") { cfi = true cfi_cross_dso = true debug = false + blocklist = "./cfi_blocklist.txt" } branch_protector_ret = "pac_ret" shlib_type = "sa" diff --git a/services/engine/cfi_blocklist.txt b/services/engine/cfi_blocklist.txt new file mode 100644 index 00000000..14b1c9b8 --- /dev/null +++ b/services/engine/cfi_blocklist.txt @@ -0,0 +1,15 @@ +# Copyright (C) 2022-2024 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::UpdateEngine::UpdateServiceImplFirmware* -- Gitee From 798037a4a4a12fb2e85dce943f93cc7db704d851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 28 May 2024 09:22:28 +0000 Subject: [PATCH 4/5] =?UTF-8?q?cfi=20=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/cfi_blocklist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/services/engine/cfi_blocklist.txt b/services/engine/cfi_blocklist.txt index 14b1c9b8..317b6338 100644 --- a/services/engine/cfi_blocklist.txt +++ b/services/engine/cfi_blocklist.txt @@ -13,3 +13,4 @@ [cfi] type:*OHOS::UpdateEngine::UpdateServiceImplFirmware* +src:*update_service_impl_firmware.cpp -- Gitee From cbaa116ca6b51091e26fc9540c81783a11d68a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Tue, 28 May 2024 19:34:50 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9cfi=20Signed-off-by:=20?= =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/engine/BUILD.gn | 10 ---------- services/engine/cfi_blocklist.txt | 16 ---------------- 2 files changed, 26 deletions(-) delete mode 100644 services/engine/cfi_blocklist.txt diff --git a/services/engine/BUILD.gn b/services/engine/BUILD.gn index 7cd0289d..c88b23cf 100644 --- a/services/engine/BUILD.gn +++ b/services/engine/BUILD.gn @@ -33,16 +33,6 @@ ohos_prebuilt_etc("updater_sa.cfg") { } ohos_shared_library("$updateengine_library_name") { - sanitize = { - integer_overflow = true - ubsan = true - boundary_sanitize = true - cfi = true - cfi_cross_dso = true - debug = false - blocklist = "./cfi_blocklist.txt" - } - branch_protector_ret = "pac_ret" shlib_type = "sa" include_dirs = sa_include_dirs sources = sa_sources diff --git a/services/engine/cfi_blocklist.txt b/services/engine/cfi_blocklist.txt deleted file mode 100644 index 317b6338..00000000 --- a/services/engine/cfi_blocklist.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2022-2024 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::UpdateEngine::UpdateServiceImplFirmware* -src:*update_service_impl_firmware.cpp -- Gitee