diff --git a/hc_node/hc_enable_fuzzer/BUILD.gn b/hc_node/hc_enable_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2d69b722164fd1c23f259638a3c8d1e02cb01325 --- /dev/null +++ b/hc_node/hc_enable_fuzzer/BUILD.gn @@ -0,0 +1,43 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################FsFuzzTest########################################## +ohos_fuzztest("FsFuzzer") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/fs_fuzzer" + + include_dirs = [] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "fs_fuzzer.cpp" ] + deps = [] +# deps = [":FsFuzzer",] + + defines = [ + "ACCOUNT_LOG_TAG = \"FsFuzzTer\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +############################################################################### + +############################################################################### diff --git a/hc_node/hc_enable_fuzzer/corpus/init b/hc_node/hc_enable_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hc_enable_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hc_enable_fuzzer/fs_fuzzer.cpp b/hc_node/hc_enable_fuzzer/fs_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0bed2e339fd505c1bb24b46824dd937c75d81e9e --- /dev/null +++ b/hc_node/hc_enable_fuzzer/fs_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * 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 "fs_fuzzer.h" + +const char *dev_hc_enable = "/sys/fs/f2fs/loop1/hc_enable"; + +namespace OHOS { +bool FsFuzzer(const uint8_t *data, size_t size) +{ + char buffer[size]; + int fd = open(dev_hc_enable, RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_hc_enable); + return false; + } + int ret = read(fd, buffer, sizeof(char)); + if(ret == 0){ + printf("%s read success", dev_hc_enable); + } + ret = write(fd, data, sizeof(char)); + if(ret == 0){ + printf("%s write success", dev_hc_enable); + } + close(fd); + return true; + + +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::FsFuzzer(data, size); + return 0; +} + diff --git a/hc_node/hc_enable_fuzzer/fs_fuzzer.h b/hc_node/hc_enable_fuzzer/fs_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3e9b4aa3fc6daa7992a1ed0f2b1b78606fd9b1c4 --- /dev/null +++ b/hc_node/hc_enable_fuzzer/fs_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef FS_FUZZER_H_ +#define FS_FUZZER_H_ + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // FS_FUZZER_H_ \ No newline at end of file diff --git a/hc_node/hc_enable_fuzzer/project.xml b/hc_node/hc_enable_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..85e7ef2c1cc6471e288306f6e3dcea5287a78b0e --- /dev/null +++ b/hc_node/hc_enable_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/hc_hot_data_lower_limit_fuzzer/BUILD.gn b/hc_node/hc_hot_data_lower_limit_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9e1dc26f6e298c175022e70810da0ce17d177454 --- /dev/null +++ b/hc_node/hc_hot_data_lower_limit_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################HotDataLowerLimitFuzzer########################################## +ohos_fuzztest("HotDataLowerLimitFuzzer") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hot_data_lower_limit_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hot_data_lower_limit_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HotDataLowerLimitFuzzer" ] +} \ No newline at end of file diff --git a/hc_node/hc_hot_data_lower_limit_fuzzer/corpus/init b/hc_node/hc_hot_data_lower_limit_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hc_hot_data_lower_limit_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.cpp b/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..64d0c51ff4e71ae8446333093caf0cb30d4b962c --- /dev/null +++ b/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.cpp @@ -0,0 +1,97 @@ +/* + * 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 "hot_data_lower_limit_fuzzer.h" + +const char hcHotDataLowerLimit[] = "/sys/fs/f2fs/loop1/hc_hot_data_lower_limit"; + +namespace OHOS { + +/*static bool OpenCloseHcEnable(uint32_t data, size_t size) +{ + char buffer[size]; + int fd = open(devHcEnable, RDWR); + if (fd < 0) { + printf("open %s failed\n", devHcEnable); + return false; + } + int ret = read(fd, buffer, size); + if(ret > 0){ + printf("%s read success\n", devHcEnable); + } + if(ret < 0){ + printf("%s read fail, data = %d\n", devHcEnable, data); + return false; + } + if(ret == 0){ + printf("%s read finish\n", devHcEnable); + } + ret = write(fd, (void *)data, size); + if(ret > 0){ + printf("%s write success\n", devHcEnable); + } + if(ret < 0){ + printf("%s write fail\n", devHcEnable); + return false; + } + return true; +} +*/ +bool HcHotDataLowerLimitFuzzer(const uint8_t* data, size_t size) +{ + // uint32_t dataOpenClose = 1; + // OpenCloseHcEnable(dataOpenClose, sizeof(uint32_t)); + char buffer[size]; + int fd = open(hcHotDataLowerLimit, RDWR); + if (fd < 0) { + printf("open %s failed\n", hcHotDataLowerLimit); + return false; + } + int ret = read(fd, buffer, size); + if(ret > 0){ + printf("%s read success\n", hcHotDataLowerLimit); + } + if(ret < 0){ + printf("%s read fail, data = %s\n", hcHotDataLowerLimit, data); + return false; + } + if(ret == 0){ + printf("%s read finish\n", hcHotDataLowerLimit); + } + ret = write(fd, data, size); + if(ret == 0){ + printf("%s write success\n", hcHotDataLowerLimit); + } + close(fd); + return true; +} + +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcHotDataLowerLimitFuzzer(data, size); + return 0; +} + diff --git a/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.h b/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..565a3c53235ff33a03f3f17a0b29342565ef8eed --- /dev/null +++ b/hc_node/hc_hot_data_lower_limit_fuzzer/hot_data_lower_limit_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HOT_DATA_LOWER_LIMIT_FUZZER_H_ +#define HOT_DATA_LOWER_LIMIT_FUZZER_H_ + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HOT_DATA_LOWER_LIMIT_FUZZER_H_ \ No newline at end of file diff --git a/hc_node/hc_hot_data_lower_limit_fuzzer/project.xml b/hc_node/hc_hot_data_lower_limit_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..2409e4e3d1ff68bc21f2fd0f2e86dd0993247e50 --- /dev/null +++ b/hc_node/hc_hot_data_lower_limit_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 100 + + 4096 + + diff --git a/hc_node/hc_hot_data_waterline_fuzzer/BUILD.gn b/hc_node/hc_hot_data_waterline_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b5632c21ad095e89ddc9e5578345fb8f17e055ee --- /dev/null +++ b/hc_node/hc_hot_data_waterline_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################HotDataWaterlineFuzzer########################################## +ohos_fuzztest("HotDataWaterlineFuzzer") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hot_data_waterline_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hot_data_waterline_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HotDataWaterlineFuzzer" ] +} \ No newline at end of file diff --git a/hc_node/hc_hot_data_waterline_fuzzer/corpus/init b/hc_node/hc_hot_data_waterline_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hc_hot_data_waterline_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.cpp b/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36bb84822afc3a892c685611b3b01b90adf25962 --- /dev/null +++ b/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.cpp @@ -0,0 +1,97 @@ +/* + * 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 "hot_data_waterline_fuzzer.h" + + +const char hcHotDataWaterLine[] = "/sys/fs/f2fs/loop1/hc_hot_data_waterline"; + +namespace OHOS { + +/*static bool OpenCloseHcEnable(uint32_t data, size_t size) +{ + char buffer[size]; + int fd = open(devHcEnable, RDWR); + if (fd < 0) { + printf("open %s failed\n", devHcEnable); + return false; + } + int ret = read(fd, buffer, size); + if(ret > 0){ + printf("%s read success\n", devHcEnable); + } + if(ret < 0){ + printf("%s read fail, data = %d\n", devHcEnable, data); + return false; + } + if(ret == 0){ + printf("%s read finish\n", devHcEnable); + } + ret = write(fd, (void *)data, size); + if(ret > 0){ + printf("%s write success\n", devHcEnable); + } + if(ret < 0){ + printf("%s write fail\n", devHcEnable); + return false; + } + return true; +} +*/ +bool HcHotDataWaterLineFuzzer(const uint8_t* data, size_t size) +{ + // uint32_t dataOpenClose = 1; + // OpenCloseHcEnable(dataOpenClose, sizeof(uint32_t)); + char buffer[size]; + int fd = open(hcHotDataWaterLine, RDWR); + if (fd < 0) { + printf("open %s failed\n", hcHotDataWaterLine); + return false; + } + int ret = read(fd, buffer, size); + if(ret > 0){ + printf("%s read success\n", hcHotDataWaterLine); + } + if(ret < 0){ + printf("%s read fail, data = %s\n", hcHotDataWaterLine, data); + return false; + } + if(ret == 0){ + printf("%s read finish\n", hcHotDataWaterLine); + } + ret = write(fd, data, size); + if(ret == 0){ + printf("%s write success\n", hcHotDataWaterLine); + } + close(fd); + return true; +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcHotDataWaterLineFuzzer(data, size); + return 0; +} + diff --git a/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.h b/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..29de3c2805d120b402b685dcf18c6a8677d003b6 --- /dev/null +++ b/hc_node/hc_hot_data_waterline_fuzzer/hot_data_waterline_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HOT_DATA_WATERLINE_FUZZER_H_ +#define HOT_DATA_WATERLINE_FUZZER_H_ + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HOT_DATA_WATERLINE_FUZZER_H_ \ No newline at end of file diff --git a/hc_node/hc_hot_data_waterline_fuzzer/project.xml b/hc_node/hc_hot_data_waterline_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..2409e4e3d1ff68bc21f2fd0f2e86dd0993247e50 --- /dev/null +++ b/hc_node/hc_hot_data_waterline_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 100 + + 4096 + + diff --git a/hc_node/hchotnodelowerlimit_fuzzer/BUILD.gn b/hc_node/hchotnodelowerlimit_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ff58a17a1807e8fe3f39bea79abc6d3cca52dcc6 --- /dev/null +++ b/hc_node/hchotnodelowerlimit_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################FsFuzzTest########################################## +ohos_fuzztest("HcHotNodeLowerLimitFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hchotnodelowerlimit_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hchotnodelowerlimit_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HcHotNodeLowerLimitFuzzTest" ] +} \ No newline at end of file diff --git a/hc_node/hchotnodelowerlimit_fuzzer/corpus/init b/hc_node/hchotnodelowerlimit_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hchotnodelowerlimit_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp b/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b5d9026ff47fbb94b10f99bd0af754a09aaa5f87 --- /dev/null +++ b/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp @@ -0,0 +1,59 @@ +/* + * 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 "hchotnodelowerlimit_fuzzer.h" + +const char hc_hot_node_lower_limit[] = "/sys/fs/f2fs/loop1/hc_hot_node_lower_limit"; + +namespace OHOS { + +bool HcHotNodeLowerLimit(const uint8_t* data, size_t size) +{ + char buffer[sizeof(char)]; + int fd = open(hc_hot_node_lower_limit, RDWR); + if (fd < 0) { + printf("open %s failed\r\n", hc_hot_node_lower_limit); + return false; + } + int ret = read(fd,buffer,sizeof(char)); + if(ret == 0){ + printf("%s read success", hc_hot_node_lower_limit); + } + ret = write(fd, data, sizeof(char)); + + if(ret == 0){ + printf("%s write success", hc_hot_node_lower_limit); + } + close(fd); + return true; +} + +}// namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcHotNodeLowerLimit(data, size); + return 0; +} + diff --git a/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.h b/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..05f495672ac5e1b6f67e49fe5c505b8701cd89f8 --- /dev/null +++ b/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HCHOTNODELOWERLIMIT_FUZZER_H_ +#define HCHOTNODELOWERLIMIT_FUZZER_H_ + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HCHOTNODELOWERLIMIT_FUZZER_H_ diff --git a/hc_node/hchotnodelowerlimit_fuzzer/project.xml b/hc_node/hchotnodelowerlimit_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..85e7ef2c1cc6471e288306f6e3dcea5287a78b0e --- /dev/null +++ b/hc_node/hchotnodelowerlimit_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/hchotnodewaterline_fuzzer/BUILD.gn b/hc_node/hchotnodewaterline_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..025db286cb07a9f4f1e7678466d2f3a709d4efd3 --- /dev/null +++ b/hc_node/hchotnodewaterline_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################FsFuzzTest########################################## +ohos_fuzztest("HcHotNodeWaterLineFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hchotnodewaterline_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hchotnodewaterline_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HcHotNodeWaterLineFuzzTest" ] +} \ No newline at end of file diff --git a/hc_node/hchotnodewaterline_fuzzer/corpus/init b/hc_node/hchotnodewaterline_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hchotnodewaterline_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp b/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8dc52dd58249ac31b15bdeabee499eb776dfa70b --- /dev/null +++ b/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * 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 "hchotnodewaterline_fuzzer.h" + +const char hc_hot_node_waterline[] = "/sys/fs/f2fs/loop1/hc_hot_node_waterline"; + +namespace OHOS { +bool HcHotNodeWaterline(const uint8_t* data, size_t size) +{ + char buffer[sizeof(char)]; + int fd = open(hc_hot_node_waterline, RDWR); + if (fd < 0) { + printf("open %s failed\r\n", hc_hot_node_waterline); + return false; + } + int ret = read(fd,buffer,sizeof(char)); + if(ret == 0){ + printf("%s read success", hc_hot_node_waterline); + } + ret = write(fd, data, sizeof(char)); + + if(ret == 0){ + printf("%s write success", hc_hot_node_waterline); + } + close(fd); + return true; +} +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcHotNodeWaterline(data, size); + return 0; +} + diff --git a/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.h b/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..edca47965b167ad04de9f6097ca4118727d64cb1 --- /dev/null +++ b/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HCHOTNODEWATERLINE_FUZZER_H_ +#define HCHOTNODEWATERLINE_FUZZER_H_ + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HCHOTNODEWATERLINE_FUZZER_H_ diff --git a/hc_node/hchotnodewaterline_fuzzer/project.xml b/hc_node/hchotnodewaterline_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..85e7ef2c1cc6471e288306f6e3dcea5287a78b0e --- /dev/null +++ b/hc_node/hchotnodewaterline_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/hcwarmnodelowerlimit_fuzzer/BUILD.gn b/hc_node/hcwarmnodelowerlimit_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5b4c274da4ba982f48fd54fd4b7031275685610a --- /dev/null +++ b/hc_node/hcwarmnodelowerlimit_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################HcWarmNodeLowerLimitFuzzTest########################################## +ohos_fuzztest("HcWarmNodeLowerLimitFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hcwarmnodelowerlimit_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hcwarmnodelowerlimit_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HcWarmNodeLowerLimitFuzzTest" ] +} \ No newline at end of file diff --git a/hc_node/hcwarmnodelowerlimit_fuzzer/corpus/init b/hc_node/hcwarmnodelowerlimit_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hcwarmnodelowerlimit_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp b/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e6bcffeb84a7f19ac44c864b2ab8c32b6f0c6be1 --- /dev/null +++ b/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp @@ -0,0 +1,53 @@ +/* + * 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 "hcwarmnodelowerlimit_fuzzer.h" + +const char hc_warm_node_lower_limit[] = "/sys/fs/f2fs/loop1/hc_warm_node_lower_limit"; + +namespace OHOS { +bool HcWarmNodeLowerLimit(const uint8_t* data, size_t size) +{ + char buffer[sizeof(char)]; + int fd = open(hc_warm_node_lower_limit, RDWR); + if (fd < 0) { + printf("open %s failed", hc_warm_node_lower_limit); + return false; + } + + int ret = read(fd,buffer,sizeof(char)); + if(ret < 0) { + printf("read %s failed", hc_warm_node_lower_limit); + } + + close(fd); + return true; +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcWarmNodeLowerLimit(data, size); + return 0; +} diff --git a/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.h b/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..cde7b9e54bac154b80df872ea257c3e02c769fc8 --- /dev/null +++ b/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HC_WARM_NODE_LOWER_LIMIT_FUZZER +#define HC_WARM_NODE_LOWER_LIMIT_FUZZER + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HC_WARM_NODE_LOWER_LIMIT_FUZZER \ No newline at end of file diff --git a/hc_node/hcwarmnodelowerlimit_fuzzer/project.xml b/hc_node/hcwarmnodelowerlimit_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..85e7ef2c1cc6471e288306f6e3dcea5287a78b0e --- /dev/null +++ b/hc_node/hcwarmnodelowerlimit_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/hcwarmnodewaterline_fuzzer/BUILD.gn b/hc_node/hcwarmnodewaterline_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0fb5a97e9acb1512d521aa9d047252dd38e406be --- /dev/null +++ b/hc_node/hcwarmnodewaterline_fuzzer/BUILD.gn @@ -0,0 +1,48 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +##############################HcWarmNodeWaterLineFuzzTest########################################## +ohos_fuzztest("HcWarmNodeWaterLineFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/hcwarmnodewaterline_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "hcwarmnodewaterline_fuzzer.cpp" ] + deps = [ + "//utils/native/base:utils", + ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":HcWarmNodeWaterLineFuzzTest" ] +} \ No newline at end of file diff --git a/hc_node/hcwarmnodewaterline_fuzzer/corpus/init b/hc_node/hcwarmnodewaterline_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..59aefb51c6e5a670d20c9bda3030fcdf8db29e5a --- /dev/null +++ b/hc_node/hcwarmnodewaterline_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-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. +FUZZ \ No newline at end of file diff --git a/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.cpp b/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..faa62e87cc08c336e094e8e525e2e9335a46adac --- /dev/null +++ b/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.cpp @@ -0,0 +1,53 @@ +/* + * 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 "hcwarmnodewaterline_fuzzer.h" + +const char hc_warm_node_waterline[] = "/sys/fs/f2fs/loop1/hc_warm_node_waterline"; + +namespace OHOS { +bool HcWarmNodeLowerWaterLine(const uint8_t* data, size_t size) +{ + char buffer[sizeof(char)]; + int fd = open(hc_warm_node_waterline, RDWR); + if (fd < 0) { + printf("open %s failed", hc_warm_node_waterline); + return false; + } + + int ret = read(fd,buffer,sizeof(char)); + if(ret < 0) { + printf("read %s failed", hc_warm_node_waterline); + } + + close(fd); + return true; +} +} // namespace OHOS + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data hc_hot_data_lower_limit*/ + OHOS::HcWarmNodeLowerWaterLine(data, size); + return 0; +} diff --git a/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.h b/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..9491c27f770efa353fddb3628b0540fc32ff37d5 --- /dev/null +++ b/hc_node/hcwarmnodewaterline_fuzzer/hcwarmnodewaterline_fuzzer.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef HC_WARM_NODE_LOWER_WATERLINE_FUZZER +#define HC_WARM_NODE_LOWER_WATERLINE_FUZZER + +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // HC_WARM_NODE_LOWER_WATERLINE_FUZZER \ No newline at end of file diff --git a/hc_node/hcwarmnodewaterline_fuzzer/project.xml b/hc_node/hcwarmnodewaterline_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..85e7ef2c1cc6471e288306f6e3dcea5287a78b0e --- /dev/null +++ b/hc_node/hcwarmnodewaterline_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/warmdatalowerlimit_fuzzer/BUILD.gn b/hc_node/warmdatalowerlimit_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6def166b8a166a3c81fabf660dc3429bca6bab66 --- /dev/null +++ b/hc_node/warmdatalowerlimit_fuzzer/BUILD.gn @@ -0,0 +1,47 @@ +# 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. + +#####################hydra-fuzz################### +import("//base/notification/ans_standard/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") +module_output_path = "ans_standard/services" + +##############################fuzztest########################################## +ohos_fuzztest("WarmDataLowerLimitFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/notification/ans_standard/test/fuzztest/warmdatalowerlimit_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "warmdatalowerlimit_fuzzer.cpp" ] + + deps = [ + "//utils/native/base:utils", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":WarmDataLowerLimitFuzzTest" ] +} +############################################################################### diff --git a/hc_node/warmdatalowerlimit_fuzzer/corpus/init b/hc_node/warmdatalowerlimit_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..1b910144fb1ff33a40a44b1d2a491b1ab05b598b --- /dev/null +++ b/hc_node/warmdatalowerlimit_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# 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 diff --git a/hc_node/warmdatalowerlimit_fuzzer/project.xml b/hc_node/warmdatalowerlimit_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/hc_node/warmdatalowerlimit_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.cpp b/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c35d235f5f72080855b2cc0693b77e60c68f13ee --- /dev/null +++ b/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.cpp @@ -0,0 +1,43 @@ +/* + * 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 "warmdatalowerlimit_fuzzer.h" +const char dev_hc_enable[] = "/sys/fs/f2fs/loop1/hc_warm_data_lower_limit"; + +namespace OHOS { + bool WarmDataLowerLimitFuzzTest(const uint8_t* data, size_t size) + { + char buffer[sizeof(char)]; + int fd = open(dev_hc_enable, RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_hc_enable); + return false; + } + int ret = read(fd,buffer,sizeof(char)); + if(ret == 0){ + printf("%s read success", dev_hc_enable); + } + close(fd); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::WarmDataLowerLimitFuzzTest(data, size); + return 0; +} diff --git a/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.h b/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..203d6c714704d69e0cb76a84deabb357a74ad1dd --- /dev/null +++ b/hc_node/warmdatalowerlimit_fuzzer/warmdatalowerlimit_fuzzer.h @@ -0,0 +1,32 @@ +/* + * 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_WARMDATALOWERLIMIT_FUZZER_H +#define TEST_FUZZTEST_WARMDATALOWERLIMIT_FUZZER_H + +#include +#include +#include +#include +#include +#include +#include + +#define FUZZ_PROJECT_NAME "warmdatalowerlimit_fuzzer" +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // TEST_FUZZTEST_WARMDATALOWERLIMIT_FUZZER_H \ No newline at end of file diff --git a/hc_node/warmdatawaterline_fuzzer/BUILD.gn b/hc_node/warmdatawaterline_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..987e341120687f846d4929e55d034e10f9f2ba20 --- /dev/null +++ b/hc_node/warmdatawaterline_fuzzer/BUILD.gn @@ -0,0 +1,47 @@ +# 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. + +#####################hydra-fuzz################### +import("//base/notification/ans_standard/notification.gni") +import("//build/config/features.gni") +import("//build/test.gni") +module_output_path = "ans_standard/services" + +##############################fuzztest########################################## +ohos_fuzztest("WarmDataWaterLineFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/notification/ans_standard/test/fuzztest/warmdatawaterline_fuzzer" + + include_dirs = [ + "//utils/native/base/include", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "warmdatawaterline_fuzzer.cpp" ] + + deps = [ + "//utils/native/base:utils", + ] +} + +############################################################################### +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":WarmDataWaterLineFuzzTest" ] +} +############################################################################### diff --git a/hc_node/warmdatawaterline_fuzzer/corpus/init b/hc_node/warmdatawaterline_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..1b910144fb1ff33a40a44b1d2a491b1ab05b598b --- /dev/null +++ b/hc_node/warmdatawaterline_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# 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 diff --git a/hc_node/warmdatawaterline_fuzzer/project.xml b/hc_node/warmdatawaterline_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/hc_node/warmdatawaterline_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.cpp b/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..439605ffeefcb348f91adb3f5ef9aaef9dea40b6 --- /dev/null +++ b/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.cpp @@ -0,0 +1,43 @@ +/* + * 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 "warmdatawaterline_fuzzer.h" +const char dev_hc_enable[] = "/sys/fs/f2fs/loop1/hc_warm_data_waterline"; + +namespace OHOS { + bool WarmDataWaterLineFuzzTest(const uint8_t* data, size_t size) + { + char buffer[sizeof(char)]; + int fd = open(dev_hc_enable, RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_hc_enable); + return false; + } + int ret = read(fd,buffer,sizeof(char)); + if(ret == 0){ + printf("%s read success", dev_hc_enable); + } + close(fd); + return true; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::WarmDataWaterLineFuzzTest(data, size); + return 0; +} diff --git a/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.h b/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3346f7ed38de14f09c08145d069141f0d7d1d596 --- /dev/null +++ b/hc_node/warmdatawaterline_fuzzer/warmdatawaterline_fuzzer.h @@ -0,0 +1,32 @@ +/* + * 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_WARMDATAWATERLINE_FUZZER_H +#define TEST_FUZZTEST_WARMDATAWATERLINE_FUZZER_H + +#include +#include +#include +#include +#include +#include +#include + +#define FUZZ_PROJECT_NAME "warmdatawaterline_fuzzer" +#define RDONLY 00000000 +#define WRONLY 00000001 +#define RDWR 00000002 + +#endif // TEST_FUZZTEST_WARMDATAWATERLINE_FUZZER_H \ No newline at end of file diff --git a/ioctl/getftokenid_fuzzer/BUILD.gn b/ioctl/getftokenid_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b0c756d4320bd78b4a033c40fc2804b022f299f3 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("GetfTokenidFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/getftokenid_fuzzer" + + include_dirs = [ + "accesstokenid_getftokenid.h", + "getftokenid_fuzzer.h", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "accesstokenid_getftokenid.cpp", + "getftokenid_fuzzer.cpp", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.cpp b/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ca264b5540f737f04fc97f29381e05f10257c139 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.cpp @@ -0,0 +1,51 @@ +/* + * 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 "accesstokenid_getftokenid.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int GET_FTOKEN_ID = 3; + + +#define ACCESS_TOKENID_GET_FTOKENID \ + _IOR(ACCESS_TOKEN_ID_IOCTL_BASE, GET_FTOKEN_ID, unsigned long long) + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +int GetfTokenid(unsigned long long *ftoken) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_GET_FTOKENID, ftoken); + if (ret) { + printf("ioctl ACCESS_TOKENID_GET_FTOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.h b/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..31c357e1f9043cec3a7c90326326672806b78262 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/accesstokenid_getftokenid.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021-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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { + int GetfTokenid(unsigned long long *ftoken); +} // namespace AccessToken +} // namespace Security +} // namespace OHOS \ No newline at end of file diff --git a/ioctl/getftokenid_fuzzer/corpus/init b/ioctl/getftokenid_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.cpp b/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a4f43c7de3606f177ef863f419661788efc08b0 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * 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 "getftokenid_fuzzer.h" + +#include +#include +#include + + +#include "accesstokenid_getftokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool GetfTokenidFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + constexpr size_t SIZE_MAX_LEN = 64; + char testdata[SIZE_MAX_LEN]; + if ((data == nullptr) || (size <= 0)) { + return result; + } + + if (size >= 64) + { + size = 64; + } + + memcpy(testdata, reinterpret_cast(data), SIZE_MAX_LEN); + result = GetfTokenid((unsigned long long*)testdata); + + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::GetfTokenidFuzzTest(data, size); + return 0; +} diff --git a/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.h b/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..15a9e1d16dd202c2d3df8241c2b28c49636892b2 --- /dev/null +++ b/ioctl/getftokenid_fuzzer/getftokenid_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_GETFTOKENID_FUZZER_H +#define TEST_FUZZTEST_GETFTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "getftokenid_fuzzer" + +#endif // TEST_FUZZTEST_GETFTOKENID_FUZZER_H \ No newline at end of file diff --git a/ioctl/getftokenid_fuzzer/project.xml b/ioctl/getftokenid_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..46f9b9b551287adf97bec67c0016a4d511d2f67d --- /dev/null +++ b/ioctl/getftokenid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/BUILD.gn b/ioctl/gettokenidcmdcorrect_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..746bd0f0be5ea9a3a7198369fa7bb846ccf89298 --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("GetTokenidCmdCorrectFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/gettokenidcmdcorrect_fuzzer" + + include_dirs = [ + "accesstokenid.h", + "gettokenidcmdcorrect_fuzzer.h", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ + "accesstokenid.cpp", + "gettokenidcmdcorrect_fuzzer.cpp", + "accesstokenid.h", + "gettokenidcmdcorrect_fuzzer.h", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.cpp b/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d25b2ade275ee9b9498cbba98afc38ef77c8afcf --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.cpp @@ -0,0 +1,75 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "accesstokenid.h" +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int GET_TOKEN_ID = 1; +#define ACCESS_TOKENID_GET_TOKENID \ + _IOR(ACCESS_TOKEN_ID_IOCTL_BASE, GET_TOKEN_ID, unsigned long long) + +//constexpr unsigned long long INVAL_TOKEN = 0xffffffffffffffff; + + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +struct tokeninfo { + pid_t pid; + pid_t tid; + unsigned long long tokenid; + unsigned long long ftokenid; +}; + +int GetTokenid(unsigned long long *token) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_GET_TOKENID, token); + if (ret) { + printf("ioctl ACCESS_TOKENID_GET_TOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.h b/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..5202a7e4e63ce8135276130a27355dd036885049 --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/accesstokenid.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021-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 +#include + + + +namespace OHOS { +namespace Security { +namespace AccessToken { + int GetTokenid(unsigned long long *token); +// static int SetTokenid(unsigned long long *token); +// static int GetfTokenid(unsigned long long *ftoken); +// static int SetfTokenid(unsigned long long *ftoken); +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/corpus/init b/ioctl/gettokenidcmdcorrect_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp b/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e82871dd0fa769f52a59ebbb80c2e21dd159b97 --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * 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. + reinterpret_cast + static_cast + */ + +#include "gettokenidcmdcorrect_fuzzer.h" + +#include +#include +#include +#include +#undef private + +#include "accesstokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool GetTokenidCmdCorrectFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + if ((data == nullptr) || (size <= 0)) { + return result; + } + if (size > sizeof(unsigned long long)) { + uint8_t testdata[8] = "ohos"; + void* data_addr = (void*)testdata; + data_addr = memcpy(data_addr, data, sizeof(unsigned long long)); + unsigned long long TOKENID = reinterpret_cast(data_addr); + result = GetTokenid(&TOKENID); + } else { + unsigned long long TOKENID = reinterpret_cast(data); + result = GetTokenid(&TOKENID); + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::GetTokenidCmdCorrectFuzzTest(data, size); + return 0; +} diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.h b/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3406d6a0123157e7ce92227d35677e96d6855760 --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_GETTOKENID_FUZZER_H +#define TEST_FUZZTEST_GETTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "gettokenid_fuzzer" + +#endif // TEST_FUZZTEST_DELETETOKEN_FUZZER_H diff --git a/ioctl/gettokenidcmdcorrect_fuzzer/project.xml b/ioctl/gettokenidcmdcorrect_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/ioctl/gettokenidcmdcorrect_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/ioctl/gettokenidcmderror_fuzzer/BUILD.gn b/ioctl/gettokenidcmderror_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0413eb330f6917090949e04ac763617735c7cf50 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("GetTokenidCmdErrorFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/gettokenidcmderror_fuzzer" + + include_dirs = [ + "accesstokenid.h", + "gettokenidcmderror_fuzzer.h", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ + "accesstokenid.cpp", + "gettokenidcmderror_fuzzer.cpp", + "accesstokenid.h", + "gettokenidcmderror_fuzzer.h", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/gettokenidcmderror_fuzzer/accesstokenid.cpp b/ioctl/gettokenidcmderror_fuzzer/accesstokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c319bcdfa7a397132e991fd389e04ec093b28b1 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/accesstokenid.cpp @@ -0,0 +1,76 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "accesstokenid.h" +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int GET_TOKEN_ID = 0; +#define ACCESS_TOKENID_GET_TOKENID \ + _IOR(ACCESS_TOKEN_ID_IOCTL_BASE, GET_TOKEN_ID, unsigned long long) + +//constexpr unsigned long long INVAL_TOKEN = 0xffffffffffffffff; + + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +struct tokeninfo { + pid_t pid; + pid_t tid; + unsigned long long tokenid; + unsigned long long ftokenid; +}; + +int GetTokenid(unsigned long long *token) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_GET_TOKENID, token); + if (ret) { + printf("ioctl ACCESS_TOKENID_GET_TOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/gettokenidcmderror_fuzzer/accesstokenid.h b/ioctl/gettokenidcmderror_fuzzer/accesstokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..5202a7e4e63ce8135276130a27355dd036885049 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/accesstokenid.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021-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 +#include + + + +namespace OHOS { +namespace Security { +namespace AccessToken { + int GetTokenid(unsigned long long *token); +// static int SetTokenid(unsigned long long *token); +// static int GetfTokenid(unsigned long long *ftoken); +// static int SetfTokenid(unsigned long long *ftoken); +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/gettokenidcmderror_fuzzer/corpus/init b/ioctl/gettokenidcmderror_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp b/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..88533e18972469e4e0984af76caff55fe6ed0801 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp @@ -0,0 +1,54 @@ +/* + * 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 "gettokenidcmderror_fuzzer.h" + +#include +#include +#include +#undef private + +#include "accesstokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool GetTokenidCmdErrorFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + if ((data == nullptr) || (size <= 0)) { + return result; + } + if (size > sizeof(unsigned long long)) { + uint8_t testdata[8] = "ohos"; + void* data_addr = (void*)testdata; + data_addr = memcpy(data_addr, data, sizeof(unsigned long long)); + unsigned long long TOKENID = reinterpret_cast(data_addr); + result = GetTokenid(&TOKENID); + } else { + unsigned long long TOKENID = reinterpret_cast(data); + result = GetTokenid(&TOKENID); + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::GetTokenidCmdErrorFuzzTest(data, size); + return 0; +} diff --git a/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.h b/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3406d6a0123157e7ce92227d35677e96d6855760 --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_GETTOKENID_FUZZER_H +#define TEST_FUZZTEST_GETTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "gettokenid_fuzzer" + +#endif // TEST_FUZZTEST_DELETETOKEN_FUZZER_H diff --git a/ioctl/gettokenidcmderror_fuzzer/project.xml b/ioctl/gettokenidcmderror_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/ioctl/gettokenidcmderror_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/ioctl/setftokenid_fuzzer/BUILD.gn b/ioctl/setftokenid_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6565aa344be0f5dd4ea7f9209fcef395f4c48a80 --- /dev/null +++ b/ioctl/setftokenid_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("SetfTokenidFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/setftokenid_fuzzer" + + include_dirs = [ + "accesstokenid_setftokenid.h", + "setftokenid_fuzzer.h", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "accesstokenid_setftokenid.cpp", + "setftokenid_fuzzer.cpp", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.cpp b/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..692a3da4a0bc9b91630c97bfa8df136c630a8cf7 --- /dev/null +++ b/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.cpp @@ -0,0 +1,50 @@ +/* + * 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 "accesstokenid_setftokenid.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int SET_FTOKEN_ID = 4; + +#define ACCESS_TOKENID_SET_FTOKENID \ + _IOW(ACCESS_TOKEN_ID_IOCTL_BASE, SET_FTOKEN_ID, unsigned long long) + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +int SetfTokenid(unsigned long long *ftoken) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_SET_FTOKENID, ftoken); + if (ret) { + printf("ioctl ACCESS_TOKENID_SET_FTOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.h b/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..8c144266e82d76847bc08d34ddc154d03597c7ce --- /dev/null +++ b/ioctl/setftokenid_fuzzer/accesstokenid_setftokenid.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2021-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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { + int SetfTokenid(unsigned long long *ftoken); +} // namespace AccessToken +} // namespace Security +} // namespace OHOS \ No newline at end of file diff --git a/ioctl/setftokenid_fuzzer/corpus/init b/ioctl/setftokenid_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/setftokenid_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/setftokenid_fuzzer/project.xml b/ioctl/setftokenid_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..46f9b9b551287adf97bec67c0016a4d511d2f67d --- /dev/null +++ b/ioctl/setftokenid_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.cpp b/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2e7843abe6cf8af65e8507f65c1be2664f62bf8 --- /dev/null +++ b/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.cpp @@ -0,0 +1,55 @@ +/* + * 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 "setftokenid_fuzzer.h" + +#include +#include +#include +#undef private + +#include "accesstokenid_setftokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool SetfTokenidFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + constexpr size_t SIZE_MAX_LEN = 64; + char testdata[SIZE_MAX_LEN]; + if ((data == nullptr) || (size <= 0)) { + return result; + } + + if (size >= 64) + { + size = 64; + } + + memcpy(testdata, reinterpret_cast(data), SIZE_MAX_LEN); + result = SetfTokenid((unsigned long long*)testdata); + + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::SetfTokenidFuzzTest(data, size); + return 0; +} diff --git a/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.h b/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..91945ca4e1e6ce61ae5dfa07cf991d1ac4b54f87 --- /dev/null +++ b/ioctl/setftokenid_fuzzer/setftokenid_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_SETFTOKENID_FUZZER_H +#define TEST_FUZZTEST_SETFTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "setftokenid_fuzzer" + +#endif // TEST_FUZZTEST_SETFTOKENID_FUZZER_H \ No newline at end of file diff --git a/ioctl/settokenidcmdcorrect_fuzzer/BUILD.gn b/ioctl/settokenidcmdcorrect_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8db03b07452c2ac2691f6358b6cea04b84aefb3c --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("SetTokenidCmdCorrectFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/settokenidcmdcorrect_fuzzer" + + include_dirs = [ + "accesstokenid.h", + "settokenidcmdcorrect_fuzzer.h", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ + "accesstokenid.cpp", + "settokenidcmdcorrect_fuzzer.cpp", + "accesstokenid.h", + "settokenidcmdcorrect_fuzzer.h", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.cpp b/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..634046accb1d799f74ac99d170d03ea2fa34535f --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.cpp @@ -0,0 +1,75 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "accesstokenid.h" +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int SET_TOKEN_ID = 2; +#define ACCESS_TOKENID_SET_TOKENID \ + _IOW(ACCESS_TOKEN_ID_IOCTL_BASE, SET_TOKEN_ID, unsigned long long) +//constexpr unsigned long long INVAL_TOKEN = 0xffffffffffffffff; + + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +struct tokeninfo { + pid_t pid; + pid_t tid; + unsigned long long tokenid; + unsigned long long ftokenid; +}; + +int SetTokenid(unsigned long long *token) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_SET_TOKENID, token); + if (ret) { + printf("ioctl ACCESS_TOKENID_SET_TOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.h b/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..cff1d016f1c7cc11a81815afe0ce8ed3b75add27 --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/accesstokenid.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021-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 +#include + + + +namespace OHOS { +namespace Security { +namespace AccessToken { + + int SetTokenid(unsigned long long *token); + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/settokenidcmdcorrect_fuzzer/corpus/init b/ioctl/settokenidcmdcorrect_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/settokenidcmdcorrect_fuzzer/project.xml b/ioctl/settokenidcmdcorrect_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp b/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3f27465339aefdf85aa568863f183f3febcf151d --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp @@ -0,0 +1,57 @@ +/* + * 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. + reinterpret_cast + static_cast + */ + +#include "settokenidcmdcorrect_fuzzer.h" + +#include +#include +#include +#include +#undef private + +#include "accesstokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool SetTokenidCmdCorrectFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + if ((data == nullptr) || (size <= 0)) { + return result; + } + if (size > sizeof(unsigned long long)) { + uint8_t testdata[8] = "ohos"; + void* data_addr = (void*)testdata; + data_addr = memcpy(data_addr, data, sizeof(unsigned long long)); + unsigned long long TOKENID = reinterpret_cast(data_addr); + result = SetTokenid(&TOKENID); + } else { + unsigned long long TOKENID = reinterpret_cast(data); + result = SetTokenid(&TOKENID); + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::SetTokenidCmdCorrectFuzzTest(data, size); + return 0; +} diff --git a/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.h b/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3406d6a0123157e7ce92227d35677e96d6855760 --- /dev/null +++ b/ioctl/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_GETTOKENID_FUZZER_H +#define TEST_FUZZTEST_GETTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "gettokenid_fuzzer" + +#endif // TEST_FUZZTEST_DELETETOKEN_FUZZER_H diff --git a/ioctl/settokenidcmderror_fuzzer/BUILD.gn b/ioctl/settokenidcmderror_fuzzer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..27e5bbbb50c3483e7e35d1a52df72cf77bd4dcb7 --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/BUILD.gn @@ -0,0 +1,51 @@ +# 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "access_token/access_token" + +ohos_fuzztest("SetTokenidCmdErrorFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//base/security/access_token/test/fuzztest/access_token/settokenidcmderror_fuzzer" + + include_dirs = [ + "accesstokenid.h", + "settokenidcmderror_fuzzer.h", + ] + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ + "accesstokenid.cpp", + "settokenidcmderror_fuzzer.cpp", + "accesstokenid.h", + "settokenidcmderror_fuzzer.h", + ] + + deps = [ + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] + + defines = [ + "ACCOUNT_LOG_TAG = \"AccessTokenFuzzTest\"", + "LOG_DOMAIN = 0xD001B00", + ] +} diff --git a/ioctl/settokenidcmderror_fuzzer/accesstokenid.cpp b/ioctl/settokenidcmderror_fuzzer/accesstokenid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..21af3f8fa3201059cbb91f480c5cd0159da47f0b --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/accesstokenid.cpp @@ -0,0 +1,75 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "accesstokenid.h" +#include +#include + +namespace OHOS { +namespace Security { +namespace AccessToken { +constexpr unsigned char ACCESS_TOKEN_ID_IOCTL_BASE = 'A'; +constexpr unsigned int SET_TOKEN_ID = 0; +#define ACCESS_TOKENID_SET_TOKENID \ + _IOW(ACCESS_TOKEN_ID_IOCTL_BASE, SET_TOKEN_ID, unsigned long long) +//constexpr unsigned long long INVAL_TOKEN = 0xffffffffffffffff; + + +const char dev_accesstokenid[] = "/dev/access_token_id"; + +struct tokeninfo { + pid_t pid; + pid_t tid; + unsigned long long tokenid; + unsigned long long ftokenid; +}; + +int SetTokenid(unsigned long long *token) +{ + int fd = open(dev_accesstokenid, O_RDWR); + if (fd < 0) { + printf("open %s failed\r\n", dev_accesstokenid); + return -1; + } + + int ret = ioctl(fd, ACCESS_TOKENID_SET_TOKENID, token); + if (ret) { + printf("ioctl ACCESS_TOKENID_SET_TOKENID failed\r\n"); + close(fd); + return -1; + } + + close(fd); + return 0; +} + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/settokenidcmderror_fuzzer/accesstokenid.h b/ioctl/settokenidcmderror_fuzzer/accesstokenid.h new file mode 100644 index 0000000000000000000000000000000000000000..cff1d016f1c7cc11a81815afe0ce8ed3b75add27 --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/accesstokenid.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021-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 +#include + + + +namespace OHOS { +namespace Security { +namespace AccessToken { + + int SetTokenid(unsigned long long *token); + +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/ioctl/settokenidcmderror_fuzzer/corpus/init b/ioctl/settokenidcmderror_fuzzer/corpus/init new file mode 100644 index 0000000000000000000000000000000000000000..bc977bd9738ee9a70b362067f57a9c63d3adb801 --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/corpus/init @@ -0,0 +1,14 @@ +# 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 diff --git a/ioctl/settokenidcmderror_fuzzer/project.xml b/ioctl/settokenidcmderror_fuzzer/project.xml new file mode 100644 index 0000000000000000000000000000000000000000..6e8ad2cfde8f8bda4beb6cabbe7efd8bc3c54eec --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.cpp b/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f8d47dc767557c288229de6e57233eea11287c0 --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.cpp @@ -0,0 +1,54 @@ +/* + * 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 "settokenidcmderror_fuzzer.h" + +#include +#include +#include +#undef private + +#include "accesstokenid.h" + +using namespace std; +using namespace OHOS::Security::AccessToken; +namespace OHOS { + bool SetTokenidCmdErrorFuzzTest(const uint8_t* data, size_t size) + { + bool result = false; + if ((data == nullptr) || (size <= 0)) { + return result; + } + if (size > sizeof(unsigned long long)) { + uint8_t testdata[8] = "ohos"; + void* data_addr = (void*)testdata; + data_addr = memcpy(data_addr, data, sizeof(unsigned long long)); + unsigned long long TOKENID = reinterpret_cast(data_addr); + result = SetTokenid(&TOKENID); + } else { + unsigned long long TOKENID = reinterpret_cast(data); + result = SetTokenid(&TOKENID); + } + return result; + } +} + +/* Fuzzer entry point */ +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) +{ + /* Run your code on data */ + OHOS::SetTokenidCmdErrorFuzzTest(data, size); + return 0; +} diff --git a/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.h b/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.h new file mode 100644 index 0000000000000000000000000000000000000000..3406d6a0123157e7ce92227d35677e96d6855760 --- /dev/null +++ b/ioctl/settokenidcmderror_fuzzer/settokenidcmderror_fuzzer.h @@ -0,0 +1,6 @@ +#ifndef TEST_FUZZTEST_GETTOKENID_FUZZER_H +#define TEST_FUZZTEST_GETTOKENID_FUZZER_H + +#define FUZZ_PROJECT_NAME "gettokenid_fuzzer" + +#endif // TEST_FUZZTEST_DELETETOKEN_FUZZER_H