From b309bc6b21a64a9ad2bc59532020f65fc9067a74 Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD Date: Sun, 30 Nov 2025 17:15:33 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=B4=E6=98=8E=20Sign?= =?UTF-8?q?ed-off-by:=20wangruiqi=20<2553318405@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4426e1198b85f92efdf57f16f6b22a8bd2edbeda Signed-off-by: gcw_v1zFmwMD --- bundle.json | 146 ++++---- test/fuzztest/BUILD.gn | 1 + test/fuzztest/template_fuzzer/BUILD.gn | 64 ++++ test/fuzztest/template_fuzzer/corpus/init | 16 + test/fuzztest/template_fuzzer/project.xml | 25 ++ .../template_fuzzer/template_fuzzer.cpp | 324 ++++++++++++++++++ .../template_fuzzer/template_fuzzer.h | 279 +++++++++++++++ 7 files changed, 783 insertions(+), 72 deletions(-) create mode 100644 test/fuzztest/template_fuzzer/BUILD.gn create mode 100644 test/fuzztest/template_fuzzer/corpus/init create mode 100644 test/fuzztest/template_fuzzer/project.xml create mode 100644 test/fuzztest/template_fuzzer/template_fuzzer.cpp create mode 100644 test/fuzztest/template_fuzzer/template_fuzzer.h diff --git a/bundle.json b/bundle.json index 8a10894..a2709ae 100644 --- a/bundle.json +++ b/bundle.json @@ -1,79 +1,81 @@ { - "name": "@ohos/qos_manager", - "description": "qos_manager", - "version": "3.1", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "foundation/resourceschedule/qos_manager" + "name": "@ohos/qos_manager", + "description": "qos_manager", + "version": "3.1", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "foundation/resourceschedule/qos_manager" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "qos_manager", + "subsystem": "resourceschedule", + "syscap": [ + "SystemCapability.Resourceschedule.QoS.Core" + ], + "features": [], + "adapted_system_type": [ + "standard" + ], + "rom": "2048KB", + "ram": "10240KB", + "deps": { + "components": [ + "ability_base", + "ability_runtime", + "access_token", + "config_policy", + "c_utils", + "frame_aware_sched", + "hilog", + "hitrace", + "init", + "ipc", + "libxml2", + "safwk", + "samgr" + ], + "third_party": [] }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "qos_manager", - "subsystem": "resourceschedule", - "syscap": [ "SystemCapability.Resourceschedule.QoS.Core" ], - "features": [], - "adapted_system_type": [ - "standard" - ], - "rom": "2048KB", - "ram": "10240KB", - "deps": { - "components": [ - "ability_base", - "ability_runtime", - "access_token", - "config_policy", - "c_utils", - "frame_aware_sched", - "hilog", - "hitrace", - "init", - "ipc", - "libxml2", - "safwk", - "samgr" - ], - "third_party": [ + "build": { + "sub_component": [ + "//foundation/resourceschedule/qos_manager/etc/init:concurrent_task_service.cfg", + "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para", + "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para.dac", + "//foundation/resourceschedule/qos_manager/sa_profile:concurrent_task_sa_profile", + "//foundation/resourceschedule/qos_manager/services:concurrentsvc", + "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client", + "//foundation/resourceschedule/qos_manager/qos:qos", + "//foundation/resourceschedule/qos_manager/frameworks/native:qos_ndk" + ], + "inner_kits": [ + { + "header": { + "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", + "header_files": [ + "concurrent_task_client.h" ] + }, + "name": "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client" }, - "build": { - "sub_component": [ - "//foundation/resourceschedule/qos_manager/etc/init:concurrent_task_service.cfg", - "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para", - "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para.dac", - "//foundation/resourceschedule/qos_manager/sa_profile:concurrent_task_sa_profile", - "//foundation/resourceschedule/qos_manager/services:concurrentsvc", - "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client", - "//foundation/resourceschedule/qos_manager/qos:qos", - "//foundation/resourceschedule/qos_manager/frameworks/native:qos_ndk" - ], - "inner_kits": [ - { - "header": { - "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", - "header_files": [ - "concurrent_task_client.h" - ] - }, - "name": "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client" - }, - { - "header": { - "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", - "header_files": [ - "qos.h", - "pi_mutex.h" - ] - }, - "name": "//foundation/resourceschedule/qos_manager/qos:qos" - } - ], - "test": [ - "//foundation/resourceschedule/qos_manager/test:concurrent_unittest", - "//foundation/resourceschedule/qos_manager/test/fuzztest:fuzztest" + { + "header": { + "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", + "header_files": [ + "qos.h", + "pi_mutex.h" ] + }, + "name": "//foundation/resourceschedule/qos_manager/qos:qos" } + ], + "test": [ + "//foundation/resourceschedule/qos_manager/test:concurrent_unittest", + "//foundation/resourceschedule/qos_manager/test/fuzztest:fuzztest", + "//foundation/resourceschedule/qos_manager/test/fuzztest/template_fuzzer:fuzztest" + ] } -} + } +} \ No newline at end of file diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 1bd29fa..6257d62 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -15,6 +15,7 @@ group("fuzztest") { testonly = true deps = [ "concurrent_fuzzer:ConcurrentFuzzTest", + "template_fuzzer:TemplateFuzzer", "qos_fuzzer:QosFuzzTest", "qos_policy_fuzzer:QosPolicyFuzzTest", "rtg_operations_fuzzer:RtgOperationsFuzzTest", diff --git a/test/fuzztest/template_fuzzer/BUILD.gn b/test/fuzztest/template_fuzzer/BUILD.gn new file mode 100644 index 0000000..ac2e2d7 --- /dev/null +++ b/test/fuzztest/template_fuzzer/BUILD.gn @@ -0,0 +1,64 @@ +# Copyright (c) 2021 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. + +#####################hydra-fuzz################### +import("//build/config/features.gni") +import("//build/test.gni") + +##############################fuzztest########################################## +ohos_fuzztest("TemplateFuzzer") { + module_out_path = "qos_manager/qos_manager/" + + include_dirs = [ + "../../../include/", + "../../../interfaces/inner_api/", + "../../../frameworks/concurrent_task_client/include/", + "../../../services/include/", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + fuzz_config_file = "../../../test/fuzztest/template_fuzzer" + sources = [ + "template_fuzzer.cpp", + ] + deps = [ + "../../../frameworks/concurrent_task_client:concurrent_task_client", + "../../../qos:qos", + "../../../services:concurrentsvc", + ] + external_deps = [ + "access_token:libaccesstoken_sdk", + "c_utils:utils", + "frame_aware_sched:rtg_interface", + "hilog:libhilog", + "hitrace:hitrace_meter", + "init:libbegetutil", + "ipc:ipc_single", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + ] +} +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ + # deps file + ":TemplateFuzzer", + ] +} +############################################################################### diff --git a/test/fuzztest/template_fuzzer/corpus/init b/test/fuzztest/template_fuzzer/corpus/init new file mode 100644 index 0000000..6ff2572 --- /dev/null +++ b/test/fuzztest/template_fuzzer/corpus/init @@ -0,0 +1,16 @@ +/* + * 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. + */ +FUZZ \ No newline at end of file diff --git a/test/fuzztest/template_fuzzer/project.xml b/test/fuzztest/template_fuzzer/project.xml new file mode 100644 index 0000000..85e7ef2 --- /dev/null +++ b/test/fuzztest/template_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/template_fuzzer/template_fuzzer.cpp b/test/fuzztest/template_fuzzer/template_fuzzer.cpp new file mode 100644 index 0000000..8f36108 --- /dev/null +++ b/test/fuzztest/template_fuzzer/template_fuzzer.cpp @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2021 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "concurrent_task_client.h" +#include "concurrent_task_controller_interface.h" +#include "concurrent_task_service.h" +#define private public +#include "concurrent_task_service_ability.h" +#undef private +#include "func_loader.h" +#include "message_option.h" +#include "message_parcel.h" +#include "qos.h" +#include "qos_interface.h" +#include "qos_policy.h" + +using namespace OHOS::ConcurrentTask; +using namespace OHOS::QOS; + +namespace OHOS { +namespace QOS { +int AddThreadsToProcRtg(int tid[5], int size); +} // namespace QOS +} // namespace OHOS + +namespace OHOS { +namespace { +constexpr size_t MIN_FUZZ_BYTES = 4; +constexpr int MAX_QOS_LEVEL = static_cast(QosLevel::QOS_MAX); +constexpr int MAX_DISPATCH_INDEX = 8; +constexpr int MAX_TID_RANGE = 4096; +constexpr int RT_PRIORITY_LIMIT = 128; +constexpr int MAX_IPC_STRING = 32; +constexpr int MAX_PAYLOAD_STRING = 64; +constexpr int MIN_IPC_BYTES = 8; +constexpr int SA_TEST_ID = 5204; // arbitrary system ability id for fuzzing + +enum class QosOp : int { + CONTROLLER = 0, + RAW_INTERFACE, + POLICY_SET, + RTG_ENABLE, + PROC_RTG, + CLIENT_API, + SERVICE_IPC, + FUNC_LOADER, + TASK_CONTROLLER, +}; +} // namespace + +static QosLevel ConsumeQosLevel(FuzzedDataProvider &fdp) +{ + int rawLevel = fdp.ConsumeIntegralInRange(-1, MAX_QOS_LEVEL + 1); + return static_cast(rawLevel); +} + +static int ConsumeTid(FuzzedDataProvider &fdp) +{ + return fdp.ConsumeIntegralInRange(-MAX_TID_RANGE, MAX_TID_RANGE); +} + +static void ExerciseQosController(FuzzedDataProvider &fdp) +{ + QosLevel level = ConsumeQosLevel(fdp); + int tid = ConsumeTid(fdp); + + QosController::GetInstance().SetThreadQosForOtherThread(level, tid); + QosController::GetInstance().GetThreadQosForOtherThread(level, tid); + QosController::GetInstance().ResetThreadQosForOtherThread(tid); + + SetThreadQos(level); + SetQosForOtherThread(level, tid); + ResetThreadQos(); + ResetQosForOtherThread(tid); + GetThreadQos(level); + GetQosForOtherThread(level, tid); +} + +static void ExerciseQosInterface(FuzzedDataProvider &fdp) +{ + unsigned int rawLevel = fdp.ConsumeIntegral(); + int tid = ConsumeTid(fdp); + bool enableRtg = fdp.ConsumeBool(); + + EnableRtg(enableRtg); + QosApply(rawLevel); + QosApplyForOther(rawLevel, tid); + QosLeave(); + QosLeaveForOther(tid); + + int queriedLevel = -1; + QosGet(queriedLevel); + QosGetForOther(tid, queriedLevel); +} + +static void PopulatePolicyEntry(QosPolicyData &entry, FuzzedDataProvider &fdp) +{ + entry.nice = fdp.ConsumeIntegral(); + entry.latencyNice = fdp.ConsumeIntegral(); + entry.uclampMin = fdp.ConsumeIntegral(); + entry.uclampMax = fdp.ConsumeIntegral(); + entry.rtSchedPriority = fdp.ConsumeIntegralInRange(-RT_PRIORITY_LIMIT, RT_PRIORITY_LIMIT); + entry.policy = fdp.PickValueInArray({ + SchedPolicy::SCHED_POLICY_OTHER, + SchedPolicy::SCHED_POLICY_FIFO, + SchedPolicy::SCHED_POLICY_RR, + SchedPolicy::SCHED_POLICY_RT_EX, + }); +} + +static void ExerciseQosPolicy(FuzzedDataProvider &fdp) +{ + QosPolicyDatas policyDatas {}; + policyDatas.policyType = fdp.ConsumeIntegral(); + policyDatas.policyFlag = fdp.ConsumeIntegral(); + + for (int i = 0; i < NR_QOS; i++) { + PopulatePolicyEntry(policyDatas.policys[i], fdp); + } + + QosPolicy policyClient; + policyClient.SetQosPolicy(&policyDatas); +} + +static void ExerciseProcRtg(FuzzedDataProvider &fdp) +{ + int tid = ConsumeTid(fdp); + std::array tids {}; + for (auto &item : tids) { + item = ConsumeTid(fdp); + } + + AddThreadToProcRtg(tid); + AddThreadsToProcRtg(tids.data(), static_cast(tids.size())); + RemoveThreadFromProcRtg(tid); + RemoveThreadsFromProcRtg(tids.data(), static_cast(tids.size())); +} + +static std::unordered_map BuildStringPayload(FuzzedDataProvider &fdp) +{ + std::unordered_map payload; + payload["k"] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + payload[fdp.ConsumeRandomLengthString(8)] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + return payload; +} + +static std::unordered_map BuildPidPayload(FuzzedDataProvider &fdp) +{ + std::unordered_map payload; + payload[fdp.ConsumeIntegral()] = fdp.ConsumeIntegral(); + return payload; +} + +static void ExerciseClientApi(FuzzedDataProvider &fdp) +{ + ConcurrentTaskClient &client = ConcurrentTaskClient::GetInstance(); + auto payload = BuildStringPayload(fdp); + IntervalReply intervalReply; + DeadlineReply deadlineReply; + + client.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); + client.ReportSceneInfo(fdp.ConsumeIntegral(), payload); + client.QueryInterval(fdp.ConsumeIntegral(), intervalReply); + client.QueryDeadline(fdp.ConsumeIntegral(), deadlineReply, BuildPidPayload(fdp)); + client.QueryDeadline(fdp.ConsumeIntegral(), deadlineReply, BuildStringPayload(fdp)); + client.SetAudioDeadline(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), + intervalReply); + client.RequestAuth(payload); + client.SetSystemQoS(fdp.ConsumeIntegral(), fdp.ConsumeIntegral()); + client.StopRemoteObject(); + client.ReportSceneInfo(fdp.ConsumeIntegral(), payload); // trigger post-stop path +} + +static void ExerciseServiceIpc(FuzzedDataProvider &fdp) +{ + if (fdp.remaining_bytes() < MIN_IPC_BYTES) { + return; + } + static const uint32_t kCodes[] = { + 0, 1, 2, 3, 4, 5 + }; + + MessageParcel data; + MessageParcel reply; + MessageOption option; + data.WriteInt32(fdp.ConsumeIntegral()); + data.WriteInt32(fdp.ConsumeIntegral()); + data.WriteString(fdp.ConsumeRandomLengthString(MAX_IPC_STRING)); + + uint32_t code = fdp.PickValueInArray(kCodes); + ConcurrentTaskService service; + service.OnRemoteRequest(code, data, reply, option); +} + +static void ExerciseFuncLoader(FuzzedDataProvider &fdp) +{ + std::string path = fdp.ConsumeRandomLengthString(MAX_IPC_STRING); + FuncLoader loader(path); + loader.LoadSymbol(fdp.ConsumeRandomLengthString(8).c_str()); + loader.LoadSymbol(""); + loader.LoadSymbol("nonexistent_symbol"); + loader.GetLoadSuccess(); +} + +static void ExerciseServiceDirect(FuzzedDataProvider &fdp) +{ + ConcurrentTaskService svc; + auto payload = BuildStringPayload(fdp); + IpcIntervalReply ipcInterval {}; + IpcDeadlineReply ipcDdl {}; + + svc.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); + svc.ReportSceneInfo(fdp.ConsumeIntegral(), payload); + svc.QueryInterval(fdp.ConsumeIntegral(), ipcInterval); + svc.QueryDeadline(fdp.ConsumeIntegral(), ipcDdl, payload); + svc.SetAudioDeadline( + fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), ipcInterval); + svc.RequestAuth(payload); +} + +static void ExerciseServiceAbility(FuzzedDataProvider &fdp) +{ + ConcurrentTaskServiceAbility ability(SA_TEST_ID, fdp.ConsumeBool()); + ability.OnStart(); + ability.OnAddSystemAbility(fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(8)); + ability.OnRemoveSystemAbility(fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(8)); + ability.GetClassName(); + if (fdp.ConsumeBool()) { + ability.OnStart(); // repeat to trigger duplicate start branch + } + ability.OnStop(); +} + +static void ExerciseTaskController(FuzzedDataProvider &fdp) +{ + TaskControllerInterface &controller = TaskControllerInterface::GetInstance(); + controller.Init(); + + auto payload = BuildStringPayload(fdp); + IntervalReply intervalReply; + DeadlineReply ddlReply; + + controller.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); + controller.ReportSceneInfo(fdp.ConsumeIntegral(), payload); + controller.QueryInterval(fdp.ConsumeIntegral(), intervalReply); + controller.QueryDeadline(fdp.ConsumeIntegral(), ddlReply, payload); + controller.SetAudioDeadline( + fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), intervalReply); + controller.RequestAuth(payload); + controller.Release(); + controller.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + if (data == nullptr || size < MIN_FUZZ_BYTES) { + return 0; + } + + FuzzedDataProvider fdp(data, size); + + QosPolicy policyInitializer; + policyInitializer.Init(); + + while (fdp.remaining_bytes() > 0) { + int op = fdp.ConsumeIntegralInRange(0, MAX_DISPATCH_INDEX); + switch (static_cast(op)) { + case QosOp::CONTROLLER: + ExerciseQosController(fdp); + break; + case QosOp::RAW_INTERFACE: + ExerciseQosInterface(fdp); + break; + case QosOp::POLICY_SET: + ExerciseQosPolicy(fdp); + break; + case QosOp::RTG_ENABLE: + EnableRtg(fdp.ConsumeBool()); + break; + case QosOp::PROC_RTG: + ExerciseProcRtg(fdp); + break; + case QosOp::CLIENT_API: + ExerciseClientApi(fdp); + break; + case QosOp::SERVICE_IPC: + ExerciseServiceIpc(fdp); + break; + case QosOp::FUNC_LOADER: + ExerciseFuncLoader(fdp); + break; + case QosOp::TASK_CONTROLLER: + ExerciseTaskController(fdp); + ExerciseServiceDirect(fdp); + ExerciseServiceAbility(fdp); + break; + default: + break; + } + } + return 0; +} +} // namespace OHOS diff --git a/test/fuzztest/template_fuzzer/template_fuzzer.h b/test/fuzztest/template_fuzzer/template_fuzzer.h new file mode 100644 index 0000000..53cbaea --- /dev/null +++ b/test/fuzztest/template_fuzzer/template_fuzzer.h @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2021 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. + */ + +#include "template_fuzzer.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "concurrent_task_client.h" +#include "concurrent_task_controller_interface.h" +#include "concurrent_task_service.h" +#include "func_loader.h" +#include "message_option.h" +#include "message_parcel.h" +#include "qos.h" +#include "qos_interface.h" +#include "qos_policy.h" + +using namespace OHOS::ConcurrentTask; +using namespace OHOS::QOS; + +namespace OHOS { +namespace { +constexpr size_t MIN_FUZZ_BYTES = 4; +constexpr int MAX_QOS_LEVEL = static_cast(QosLevel::QOS_MAX); +constexpr int MAX_DISPATCH_INDEX = 8; +constexpr int MAX_TID_RANGE = 4096; +constexpr int RT_PRIORITY_LIMIT = 128; +constexpr int MAX_IPC_STRING = 32; +constexpr int MAX_PAYLOAD_STRING = 64; +constexpr int MIN_IPC_BYTES = 8; + +enum class QosOp : int { + CONTROLLER = 0, + RAW_INTERFACE, + POLICY_SET, + RTG_ENABLE, + PROC_RTG, + CLIENT_API, + SERVICE_IPC, + FUNC_LOADER, + TASK_CONTROLLER, +}; +} // namespace + +static QosLevel ConsumeQosLevel(FuzzedDataProvider &fdp) +{ + int rawLevel = fdp.ConsumeIntegralInRange(-1, MAX_QOS_LEVEL + 1); + return static_cast(rawLevel); +} + +static int ConsumeTid(FuzzedDataProvider &fdp) +{ + return fdp.ConsumeIntegralInRange(-MAX_TID_RANGE, MAX_TID_RANGE); +} + +static void ExerciseQosController(FuzzedDataProvider &fdp) +{ + QosLevel level = ConsumeQosLevel(fdp); + int tid = ConsumeTid(fdp); + + QosController::GetInstance().SetThreadQosForOtherThread(level, tid); + QosController::GetInstance().GetThreadQosForOtherThread(level, tid); + QosController::GetInstance().ResetThreadQosForOtherThread(tid); + + SetThreadQos(level); + SetQosForOtherThread(level, tid); + ResetThreadQos(); + ResetQosForOtherThread(tid); + GetThreadQos(level); + GetQosForOtherThread(level, tid); +} + +static void ExerciseQosInterface(FuzzedDataProvider &fdp) +{ + unsigned int rawLevel = fdp.ConsumeIntegral(); + int tid = ConsumeTid(fdp); + bool enableRtg = fdp.ConsumeBool(); + + EnableRtg(enableRtg); + QosApply(rawLevel); + QosApplyForOther(rawLevel, tid); + QosLeave(); + QosLeaveForOther(tid); + + int queriedLevel = -1; + QosGet(queriedLevel); + QosGetForOther(tid, queriedLevel); +} + +static void PopulatePolicyEntry(QosPolicyData &entry, FuzzedDataProvider &fdp) +{ + entry.nice = fdp.ConsumeIntegral(); + entry.latencyNice = fdp.ConsumeIntegral(); + entry.uclampMin = fdp.ConsumeIntegral(); + entry.uclampMax = fdp.ConsumeIntegral(); + entry.rtSchedPriority = fdp.ConsumeIntegralInRange(-RT_PRIORITY_LIMIT, RT_PRIORITY_LIMIT); + entry.policy = fdp.PickValueInArray({ + SchedPolicy::SCHED_POLICY_OTHER, + SchedPolicy::SCHED_POLICY_FIFO, + SchedPolicy::SCHED_POLICY_RR, + SchedPolicy::SCHED_POLICY_RT_EX, + }); +} + +static void ExerciseQosPolicy(FuzzedDataProvider &fdp) +{ + QosPolicyDatas policyDatas {}; + policyDatas.policyType = fdp.ConsumeIntegral(); + policyDatas.policyFlag = fdp.ConsumeIntegral(); + + for (int i = 0; i < NR_QOS; i++) { + PopulatePolicyEntry(policyDatas.policys[i], fdp); + } + + QosPolicy policyClient; + policyClient.SetQosPolicy(&policyDatas); +} + +static void ExerciseProcRtg(FuzzedDataProvider &fdp) +{ + int tid = ConsumeTid(fdp); + std::array tids {}; + for (auto &item : tids) { + item = ConsumeTid(fdp); + } + + AddThreadToProcRtg(tid); + RemoveThreadFromProcRtg(tid); + RemoveThreadsFromProcRtg(tids.data(), static_cast(tids.size())); +} + +static std::unordered_map BuildStringPayload(FuzzedDataProvider &fdp) +{ + std::unordered_map payload; + payload["k"] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + payload[fdp.ConsumeRandomLengthString(8)] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + return payload; +} + +static std::unordered_map BuildPidPayload(FuzzedDataProvider &fdp) +{ + std::unordered_map payload; + payload[fdp.ConsumeIntegral()] = fdp.ConsumeIntegral(); + return payload; +} + +static void ExerciseClientApi(FuzzedDataProvider &fdp) +{ + ConcurrentTaskClient &client = ConcurrentTaskClient::GetInstance(); + auto payload = BuildStringPayload(fdp); + IntervalReply intervalReply; + DeadlineReply deadlineReply; + + client.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); + client.ReportSceneInfo(fdp.ConsumeIntegral(), payload); + client.QueryInterval(fdp.ConsumeIntegral(), intervalReply); + client.QueryDeadline(fdp.ConsumeIntegral(), deadlineReply, BuildPidPayload(fdp)); + client.SetAudioDeadline(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), + intervalReply); + client.RequestAuth(payload); + client.SetSystemQoS(fdp.ConsumeIntegral(), fdp.ConsumeIntegral()); + client.StopRemoteObject(); +} + +static void ExerciseServiceIpc(FuzzedDataProvider &fdp) +{ + if (fdp.remaining_bytes() < MIN_IPC_BYTES) { + return; + } + static const uint32_t kCodes[] = { + 0, 1, 2, 3, 4, 5 + }; + + MessageParcel data; + MessageParcel reply; + MessageOption option; + data.WriteInt32(fdp.ConsumeIntegral()); + data.WriteInt32(fdp.ConsumeIntegral()); + data.WriteString(fdp.ConsumeRandomLengthString(MAX_IPC_STRING)); + + uint32_t code = fdp.PickValueInArray(kCodes); + ConcurrentTaskService service; + service.OnRemoteRequest(code, data, reply, option); +} + +static void ExerciseFuncLoader(FuzzedDataProvider &fdp) +{ + std::string path = fdp.ConsumeRandomLengthString(MAX_IPC_STRING); + FuncLoader loader(path); + loader.LoadSymbol(fdp.ConsumeRandomLengthString(8).c_str()); + loader.GetLoadSuccess(); +} + +static void ExerciseTaskController(FuzzedDataProvider &fdp) +{ + TaskControllerInterface &controller = TaskControllerInterface::GetInstance(); + controller.Init(); + + auto payload = BuildStringPayload(fdp); + IntervalReply intervalReply; + DeadlineReply ddlReply; + + controller.ReportData(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), payload); + controller.ReportSceneInfo(fdp.ConsumeIntegral(), payload); + controller.QueryInterval(fdp.ConsumeIntegral(), intervalReply); + controller.QueryDeadline(fdp.ConsumeIntegral(), ddlReply, payload); + controller.SetAudioDeadline( + fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), intervalReply); + controller.RequestAuth(payload); + controller.Release(); +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + if (data == nullptr || size < MIN_FUZZ_BYTES) { + return 0; + } + + FuzzedDataProvider fdp(data, size); + + QosPolicy policyInitializer; + policyInitializer.Init(); + + while (fdp.remaining_bytes() > 0) { + int op = fdp.ConsumeIntegralInRange(0, MAX_DISPATCH_INDEX); + switch (static_cast(op)) { + case QosOp::CONTROLLER: + ExerciseQosController(fdp); + break; + case QosOp::RAW_INTERFACE: + ExerciseQosInterface(fdp); + break; + case QosOp::POLICY_SET: + ExerciseQosPolicy(fdp); + break; + case QosOp::RTG_ENABLE: + EnableRtg(fdp.ConsumeBool()); + break; + case QosOp::PROC_RTG: + ExerciseProcRtg(fdp); + break; + case QosOp::CLIENT_API: + ExerciseClientApi(fdp); + break; + case QosOp::SERVICE_IPC: + ExerciseServiceIpc(fdp); + break; + case QosOp::FUNC_LOADER: + ExerciseFuncLoader(fdp); + break; + case QosOp::TASK_CONTROLLER: + ExerciseTaskController(fdp); + break; + default: + break; + } + } + return 0; +} +} // namespace OHOS From b602ad9ea8a72fd495e58bb276f341af45bfb1da Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Mon, 29 Dec 2025 23:31:04 +0800 Subject: [PATCH 2/7] Revert bundle.json to upstream format Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- bundle.json | 105 ++++++++++++++++++---------------------------------- 1 file changed, 37 insertions(+), 68 deletions(-) diff --git a/bundle.json b/bundle.json index 60cc2d0..eaef11a 100644 --- a/bundle.json +++ b/bundle.json @@ -1,64 +1,42 @@ { - "name": "@ohos/qos_manager", - "description": "qos_manager", - "version": "3.1", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "foundation/resourceschedule/qos_manager" - }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "qos_manager", - "subsystem": "resourceschedule", - "syscap": [ - "SystemCapability.Resourceschedule.QoS.Core" - ], - "features": [], - "adapted_system_type": [ - "standard" - ], - "rom": "2048KB", - "ram": "10240KB", - "deps": { - "components": [ - "ability_base", - "ability_runtime", - "access_token", - "config_policy", - "c_utils", - "frame_aware_sched", - "hilog", - "hitrace", - "init", - "ipc", - "libxml2", - "safwk", - "samgr" - ], - "third_party": [] + "name": "@ohos/qos_manager", + "description": "qos_manager", + "version": "3.1", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "foundation/resourceschedule/qos_manager" }, - "build": { - "sub_component": [ - "//foundation/resourceschedule/qos_manager/etc/init:concurrent_task_service.cfg", - "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para", - "//foundation/resourceschedule/qos_manager/etc/param:ffrt.para.dac", - "//foundation/resourceschedule/qos_manager/sa_profile:concurrent_task_sa_profile", - "//foundation/resourceschedule/qos_manager/services:concurrentsvc", - "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client", - "//foundation/resourceschedule/qos_manager/qos:qos", - "//foundation/resourceschedule/qos_manager/frameworks/native:qos_ndk" - ], - "inner_kits": [ - { - "header": { - "header_base": "//foundation/resourceschedule/qos_manager/interfaces/inner_api/", - "header_files": [ - "concurrent_task_client.h" + "dirs": {}, + "scripts": {}, + "component": { + "name": "qos_manager", + "subsystem": "resourceschedule", + "syscap": [ "SystemCapability.Resourceschedule.QoS.Core" ], + "features": [], + "adapted_system_type": [ + "standard" + ], + "rom": "2048KB", + "ram": "10240KB", + "deps": { + "components": [ + "ability_base", + "ability_runtime", + "access_token", + "config_policy", + "c_utils", + "frame_aware_sched", + "hilog", + "hitrace", + "init", + "ipc", + "libxml2", + "safwk", + "samgr" + ], + "third_party": [ ] - }, - "name": "//foundation/resourceschedule/qos_manager/frameworks/concurrent_task_client:concurrent_task_client" }, "build": { "sub_component": [ @@ -105,15 +83,6 @@ "//foundation/resourceschedule/qos_manager/test:concurrent_unittest", "//foundation/resourceschedule/qos_manager/test/fuzztest:fuzztest" ] - }, - "name": "//foundation/resourceschedule/qos_manager/qos:qos" } - ], - "test": [ - "//foundation/resourceschedule/qos_manager/test:concurrent_unittest", - "//foundation/resourceschedule/qos_manager/test/fuzztest:fuzztest", - "//foundation/resourceschedule/qos_manager/test/fuzztest/template_fuzzer:fuzztest" - ] } - } -} \ No newline at end of file +} From cd12179cbb246ff90e5c68a6b2882b9971e81d79 Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Mon, 29 Dec 2025 23:09:36 +0800 Subject: [PATCH 3/7] Fix fuzz template coding rules Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- .../template_fuzzer/template_fuzzer.cpp | 19 +++++++++++-------- .../template_fuzzer/template_fuzzer.h | 14 ++++++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/test/fuzztest/template_fuzzer/template_fuzzer.cpp b/test/fuzztest/template_fuzzer/template_fuzzer.cpp index 8f36108..3652b34 100644 --- a/test/fuzztest/template_fuzzer/template_fuzzer.cpp +++ b/test/fuzztest/template_fuzzer/template_fuzzer.cpp @@ -24,9 +24,7 @@ #include "concurrent_task_client.h" #include "concurrent_task_controller_interface.h" #include "concurrent_task_service.h" -#define private public #include "concurrent_task_service_ability.h" -#undef private #include "func_loader.h" #include "message_option.h" #include "message_parcel.h" @@ -39,7 +37,7 @@ using namespace OHOS::QOS; namespace OHOS { namespace QOS { -int AddThreadsToProcRtg(int tid[5], int size); +int AddThreadsToProcRtg(int tid[], int size); } // namespace QOS } // namespace OHOS @@ -54,6 +52,8 @@ constexpr int MAX_IPC_STRING = 32; constexpr int MAX_PAYLOAD_STRING = 64; constexpr int MIN_IPC_BYTES = 8; constexpr int SA_TEST_ID = 5204; // arbitrary system ability id for fuzzing +constexpr size_t PROC_RTG_TID_COUNT = 5; +constexpr size_t MAX_FUZZ_SHORT_STRING_LENGTH = 8; enum class QosOp : int { CONTROLLER = 0, @@ -145,7 +145,7 @@ static void ExerciseQosPolicy(FuzzedDataProvider &fdp) static void ExerciseProcRtg(FuzzedDataProvider &fdp) { int tid = ConsumeTid(fdp); - std::array tids {}; + std::array tids {}; for (auto &item : tids) { item = ConsumeTid(fdp); } @@ -160,7 +160,8 @@ static std::unordered_map BuildStringPayload(FuzzedDat { std::unordered_map payload; payload["k"] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); - payload[fdp.ConsumeRandomLengthString(8)] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + payload[fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)] = + fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); return payload; } @@ -216,7 +217,7 @@ static void ExerciseFuncLoader(FuzzedDataProvider &fdp) { std::string path = fdp.ConsumeRandomLengthString(MAX_IPC_STRING); FuncLoader loader(path); - loader.LoadSymbol(fdp.ConsumeRandomLengthString(8).c_str()); + loader.LoadSymbol(fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH).c_str()); loader.LoadSymbol(""); loader.LoadSymbol("nonexistent_symbol"); loader.GetLoadSuccess(); @@ -242,8 +243,10 @@ static void ExerciseServiceAbility(FuzzedDataProvider &fdp) { ConcurrentTaskServiceAbility ability(SA_TEST_ID, fdp.ConsumeBool()); ability.OnStart(); - ability.OnAddSystemAbility(fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(8)); - ability.OnRemoveSystemAbility(fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(8)); + ability.OnAddSystemAbility( + fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)); + ability.OnRemoveSystemAbility( + fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)); ability.GetClassName(); if (fdp.ConsumeBool()) { ability.OnStart(); // repeat to trigger duplicate start branch diff --git a/test/fuzztest/template_fuzzer/template_fuzzer.h b/test/fuzztest/template_fuzzer/template_fuzzer.h index 53cbaea..c4d9937 100644 --- a/test/fuzztest/template_fuzzer/template_fuzzer.h +++ b/test/fuzztest/template_fuzzer/template_fuzzer.h @@ -13,7 +13,8 @@ * limitations under the License. */ -#include "template_fuzzer.h" +#ifndef RESOURCESCHEDULE_QOS_MANAGER_TEST_FUZZTEST_TEMPLATE_FUZZER_TEMPLATE_FUZZER_H +#define RESOURCESCHEDULE_QOS_MANAGER_TEST_FUZZTEST_TEMPLATE_FUZZER_TEMPLATE_FUZZER_H #include #include @@ -46,6 +47,8 @@ constexpr int RT_PRIORITY_LIMIT = 128; constexpr int MAX_IPC_STRING = 32; constexpr int MAX_PAYLOAD_STRING = 64; constexpr int MIN_IPC_BYTES = 8; +constexpr size_t PROC_RTG_TID_COUNT = 5; +constexpr size_t MAX_FUZZ_SHORT_STRING_LENGTH = 8; enum class QosOp : int { CONTROLLER = 0, @@ -137,7 +140,7 @@ static void ExerciseQosPolicy(FuzzedDataProvider &fdp) static void ExerciseProcRtg(FuzzedDataProvider &fdp) { int tid = ConsumeTid(fdp); - std::array tids {}; + std::array tids {}; for (auto &item : tids) { item = ConsumeTid(fdp); } @@ -151,7 +154,8 @@ static std::unordered_map BuildStringPayload(FuzzedDat { std::unordered_map payload; payload["k"] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); - payload[fdp.ConsumeRandomLengthString(8)] = fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); + payload[fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)] = + fdp.ConsumeRandomLengthString(MAX_PAYLOAD_STRING); return payload; } @@ -205,7 +209,7 @@ static void ExerciseFuncLoader(FuzzedDataProvider &fdp) { std::string path = fdp.ConsumeRandomLengthString(MAX_IPC_STRING); FuncLoader loader(path); - loader.LoadSymbol(fdp.ConsumeRandomLengthString(8).c_str()); + loader.LoadSymbol(fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH).c_str()); loader.GetLoadSuccess(); } @@ -277,3 +281,5 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) return 0; } } // namespace OHOS + +#endif From 8acca0423cdbe54dd27be1b354c641af7430209f Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Mon, 29 Dec 2025 23:09:57 +0800 Subject: [PATCH 4/7] Fix template fuzzer build: add fuzz-only ability wrappers Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- .../include/concurrent_task_service_ability.h | 29 +++++++++++++++++++ test/fuzztest/template_fuzzer/BUILD.gn | 1 + .../template_fuzzer/template_fuzzer.cpp | 10 +++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/services/include/concurrent_task_service_ability.h b/services/include/concurrent_task_service_ability.h index 8a9a33b..25f2dcf 100644 --- a/services/include/concurrent_task_service_ability.h +++ b/services/include/concurrent_task_service_ability.h @@ -28,6 +28,13 @@ public: ConcurrentTaskServiceAbility(int32_t sysAbilityId, bool runOnCreate) : SystemAbility(sysAbilityId, runOnCreate) {} ~ConcurrentTaskServiceAbility() override = default; +#if defined(QOS_MANAGER_FUZZTEST) + void FuzzOnStart(); + void FuzzOnStop(); + void FuzzOnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId); + void FuzzOnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId); +#endif + private: void OnStart() override; @@ -41,6 +48,28 @@ private: DISALLOW_COPY_AND_MOVE(ConcurrentTaskServiceAbility); }; + +#if defined(QOS_MANAGER_FUZZTEST) +inline void ConcurrentTaskServiceAbility::FuzzOnStart() +{ + OnStart(); +} + +inline void ConcurrentTaskServiceAbility::FuzzOnStop() +{ + OnStop(); +} + +inline void ConcurrentTaskServiceAbility::FuzzOnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +{ + OnAddSystemAbility(systemAbilityId, deviceId); +} + +inline void ConcurrentTaskServiceAbility::FuzzOnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +{ + OnRemoveSystemAbility(systemAbilityId, deviceId); +} +#endif } // namespace ConcurrentTask } // namespace OHOS diff --git a/test/fuzztest/template_fuzzer/BUILD.gn b/test/fuzztest/template_fuzzer/BUILD.gn index ac2e2d7..fc8d185 100644 --- a/test/fuzztest/template_fuzzer/BUILD.gn +++ b/test/fuzztest/template_fuzzer/BUILD.gn @@ -35,6 +35,7 @@ ohos_fuzztest("TemplateFuzzer") { sources = [ "template_fuzzer.cpp", ] + defines = [ "QOS_MANAGER_FUZZTEST" ] deps = [ "../../../frameworks/concurrent_task_client:concurrent_task_client", "../../../qos:qos", diff --git a/test/fuzztest/template_fuzzer/template_fuzzer.cpp b/test/fuzztest/template_fuzzer/template_fuzzer.cpp index 3652b34..1eeb03e 100644 --- a/test/fuzztest/template_fuzzer/template_fuzzer.cpp +++ b/test/fuzztest/template_fuzzer/template_fuzzer.cpp @@ -242,16 +242,16 @@ static void ExerciseServiceDirect(FuzzedDataProvider &fdp) static void ExerciseServiceAbility(FuzzedDataProvider &fdp) { ConcurrentTaskServiceAbility ability(SA_TEST_ID, fdp.ConsumeBool()); - ability.OnStart(); - ability.OnAddSystemAbility( + ability.FuzzOnStart(); + ability.FuzzOnAddSystemAbility( fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)); - ability.OnRemoveSystemAbility( + ability.FuzzOnRemoveSystemAbility( fdp.ConsumeIntegral(), fdp.ConsumeRandomLengthString(MAX_FUZZ_SHORT_STRING_LENGTH)); ability.GetClassName(); if (fdp.ConsumeBool()) { - ability.OnStart(); // repeat to trigger duplicate start branch + ability.FuzzOnStart(); // repeat to trigger duplicate start branch } - ability.OnStop(); + ability.FuzzOnStop(); } static void ExerciseTaskController(FuzzedDataProvider &fdp) From 4e05a085140d3150cea79c15a8cbc2f287750b6c Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Mon, 29 Dec 2025 23:12:11 +0800 Subject: [PATCH 5/7] Format: wrap fuzz wrapper signatures Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- services/include/concurrent_task_service_ability.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/include/concurrent_task_service_ability.h b/services/include/concurrent_task_service_ability.h index 25f2dcf..76e7075 100644 --- a/services/include/concurrent_task_service_ability.h +++ b/services/include/concurrent_task_service_ability.h @@ -60,12 +60,14 @@ inline void ConcurrentTaskServiceAbility::FuzzOnStop() OnStop(); } -inline void ConcurrentTaskServiceAbility::FuzzOnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +inline void ConcurrentTaskServiceAbility::FuzzOnAddSystemAbility(int32_t systemAbilityId, + const std::string& deviceId) { OnAddSystemAbility(systemAbilityId, deviceId); } -inline void ConcurrentTaskServiceAbility::FuzzOnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) +inline void ConcurrentTaskServiceAbility::FuzzOnRemoveSystemAbility(int32_t systemAbilityId, + const std::string& deviceId) { OnRemoveSystemAbility(systemAbilityId, deviceId); } From e02e82ad36dd32bdce0c25643dfcde69134e50b3 Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Fri, 3 Apr 2026 11:57:41 +0800 Subject: [PATCH 6/7] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- test/fuzztest/template_fuzzer/BUILD.gn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/fuzztest/template_fuzzer/BUILD.gn b/test/fuzztest/template_fuzzer/BUILD.gn index fc8d185..5932b4c 100644 --- a/test/fuzztest/template_fuzzer/BUILD.gn +++ b/test/fuzztest/template_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2026 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 @@ -16,7 +16,7 @@ import("//build/config/features.gni") import("//build/test.gni") ##############################fuzztest########################################## -ohos_fuzztest("TemplateFuzzer") { +ohos_fuzztest("TemplateFuzzTest") { module_out_path = "qos_manager/qos_manager/" include_dirs = [ @@ -59,7 +59,7 @@ group("fuzztest") { deps = [] deps += [ # deps file - ":TemplateFuzzer", + ":TemplateFuzzTest", ] } ############################################################################### From a0c3373f76358570f98e5e293caedc0ce8bfe557 Mon Sep 17 00:00:00 2001 From: gcw_v1zFmwMD <2553318405@qq.com> Date: Wed, 15 Apr 2026 20:59:35 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gcw_v1zFmwMD <2553318405@qq.com> --- test/fuzztest/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index c0b0648..eea147f 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -15,7 +15,7 @@ group("fuzztest") { testonly = true deps = [ "concurrent_fuzzer:ConcurrentFuzzTest", - "template_fuzzer:TemplateFuzzer", + "template_fuzzer:fuzztest", "qos_fuzzer:QosFuzzTest", "qos_policy_fuzzer:QosPolicyFuzzTest", "rtg_operations_fuzzer:RtgOperationsFuzzTest",