• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/config/features.gni")
15import("//build/test.gni")
16import("../../../../../access_token.gni")
17
18ohos_fuzztest("GetSecCompEnhanceStubFuzzTest") {
19  module_out_path = module_output_path_service_privacy
20  fuzz_config_file = "."
21
22  sources = [ "getseccompenhancestub_fuzzer.cpp" ]
23
24  cflags = [
25    "-g",
26    "-O0",
27    "-Wno-unused-variable",
28    "-fno-omit-frame-pointer",
29  ]
30
31  configs = [ "${access_token_path}/config:coverage_flags" ]
32
33  include_dirs = [
34    "${access_token_path}/frameworks/privacy/include",
35    "${access_token_path}/frameworks/common/include",
36    "${access_token_path}/interfaces/innerkits/accesstoken/include",
37    "${access_token_path}/interfaces/innerkits/privacy/include",
38    "${access_token_path}/interfaces/innerkits/privacy/src",
39    "${access_token_path}/services/privacymanager/include/active",
40    "${access_token_path}/services/privacymanager/include/common",
41    "${access_token_path}/services/privacymanager/include/database",
42    "${access_token_path}/services/privacymanager/include/record",
43    "${access_token_path}/services/privacymanager/include/seccomp",
44    "${access_token_path}/services/privacymanager/include/service",
45    "${access_token_path}/services/privacymanager/include/sensitive",
46    "${access_token_path}/services/privacymanager/include/sensitive/audio_manager/",
47    "${access_token_path}/services/privacymanager/include/sensitive/camera_manager/",
48    "${access_token_path}/services/common/ability_manager/include",
49    "${access_token_path}/services/common/app_manager/include",
50    "${access_token_path}/services/common/database/include",
51    "${access_token_path}/services/common/libraryloader/include",
52    "${access_token_path}/services/common/power_manager/include",
53    "${access_token_path}/services/common/screenlock_manager/include",
54  ]
55
56  sources += [
57    "${access_token_path}/services/common/app_manager/src/app_manager_access_client.cpp",
58    "${access_token_path}/services/common/app_manager/src/app_manager_access_proxy.cpp",
59    "${access_token_path}/services/common/app_manager/src/app_manager_death_recipient.cpp",
60    "${access_token_path}/services/common/app_manager/src/app_state_data.cpp",
61    "${access_token_path}/services/common/app_manager/src/app_status_change_callback.cpp",
62    "${access_token_path}/services/common/app_manager/src/process_data.cpp",
63    "${access_token_path}/services/common/libraryloader/src/libraryloader.cpp",
64    "${access_token_path}/services/privacymanager/src/active/active_status_callback_manager.cpp",
65    "${access_token_path}/services/privacymanager/src/active/perm_active_status_callback_death_recipient.cpp",
66    "${access_token_path}/services/privacymanager/src/active/perm_active_status_change_callback_proxy.cpp",
67    "${access_token_path}/services/privacymanager/src/active/state_change_callback_proxy.cpp",
68    "${access_token_path}/services/privacymanager/src/common/constant.cpp",
69    "${access_token_path}/services/privacymanager/src/database/data_translator.cpp",
70    "${access_token_path}/services/privacymanager/src/database/permission_used_record_db.cpp",
71    "${access_token_path}/services/privacymanager/src/database/privacy_field_const.cpp",
72    "${access_token_path}/services/privacymanager/src/record/on_permission_used_record_callback_proxy.cpp",
73    "${access_token_path}/services/privacymanager/src/record/permission_record.cpp",
74    "${access_token_path}/services/privacymanager/src/record/permission_record_manager.cpp",
75    "${access_token_path}/services/privacymanager/src/record/permission_record_repository.cpp",
76    "${access_token_path}/services/privacymanager/src/record/permission_used_record_cache.cpp",
77    "${access_token_path}/services/privacymanager/src/seccomp/privacy_sec_comp_enhance_agent.cpp",
78    "${access_token_path}/services/privacymanager/src/sensitive/audio_manager/audio_global_switch_change_stub.cpp",
79    "${access_token_path}/services/privacymanager/src/sensitive/audio_manager/audio_manager_privacy_client.cpp",
80    "${access_token_path}/services/privacymanager/src/sensitive/audio_manager/audio_manager_privacy_death_recipient.cpp",
81    "${access_token_path}/services/privacymanager/src/sensitive/audio_manager/audio_manager_privacy_proxy.cpp",
82    "${access_token_path}/services/privacymanager/src/sensitive/camera_manager/camera_manager_privacy_client.cpp",
83    "${access_token_path}/services/privacymanager/src/sensitive/camera_manager/camera_manager_privacy_death_recipient.cpp",
84    "${access_token_path}/services/privacymanager/src/sensitive/camera_manager/camera_manager_privacy_proxy.cpp",
85    "${access_token_path}/services/privacymanager/src/sensitive/camera_manager/camera_service_callback_stub.cpp",
86    "${access_token_path}/services/privacymanager/src/service/privacy_manager_service.cpp",
87    "${access_token_path}/services/privacymanager/src/service/privacy_manager_stub.cpp",
88  ]
89
90  if (use_musl) {
91    if (use_jemalloc && use_jemalloc_dfx_intf) {
92      defines = [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
93    }
94  }
95
96  cflags_cc = [
97    "-DHILOG_ENABLE",
98    "-DFUZZ_ENABLE",
99    "-DSECURITY_COMPONENT_ENHANCE_ENABLE",
100  ]
101
102  deps = [
103    "${access_token_path}/frameworks/common:accesstoken_common_cxx",
104    "${access_token_path}/frameworks/privacy:privacy_communication_adapter_cxx",
105    "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
106    "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
107    "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk",
108    "${access_token_path}/services/common:accesstoken_service_common",
109  ]
110
111  external_deps = [
112    "ability_base:want",
113    "audio_framework:audio_client",
114    "c_utils:utils",
115    "hilog:libhilog",
116    "hisysevent:libhisysevent",
117    "init:libbegetutil",
118    "ipc:ipc_core",
119    "safwk:system_ability_fwk",
120    "samgr:samgr_proxy",
121    "sqlite:sqlite",
122  ]
123
124  if (common_event_service_enable) {
125    cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
126    external_deps += [ "common_event_service:cesfwk_innerkits" ]
127    sources += [ "${access_token_path}/services/privacymanager/src/common/privacy_common_event_subscriber.cpp" ]
128  }
129
130  if (window_manager_enable && access_token_camera_float_window_enable) {
131    cflags_cc += [ "-DCAMERA_FLOAT_WINDOW_ENABLE" ]
132    include_dirs +=
133        [ "${access_token_path}/services/common/window_manager/include" ]
134  }
135
136  if (theme_screenlock_mgr_enable) {
137    cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
138    external_deps += [ "screenlock_mgr:screenlock_client" ]
139  }
140
141  if (access_token_background_task_mgr_continuous_task_enable == true) {
142    cflags_cc += [ "-DBGTASKMGR_CONTINUOUS_TASK_ENABLE" ]
143    include_dirs += [ "${access_token_path}/services/privacymanager/include/background_task_manager" ]
144    sources += [
145      "${access_token_path}/services/privacymanager/src/background_task_manager/background_task_manager_access_client.cpp",
146      "${access_token_path}/services/privacymanager/src/background_task_manager/background_task_manager_access_proxy.cpp",
147      "${access_token_path}/services/privacymanager/src/background_task_manager/background_task_manager_death_recipient.cpp",
148      "${access_token_path}/services/privacymanager/src/background_task_manager/continuous_task_callback_info.cpp",
149      "${access_token_path}/services/privacymanager/src/background_task_manager/continuous_task_change_callback.cpp",
150    ]
151  }
152}
153