提交 8ab00aa4 编写于 作者: Z zhang-deyao 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/startup_init_lite into add_uid

Signed-off-by: Nzhang-deyao <zhangdeyao@huawei.com>
......@@ -52,7 +52,6 @@
],
"fwk_group": [
"//base/startup/init/services:startup_init",
"//base/startup/init/ueventd:startup_ueventd",
"//base/startup/init/services/begetctl:begetctl_cmd",
"//base/startup/init/services/loopevent:loopeventgroup",
"//base/startup/init/services/modules:modulesgroup",
......@@ -63,7 +62,9 @@
],
"service_group": [
"//base/startup/init/watchdog:watchdog",
"//base/startup/init/services/etc:watchdog.cfg"
"//base/startup/init/services/etc:watchdog.cfg",
"//base/startup/init/ueventd:startup_ueventd",
"//base/startup/init/services/etc:ueventd.cfg"
]
},
"inner_kits": [
......
#
# Copyright (c) 2020-2022 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.
static_library("hal_sys_param") {
sources = [ "hal_sys_param.c" ]
include_dirs = [ "//base/startup/init/interfaces/hals" ]
defines = [
"INCREMENTAL_VERSION=\"${ohos_version}\"",
"BUILD_TYPE=\"${ohos_build_type}\"",
"BUILD_USER=\"${ohos_build_user}\"",
"BUILD_TIME=\"${ohos_build_time}\"",
"BUILD_HOST=\"${ohos_build_host}\"",
"BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
]
}
/*
* Copyright (c) 2020-2022 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 "hal_sys_param.h"
static const char OHOS_ABI_LIST[] = {"****"};
static const char OHOS_BOOTLOADER_VERSION[] = {"bootloader"};
static const char OHOS_BRAND[] = {"****"};
static const char OHOS_DEVICE_TYPE[] = {"****"};
static const char OHOS_DISPLAY_VERSION[] = {"OpenHarmony 3.1"};
static const char OHOS_HARDWARE_MODEL[] = {"****"};
static const char OHOS_HARDWARE_PROFILE[] = {"aout:true,display:true"};
static const char OHOS_MARKET_NAME[] = {"****"};
static const char OHOS_MANUFACTURE[] = {"****"};
static const char OHOS_PRODUCT_MODEL[] = {"****"};
static const char OHOS_PRODUCT_SERIES[] = {"****"};
static const char OHOS_SERIAL[] = {"****"}; // provided by OEM.
static const char OHOS_SOFTWARE_MODEL[] = {"****"};
static const int OHOS_FIRST_API_VERSION = 1;
__attribute__((weak)) const char* HalGetDeviceType(void)
{
return OHOS_DEVICE_TYPE;
}
__attribute__((weak)) const char* HalGetManufacture(void)
{
return OHOS_MANUFACTURE;
}
__attribute__((weak)) const char* HalGetBrand(void)
{
return OHOS_BRAND;
}
__attribute__((weak)) const char* HalGetMarketName(void)
{
return OHOS_MARKET_NAME;
}
__attribute__((weak)) const char* HalGetProductSeries(void)
{
return OHOS_PRODUCT_SERIES;
}
__attribute__((weak)) const char* HalGetProductModel(void)
{
return OHOS_PRODUCT_MODEL;
}
__attribute__((weak)) const char* HalGetSoftwareModel(void)
{
return OHOS_SOFTWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareModel(void)
{
return OHOS_HARDWARE_MODEL;
}
__attribute__((weak)) const char* HalGetHardwareProfile(void)
{
return OHOS_HARDWARE_PROFILE;
}
__attribute__((weak)) const char* HalGetSerial(void)
{
return OHOS_SERIAL;
}
__attribute__((weak)) const char* HalGetBootloaderVersion(void)
{
return OHOS_BOOTLOADER_VERSION;
}
__attribute__((weak)) const char* HalGetAbiList(void)
{
return OHOS_ABI_LIST;
}
__attribute__((weak)) const char* HalGetDisplayVersion(void)
{
return OHOS_DISPLAY_VERSION;
}
__attribute__((weak)) const char* HalGetIncrementalVersion(void)
{
return INCREMENTAL_VERSION;
}
__attribute__((weak)) const char* HalGetBuildType(void)
{
return BUILD_TYPE;
}
__attribute__((weak)) const char* HalGetBuildUser(void)
{
return BUILD_USER;
}
__attribute__((weak)) const char* HalGetBuildHost(void)
{
return BUILD_HOST;
}
__attribute__((weak)) const char* HalGetBuildTime(void)
{
return BUILD_TIME;
}
__attribute__((weak)) int HalGetFirstApiVersion(void)
{
return OHOS_FIRST_API_VERSION;
}
\ No newline at end of file
#
# Copyright (c) 2020-2022 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.
static_library("static_hal_token") {
sources = [ "hal_token.c" ]
include_dirs = [
"//base/startup/init/interfaces/hals",
"//commonlibrary/utils_lite/include",
]
deps = []
}
/*
* Copyright (c) 2020-2022 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 "hal_token.h"
#include "ohos_errno.h"
#include "ohos_types.h"
__attribute__((weak)) static int OEMReadToken(char* token, unsigned int len)
{
// OEM need add here, read token from device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMWriteToken(const char* token, unsigned int len)
{
// OEM need add here, write token to device
(void)(token);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetAcKey(char* acKey, unsigned int len)
{
// OEM need add here, get AcKey
(void)(acKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdId(char* productId, unsigned int len)
{
// OEM need add here, get ProdId
(void)(productId);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) static int OEMGetProdKey(char* productKey, unsigned int len)
{
// OEM need add here, get ProdKey
(void)(productKey);
(void)(len);
return EC_SUCCESS;
}
__attribute__((weak)) int HalReadToken(char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMReadToken(token, len);
}
__attribute__((weak)) int HalWriteToken(const char* token, unsigned int len)
{
if (token == NULL) {
return EC_FAILURE;
}
return OEMWriteToken(token, len);
}
__attribute__((weak)) int HalGetAcKey(char* acKey, unsigned int len)
{
if (acKey == NULL) {
return EC_FAILURE;
}
return OEMGetAcKey(acKey, len);
}
__attribute__((weak)) int HalGetProdId(char* productId, unsigned int len)
{
if (productId == NULL) {
return EC_FAILURE;
}
return OEMGetProdId(productId, len);
}
__attribute__((weak)) int HalGetProdKey(char* productKey, unsigned int len)
{
if (productKey == NULL) {
return EC_FAILURE;
}
return OEMGetProdKey(productKey, len);
}
\ No newline at end of file
......@@ -109,7 +109,17 @@ if (defined(ohos_lite)) {
sources = []
if (enable_ohos_startup_init_feature_begetctl_liteos) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
PRODUCT_HAL_SYSPARAM_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/sys_param")
cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_SYSPARAM_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_SYSPARAM_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
}
deps += [
"//base/startup/init/interfaces/hals/utils/sys_param:hal_sys_param",
]
defines += [ "LITEOS_SUPPORT" ]
sources += syspara_sources
} else {
......
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fcntl.h>
#include <unistd.h>
......
......@@ -34,6 +34,8 @@ int SystemWriteParam(const char *name, const char *value);
int SystemReadParam(const char *name, char *value, unsigned int *len);
int LoadParamsFile(const char *fileName, bool onlyAdd);
typedef int (*CmdExecutor)(int id, const char *name, int argc, const char **argv);
int AddCmdExecutor(const char *cmdName, CmdExecutor execCmd);
......
[
{ "name": "SystemWriteParam" },
{ "name": "SystemReadParam" },
{ "name": "LoadParamsFile" },
{ "name": "SplitString" },
{ "name": "AddCmdExecutor" },
{ "name": "RemoveCmdExecutor" },
......
......@@ -44,8 +44,16 @@ if (ohos_kernel_type == "liteos_m") {
"//base/startup/init/interfaces/innerkits/token",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
]
deps = [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
PRODUCT_HAL_TOKEN_PATH =
rebase_path("//${ohos_product_adapter_dir}/utils/token")
cmd = "if [ -f ${PRODUCT_HAL_TOKEN_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
PRODUCT_HAL_TOKEN_EXISTS =
exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
if (PRODUCT_HAL_TOKEN_EXISTS) {
deps += [ "$ohos_product_adapter_dir/utils/token:hal_token_static" ]
}
deps +=
[ "//base/startup/init/interfaces/hals/utils/token:static_hal_token" ]
}
}
......
......@@ -107,18 +107,8 @@ if (defined(ohos_lite)) {
}
symlink_target_name = [
"misc_daemon",
"reboot",
"devctl",
"service",
"service_control",
"start_service",
"stop_service",
"service",
"sandbox",
"dump_service",
"setloglevel",
"getloglevel",
]
if (enable_ohos_startup_init_feature_ab_partition) {
......@@ -128,7 +118,6 @@ if (defined(ohos_lite)) {
"drivers_interface_partitionslot:libpartitionslot_proxy_1.0",
"hdf_core:libhdi",
]
symlink_target_name += [ "partitionslot" ]
}
install_images = [ "system" ]
......
......@@ -209,7 +209,6 @@ if (defined(ohos_lite)) {
":syscap.json",
":syscap.para",
":systemcapability.json",
":ueventd.cfg",
]
}
}
......@@ -29,10 +29,10 @@ shared_relro:x:1037:
audio:x:1041:
cameraserver:x:1047:
uiserver:x:1048:
servicectrl:x:1050:root,shell,system,samgr,hdf_devmgr
powerctrl:x:1051:root,shell,system,update,power_host
servicectrl:x:1050:root,shell,system,samgr,hdf_devmgr,foundation
powerctrl:x:1051:root,shell,system,update,power_host,charger,foundation
bootctrl:x:1052:root,shell,system
deviceprivate:x:1053:root,shell,system,samgr,hdf_devmgr,deviceinfo,dsoftbus,dms,account,useriam,access_token,device_manager,foundation,dbms,deviceauth,huks_server,dlp_credential
deviceprivate:x:1053:root,shell,system,samgr,hdf_devmgr,deviceinfo,dsoftbus,dms,account,useriam,access_token,device_manager,foundation,dbms,deviceauth,huks_server,dlp_credential,dsserver,edm
hiview:x:1201:
hidumper_service:x:1212:
shell:x:2000:
......@@ -121,3 +121,4 @@ dfs_share:x:3822:
appspawn:x:4000:
security_guard:x:3520:
tee:x:6668:
dsserver:x:3068:
......@@ -8,6 +8,8 @@
"name" : "pre-init",
"cmds" : [
"write /proc/sys/kernel/sysrq 0",
"write /proc/sys/kernel/dmesg_restrict 1",
"write /proc/sys/kernel/kptr_restrict 1",
"start ueventd",
"start watchdog_service",
"mkdir /data",
......@@ -118,7 +120,6 @@
"mkdir /data/service/el1 0711 root root",
"mkdir /data/service/el1/public 0711 root root",
"mkdir /data/service/el1/public/AbilityManagerService 0711 system system",
"mkdir /data/service/el1/public/access_token 0770 access_token access_token",
"mkdir /data/service/el2 0711 root root",
"mkdir /data/chipset 0711 root root",
"mkdir /data/chipset/el1 0711 root root",
......
......@@ -105,7 +105,6 @@
"mkdir /data/app/el4 0711 root root",
"mkdir /data/service/el1 0711 root root",
"mkdir /data/service/el1/public 0711 root root",
"mkdir /data/service/el1/public/access_token 0770 access_token access_token",
"mkdir /data/service/el2 0711 root root",
"mkdir /data/chipset 0711 root root",
"mkdir /data/chipset/el1 0711 root root",
......
......@@ -18,16 +18,7 @@ startup_param=40960
persist_param=40960
const_param=40960
persist_sys_param=4096
hw_sc_param=4096
hw_sc_build_os_param=4096
init_param=4096
init_svc_param=4096
const_postinstall_param=4096
const_postinstall_fstab_param=4096
const_allow_param=4096
const_allow_mock_param=4096
devinfo_public_param=30720
security_param=4096
sys_param=4096
bootevent_param=4096
startup_init_param=40960
......@@ -117,3 +117,4 @@ ispserver:x:3821:3821:::/bin/false
dfs_share:x:3822:3822:::/bin/false
security_guard:x:3520:3520:::/bin/false
tee:x:6668:6668:::/bin/false
dsserver:x:3068:3068:::/bin/false
......@@ -36,8 +36,6 @@ extern "C" {
#define PARAM_NAME_LEN_MAX 96
#endif
typedef uint32_t ParamHandle;
typedef enum {
PARAM_CODE_ERROR = -1,
PARAM_CODE_SUCCESS = 0,
......@@ -166,21 +164,6 @@ int SystemSetParameter(const char *name, const char *value);
*/
#define SystemGetParameter SystemReadParam
/**
* 对外接口
* 查询参数,主要用于其他进程使用,找到对应属性的handle。
*
*/
int SystemFindParameter(const char *name, ParamHandle *handle);
/**
* 对外接口
* 根据handle获取对应数据的修改标识。
* commitId 获取计数变化
*
*/
int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId);
/**
* 外部接口
* 遍历参数。
......@@ -198,13 +181,6 @@ int SystemTraversalParameter(const char *prefix,
*/
int SystemGetParameterName(ParamHandle handle, char *name, unsigned int len);
/**
* 外部接口
* 获取参数值。
*
*/
int SystemGetParameterValue(ParamHandle handle, char *value, unsigned int *len);
/**
* 外部接口
* 等待某个参数值被修改,阻塞直到参数值被修改或超时
......@@ -216,7 +192,6 @@ typedef void (*ParameterChangePtr)(const char *key, const char *value, void *con
int SystemWatchParameter(const char *keyprefix, ParameterChangePtr change, void *context);
int SystemCheckParamExist(const char *name);
long long GetSystemCommitId(void);
void SystemDumpParameters(int verbose, int (*dump)(const char *fmt, ...));
......
......@@ -23,6 +23,8 @@ extern "C" {
#endif
#endif
typedef uint32_t ParamHandle;
typedef struct {
uint8_t updaterMode;
void (*logFunc)(int logLevel, uint32_t domain, const char *tag, const char *fmt, va_list vargs);
......@@ -45,6 +47,31 @@ int SystemReadParam(const char *name, char *value, uint32_t *len);
* parameter client初始化接口 供服务调用
*/
void InitParameterClient(void);
/**
* 对外接口
* 查询参数,主要用于其他进程使用,找到对应属性的handle。
*
*/
int SystemFindParameter(const char *name, ParamHandle *handle);
/**
* 对外接口
* 根据handle获取对应数据的修改标识。
* commitId 获取计数变化
*
*/
int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId);
/**
* 外部接口
* 获取参数值。
*
*/
int SystemGetParameterValue(ParamHandle handle, char *value, unsigned int *len);
long long GetSystemCommitId(void);
#ifdef __cplusplus
#if __cplusplus
}
......
......@@ -244,7 +244,9 @@ void CloseServiceSocket(Service *service)
sockopt->sockFd = -1;
}
if (GetSocketAddr(&addr, sockopt->name) == 0) {
#ifndef STARTUP_INIT_TEST
unlink(addr.sun_path);
#endif
}
sockopt = sockopt->next;
}
......
......@@ -12,7 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <unistd.h>
#include <linux/reboot.h>
#include <sys/reboot.h>
#include <sys/syscall.h>
#include "reboot_adp.h"
#include "init_cmdexecutor.h"
......@@ -103,11 +107,23 @@ static int DoRebootSuspend(int id, const char *name, int argc, const char **argv
return DoRoot_("suspend", RB_AUTOBOOT);
}
static int DoRebootOther(int id, const char *name, int argc, const char **argv)
{
UNUSED(id);
UNUSED(name);
PLUGIN_CHECK(argc >= 1, return -1, "Invalid parameter argc %d", argc);
const char *cmd = strstr(argv[0], "reboot,");
PLUGIN_CHECK(cmd != NULL, return -1, "Invalid parameter argc %s", argv[0]);
PLUGIN_LOGI("DoRebootOther argv %s", argv[0]);
return syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, cmd + strlen("reboot,"));
}
static void RebootAdpInit(void)
{
// sample {"reboot,shutdown", "reboot.shutdown", "reboot.shutdown"},
// add default reboot cmd
(void)AddCmdExecutor("reboot", DoReboot);
(void)AddCmdExecutor("reboot.other", DoRebootOther);
AddRebootCmdExecutor("shutdown", DoRebootShutdown);
AddRebootCmdExecutor("flashd", DoRebootFlashed);
AddRebootCmdExecutor("updater", DoRebootUpdater);
......
......@@ -162,6 +162,14 @@ cacheflush
set_tls
sched_setscheduler
mkdir
setitimer
execve
sched_getscheduler
fstatfs
setsid
rt_tgsigqueueinfo
ptrace
membarrier
@allowListWithArgs
getrusage:if arg0 == RUSAGE_SELF || arg0 == RUSAGE_THREAD; return ALLOW; else return KILL_PROCESS;
......
......@@ -131,6 +131,14 @@ getrandom
statx
prlimit64
sched_setscheduler
setitimer
execve
sched_getscheduler
fstatfs
setsid
rt_tgsigqueueinfo
ptrace
membarrier
@allowListWithArgs
getrusage:if arg0 == RUSAGE_SELF || arg0 == RUSAGE_THREAD; return ALLOW; else return KILL_PROCESS;
......
......@@ -129,6 +129,9 @@ static int LoadOneParam_(const uint32_t *context, const char *name, const char *
auditData.name = name;
int ret = GetParamDacData(&auditData.dacData, value);
PARAM_CHECK(ret == 0, return -1, "Failed to get param info %d %s", ret, name);
if (INVALID_UID(auditData.dacData.gid) || INVALID_UID(auditData.dacData.uid)) {
PARAM_LOGW("Invalid dac for '%s' gid %d uid %d", name, auditData.dacData.gid, auditData.dacData.uid);
}
AddSecurityLabel(&auditData);
return 0;
}
......@@ -266,7 +269,7 @@ static int DacCheckParamPermission(const ParamSecurityLabel *srcLabel, const cha
if (ret != DAC_RESULT_PERMISSION) {
PARAM_LOGW("Param '%s' label gid:%d uid:%d mode 0%o", name, srcLabel->cred.gid, srcLabel->cred.uid, localMode);
PARAM_LOGW("Cfg label %d gid:%d uid:%d mode 0%o ", labelIndex, node->gid, node->uid, node->mode);
#ifndef STARTUP_INIT_TEST
#ifndef __MUSL__
ret = DAC_RESULT_PERMISSION;
#endif
}
......
......@@ -286,3 +286,40 @@ INIT_LOCAL_API int AddWorkSpace(const char *name, int onlyRead, uint32_t spaceSi
PARAM_LOGV("AddWorkSpace %s %s", name, ret == 0 ? "success" : "fail");
return ret;
}
int SystemFindParameter(const char *name, ParamHandle *handle)
{
PARAM_CHECK(name != NULL && handle != NULL, return -1, "The name or handle is null");
int ret = ReadParamWithCheck(name, DAC_READ, handle);
if (ret != PARAM_CODE_NOT_FOUND && ret != 0 && ret != PARAM_CODE_NODE_EXIST) {
PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name);
}
return ret;
}
int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId)
{
PARAM_CHECK(handle != 0 && commitId != NULL, return -1, "The handle is null");
ParamNode *entry = (ParamNode *)GetTrieNodeByHandle(handle);
if (entry == NULL) {
return PARAM_CODE_NOT_FOUND;
}
*commitId = ReadCommitId(entry);
return 0;
}
long long GetSystemCommitId(void)
{
WorkSpace *space = GetWorkSpace(WORKSPACE_NAME_DAC);
if (space == NULL || space->area == NULL) {
return 0;
}
return ATOMIC_LOAD_EXPLICIT(&space->area->commitId, memory_order_acquire);
}
int SystemGetParameterValue(ParamHandle handle, char *value, unsigned int *len)
{
PARAM_CHECK(len != NULL && handle != 0, return -1, "The value is null");
return ReadParamValue(handle, value, len);
}
\ No newline at end of file
......@@ -45,7 +45,15 @@ extern "C" {
#endif
#define PARAM_WORKSPACE_INVALID ((uint32_t)-1)
#define PARAM_WORKSPACE_MIN (4096)
#define PARAM_WORKSPACE_MIN (1024)
/*
length for parameter = node size + data size
xxxx.xxxx.xxxx.xxxx
node size:
24 * (count(.) + 1) + strlen(xxxx.xxxx.xxxx.xxxx)
data size
strlen(xxxx.xxxx.xxxx.xxxx) + 96
*/
#if (defined __LITEOS_A__ || defined __LITEOS_M__)
#define DAC_DEFAULT_MODE 0777
#ifdef STARTUP_INIT_TEST
......
......@@ -39,7 +39,7 @@ __attribute__((constructor)) static void ParameterInit(void)
if (getpid() == 1) {
return;
}
EnableInitLog(INIT_ERROR);
EnableInitLog(INIT_INFO);
PARAM_WORKSPACE_OPS ops = {0};
ops.updaterMode = 0;
#ifdef PARAM_BASE_LOG
......@@ -246,16 +246,6 @@ int SystemCheckParamExist(const char *name)
return SysCheckParamExist(name);
}
int SystemFindParameter(const char *name, ParamHandle *handle)
{
PARAM_CHECK(name != NULL && handle != NULL, return -1, "The name or handle is null");
int ret = ReadParamWithCheck(name, DAC_READ, handle);
if (ret != PARAM_CODE_NOT_FOUND && ret != 0 && ret != PARAM_CODE_NODE_EXIST) {
PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name);
}
return ret;
}
int WatchParamCheck(const char *keyprefix)
{
PARAM_CHECK(keyprefix != NULL, return PARAM_CODE_INVALID_PARAM, "Invalid keyprefix");
......
......@@ -113,13 +113,3 @@ int SystemCheckParamExist(const char *name)
{
return SysCheckParamExist(name);
}
int SystemFindParameter(const char *name, ParamHandle *handle)
{
PARAM_CHECK(name != NULL && handle != NULL, return -1, "The name or handle is null");
int ret = ReadParamWithCheck(name, DAC_READ, handle);
if (ret != PARAM_CODE_NOT_FOUND && ret != 0 && ret != PARAM_CODE_NODE_EXIST) {
PARAM_CHECK(ret == 0, return ret, "Forbid to access parameter %s", name);
}
return ret;
}
......@@ -299,7 +299,7 @@ static int GetServiceCtrlInfoForPowerCtrl(const char *name, const char *value, S
}
// not found reboot, so reboot by normal
valueOffset = strlen(OHOS_SERVICE_CTRL_PREFIX) + strlen("reboot") + 1;
return CreateCtrlInfo(ctrlInfo, "reboot", valueOffset, 1, "%s%s.%s", OHOS_SERVICE_CTRL_PREFIX, "reboot", value);
return CreateCtrlInfo(ctrlInfo, "reboot.other", valueOffset, 1, "%s%s.%s", OHOS_SERVICE_CTRL_PREFIX, "reboot", value);
}
INIT_LOCAL_API int GetServiceCtrlInfo(const char *name, const char *value, ServiceCtrlInfo **ctrlInfo)
......@@ -376,35 +376,8 @@ INIT_LOCAL_API int CheckParameterSet(const char *name,
return ret;
}
int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId)
{
PARAM_CHECK(handle != 0 && commitId != NULL, return -1, "The handle is null");
ParamNode *entry = (ParamNode *)GetTrieNodeByHandle(handle);
if (entry == NULL) {
return PARAM_CODE_NOT_FOUND;
}
*commitId = ReadCommitId(entry);
return 0;
}
long long GetSystemCommitId(void)
{
WorkSpace *space = GetWorkSpace(WORKSPACE_NAME_DAC);
if (space == NULL || space->area == NULL) {
return 0;
}
return ATOMIC_LOAD_EXPLICIT(&space->area->commitId, memory_order_acquire);
}
int SystemGetParameterName(ParamHandle handle, char *name, unsigned int len)
{
PARAM_CHECK(name != NULL && handle != 0, return -1, "The name is null");
return ReadParamName(handle, name, len);
}
int SystemGetParameterValue(ParamHandle handle, char *value, unsigned int *len)
{
PARAM_CHECK(len != NULL && handle != 0, return -1, "The value is null");
return ReadParamValue(handle, value, len);
}
\ No newline at end of file
......@@ -192,6 +192,11 @@ static int ProcessParamFile(const char *fileName, void *context)
return LoadDefaultParam_(fileName, mode, exclude, ARRAY_LENGTH(exclude), LoadOneParam_);
}
int LoadParamsFile(const char *fileName, bool onlyAdd)
{
return LoadDefaultParams(fileName, onlyAdd ? LOAD_PARAM_ONLY_ADD : LOAD_PARAM_NORMAL);
}
int LoadDefaultParams(const char *fileName, uint32_t mode)
{
PARAM_CHECK(fileName != NULL, return -1, "Invalid filename for load");
......
/*
* Copyright (c) 2022 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 "AclGetDevUdid_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzAclGetDevUdid(const uint8_t* data, size_t size)
{
bool result = false;
char udid[65] = {0};
int len = sizeof(udid);
if (!AclGetDevUdid(udid, len)) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzAclGetDevUdid(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H
#define TEST_FUZZTEST_ACL_GET_DEV_UDID_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "AclGetDevUdid_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 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.
......
/*
* Copyright (c) 2022 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 "AclGetSerial_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzAclGetSerial(const uint8_t* data, size_t size)
{
bool result = false;
if (AclGetSerial() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzAclGetSerial(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_ACL_GET_SERIAL_H
#define TEST_FUZZTEST_ACL_GET_SERIAL_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "AclGetSerial_fuzzer"
#endif
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 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.
......
此差异已折叠。
/*
* Copyright (c) 2022 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 <string>
#include "fd_holder_internal.h"
#include "BuildControlMessage_fuzzer.h"
namespace OHOS {
bool FuzzBuildControlMessage(const uint8_t* data, size_t size)
{
bool result = false;
if (!BuildControlMessage(nullptr, nullptr, 1, false)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzBuildControlMessage(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_BUILD_CONTROL_MESSAGE_H
#define TEST_FUZZTEST_BUILD_CONTROL_MESSAGE_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "BuildControlMessage_fuzzer"
#endif
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 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.
......
/*
* Copyright (c) 2022 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 "CmdClientInit_fuzzer.h"
#include <string>
#include "control_fd.h"
namespace OHOS {
bool FuzzCmdClientInit(const uint8_t* data, size_t size)
{
std::string str(reinterpret_cast<const char*>(data), size);
CmdClientInit(str.c_str(), 1, str.c_str());
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdClientInit(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_CMD_CLIENT_INIT_FUZZER_H
#define TEST_FUZZTEST_CMD_CLIENT_INIT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdClientInit_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021-2022 Huawei Device Co., Ltd.
<!-- Copyright (c) 2022 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.
......
/*
* Copyright (c) 2022 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 "CmdServiceInit_fuzzer.h"
#include <string>
#include "fuzz_utils.h"
#include "control_fd.h"
static void Func(uint16_t type, const char *serviceCmd, const void *context)
{
printf("type is:%d, serviceCmd is:%s\n", type, serviceCmd);
}
namespace OHOS {
bool FuzzCmdServiceInit(const uint8_t* data, size_t size)
{
std::string str(reinterpret_cast<const char*>(data), size);
CloseStdout();
CmdServiceInit(str.c_str(), Func);
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdServiceInit(data, size);
return 0;
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_CMD_SERVICE_INIT_FUZZER_H
#define TEST_FUZZTEST_CMD_SERVICE_INIT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdServiceInit_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "CmdServiceProcessDelClient_fuzzer.h"
#include <string>
#include "control_fd.h"
namespace OHOS {
bool FuzzCmdServiceProcessDelClient(const uint8_t* data, size_t size)
{
CmdServiceProcessDelClient(1);
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzCmdServiceProcessDelClient(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H
#define TEST_FUZZTEST_CMD_SERVICE_PROCESS_DEL_CLIENT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "CmdServiceProcessDelClient_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "DoFormat_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzDoFormat(const uint8_t* data, size_t size)
{
bool resule = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!DoFormat(str.c_str(), str.c_str())) {
resule = true;
};
return resule;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzDoFormat(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_DO_FORMAT_FUZZER_H
#define TEST_FUZZTEST_DO_FORMAT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "DoFormat_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "FindFstabItemForMountPoint_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzFindFstabItemForMountPoint(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
if (FindFstabItemForMountPoint(*fstab, str.c_str()) != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzFindFstabItemForMountPoint(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H
#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_MOUNT_POINT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindFstabItemForMountPoint_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "FindFstabItemForPath_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzFindFstabItemForPath(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
if (FindFstabItemForPath(*fstab, str.c_str()) != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzFindFstabItemForPath(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H
#define TEST_FUZZTEST_FIND_FSTAB_ITEM_FOR_PATH_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindFstabItemForPath_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
* 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,
......@@ -13,18 +13,16 @@
* limitations under the License.
*/
#include "systemfindparameter_fuzzer.h"
#include "FindParameter_fuzzer.h"
#include<string>
#include "init_param.h"
static ParamHandle handle;
#include "parameter.h"
namespace OHOS {
bool FuzzSystemFindParameter(const uint8_t* data, size_t size)
bool FuzzFindParameter(const uint8_t* data, size_t size)
{
bool result = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!SystemFindParameter(str.c_str(), &handle)) {
if (!FindParameter(str.c_str())) {
result = true;
}
return result;
......@@ -35,6 +33,6 @@ namespace OHOS {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzSystemFindParameter(data, size);
OHOS::FuzzFindParameter(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_FINDPARAMETER_FUZZER_H
#define TEST_FUZZTEST_FINDPARAMETER_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "FindParameter_fuzzer"
#endif
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetAbiList_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzGetAbiList(const uint8_t* data, size_t size)
{
bool result = false;
if (GetAbiList() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetAbiList(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_ABILIST_H
#define TEST_FUZZTEST_GET_ABILIST_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetAbiList_fuzzer"
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBlockDeviceByMountPoint_fuzzer.h"
#include <iostream>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDeviceByMountPoint(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
const Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
char deviceName[100] = {0};
int length = sizeof(deviceName);
if (!GetBlockDeviceByMountPoint(str.c_str(), fstab, deviceName, length)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDeviceByMountPoint(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_BY_MOUNT_POINT_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDeviceByMountPoint_fuzzer"
#endif
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBlockDeviceByName_fuzzer.h"
#include <iostream>
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDeviceByName(const uint8_t* data, size_t size)
{
bool result = false;
FILE *pFile = nullptr;
pFile = fopen("fstab.test", "w+");
if (pFile == nullptr) {
std::cout << "[fuzz] open file fstab.test failed";
return false;
}
if (fwrite(data, 1, size, pFile) != size) {
std::cout << "[fuzz] write data to fstab.test failed";
(void)fclose(pFile);
return false;
}
(void)fclose(pFile);
CloseStdout();
const Fstab *fstab = ReadFstabFromFile("fstab.test", false);
std::string str(reinterpret_cast<const char*>(data), size);
char miscDev[1024] = {0};
size_t len = sizeof(miscDev);
if (GetBlockDeviceByName(str.c_str(), fstab, miscDev, len)) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDeviceByName(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_NAME_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDeviceByName_fuzzer"
#endif
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBlockDevicePath_fuzzer.h"
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBlockDevicePath(const uint8_t* data, size_t size)
{
bool result = false;
std::string str(reinterpret_cast<const char*>(data), size);
if (!GetBlockDevicePath(str.c_str(), nullptr, size)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBlockDevicePath(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H
#define TEST_FUZZTEST_GET_BLOCK_DEVICE_PATH_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBlockDevicePath_fuzzer"
#endif
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBoolParameterCpp_fuzzer.h"
#include<string>
#include "parameters.h"
namespace OHOS {
bool FuzzGetBoolParameter(const uint8_t* data, size_t size)
{
bool result = false;
std::string key(reinterpret_cast<const char*>(data), size);
if (system::GetBoolParameter(key, false)) {
result = true;
}
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBoolParameter(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H
#define TEST_FUZZTEST_GET_BOOL_PARAMETER_CPP_FUZZER_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBoolParameterCpp_fuzzer"
#endif
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBootSlots_fuzzer.h"
#include <string>
#include "fs_manager/fs_manager.h"
namespace OHOS {
bool FuzzGetBootSlots(const uint8_t* data, size_t size)
{
GetBootSlots();
return true;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBootSlots(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BOOT_SLOTS_H
#define TEST_FUZZTEST_GET_BOOT_SLOTS_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBootSlots_fuzzer"
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 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
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2022 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_config>
<fuzztest>
<!-- maximum length of a test input -->
<max_len>100</max_len>
<!-- maximum total time in seconds to run the fuzzer -->
<max_total_time>30</max_total_time>
<!-- memory usage limit in Mb -->
<rss_limit_mb>2048</rss_limit_mb>
</fuzztest>
</fuzz_config>
/*
* Copyright (c) 2022 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 "GetBootloaderVersion_fuzzer.h"
#include <string>
#include "parameter.h"
namespace OHOS {
bool FuzzGetBootloaderVersion(const uint8_t* data, size_t size)
{
bool result = false;
if (GetBootloaderVersion() != nullptr) {
result = true;
};
return result;
}
}
/* Fuzzer entry point */
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
/* Run your code on data */
OHOS::FuzzGetBootloaderVersion(data, size);
return 0;
}
/*
* Copyright (c) 2022 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.
*/
#ifndef TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H
#define TEST_FUZZTEST_GET_BOOTLOADER_VERSION_H
#include "fuzz_utils.h"
#define FUZZ_PROJECT_NAME "GetBootloaderVersion_fuzzer"
#endif
\ No newline at end of file
/*
* Copyright (c) 2022 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
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册