diff --git a/testsuites/BUILD.gn b/testsuites/BUILD.gn index c09cb41cb9ba3546c4507ab83309511366282e75..d6e02339c10352cecea8c53b1c5eee6cdb3635cc 100644 --- a/testsuites/BUILD.gn +++ b/testsuites/BUILD.gn @@ -37,5 +37,6 @@ group("testsuites") { deps = [] if (liteos_kernel_unittest) { deps += [ "unittest" ] + #deps += [ "//kernel/liteos_a/testsuites/fuzz:fuzztest" ] } } diff --git a/testsuites/fuzz/BUILD.gn b/testsuites/fuzz/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..da2b4b9730befce052d419dbef1d1127bc0ac052 --- /dev/null +++ b/testsuites/fuzz/BUILD.gn @@ -0,0 +1,86 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//build/lite/config/test.gni") + +fuzztest("FuzzDemoTest") { + output_extension = "bin" + sources = [ + "adjtime_fuzzer.cpp", + "clone_fuzzer.cpp", + "epoll_create_fuzzer.cpp", + "epoll_ctl_fuzzer.cpp", + "epoll_wait_fuzzer.cpp", + "fesetenv_fuzzer.cpp", + "getrlimit_fuzzer.cpp", + "main.cpp", + "mlock_fuzzer.cpp", + "mlockall_fuzzer.cpp", + "posix_spawn_file_actions_addchdir_np_fuzzer.cpp", + "posix_spawn_file_actions_adddup2_fuzzer.cpp", + "posix_spawn_file_actions_addfchdir_np_fuzzer.cpp", + "posix_spawn_file_actions_addopen_fuzzer.cpp", + "posix_spawn_file_actions_destroy_fuzzer.cpp", + "posix_spawn_file_actions_init_fuzzer.cpp", + "posix_spawn_fuzzer.cpp", + "posix_spawnattr_destroy_fuzzer.cpp", + "posix_spawnattr_getflags_fuzzer.cpp", + "posix_spawnattr_getpgroup_fuzzer.cpp", + "posix_spawnattr_getschedparam_fuzzer.cpp", + "posix_spawnattr_getschedpolicy_fuzzer.cpp", + "posix_spawnattr_getsigdefault_fuzzer.cpp", + "posix_spawnattr_getsigmask_fuzzer.cpp", + "posix_spawnattr_init_fuzzer.cpp", + "posix_spawnattr_setflags_fuzzer.cpp", + "posix_spawnattr_setpgroup_fuzzer.cpp", + "posix_spawnattr_setschedparam_fuzzer.cpp", + "posix_spawnattr_setschedpolicy_fuzzer.cpp", + "posix_spawnattr_setsigdefault_fuzzer.cpp", + "posix_spawnattr_setsigmask_fuzzer.cpp", + "posix_spawnp_fuzzer.cpp", + "pthread_mutex_consistent_fuzzer.cpp", + "pthread_mutex_getprioceiling_fuzzer.cpp", + "pthread_mutexattr_setprotocol_fuzzer.cpp", + "pthread_mutexattr_setrobust_fuzzer.cpp", + "pthread_mutexattr_settype_fuzzer.cpp", + "pthread_setconcurrency_fuzzer.cpp", + "readlink_fuzzer.cpp", + "readlinkat_fuzzer.cpp", + "sem_open_fuzzer.cpp", + "setns_fuzzer.cpp", + "syslog_fuzzer.cpp", + "system_fuzzer.cpp", + "times_fuzzer.cpp", + "unshare_fuzzer.cpp", + ] + include_dirs = [] + deps = [] +} +group("fuzztest") { + deps = [ ":FuzzDemoTest" ] +} diff --git a/testsuites/fuzz/adjtime_fuzzer.cpp b/testsuites/fuzz/adjtime_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e98899ede5ee0cfd0c9de9033301a2ce37cb84b8 --- /dev/null +++ b/testsuites/fuzz/adjtime_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_adjtime(void) +{ + struct timeval fa; + printf("start----adjtime\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_adjtime"), 0) + { + char *delta = DT_SetGetFixBlob(&g_Element[0], sizeof(struct timeval), sizeof(struct timeval), (char *)&fa); + char *olddelta = DT_SetGetFixBlob(&g_Element[1], sizeof(struct timeval), sizeof(struct timeval), (char *)&fa); + adjtime((struct timeval *)delta, (struct timeval *)olddelta); + } + DT_FUZZ_END() + printf("end----adjtime\n"); +} diff --git a/testsuites/fuzz/clone_fuzzer.cpp b/testsuites/fuzz/clone_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..86e3e6bc6e40e6312697819f9c66816c9ac578ec --- /dev/null +++ b/testsuites/fuzz/clone_fuzzer.cpp @@ -0,0 +1,61 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include +#include +#include + +static int STACK_SIZE = 1024 * 1024; + +static int childFunc(void *) +{ + return 0; +} + +void test_clone(void) +{ + printf("start----test_clone\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_clone"), 0) + { + char *stack; + char *stackTop; + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + stack = (char *)mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); + stackTop = stack + STACK_SIZE; + pid_t pid = clone(childFunc, stackTop, number, NULL); + waitpid(pid, NULL, WUNTRACED); + } + DT_FUZZ_END() + printf("end----test_clone\n"); +} diff --git a/testsuites/fuzz/epoll_create_fuzzer.cpp b/testsuites/fuzz/epoll_create_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ed152d100b4e22d527af8fb83deae6b92331e5af --- /dev/null +++ b/testsuites/fuzz/epoll_create_fuzzer.cpp @@ -0,0 +1,42 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_epoll_create(void) +{ + printf("start----test_epoll_create\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_epoll_create"), 0) + { + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + epoll_create(number); + } + DT_FUZZ_END() + printf("end----test_epoll_create\n"); +} diff --git a/testsuites/fuzz/epoll_ctl_fuzzer.cpp b/testsuites/fuzz/epoll_ctl_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..17e2092941aa4d0688173d40b0294a844c501f63 --- /dev/null +++ b/testsuites/fuzz/epoll_ctl_fuzzer.cpp @@ -0,0 +1,48 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_epoll_ctl(void) +{ + struct epoll_event fa; + printf("start----test_epoll_ctl\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_epoll_ctl"), 0) + { + s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + s32 number2 = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + char *datainput = DT_SetGetFixBlob(&g_Element[3], sizeof(struct epoll_event), sizeof(struct epoll_event), + (char *)&fa); + epoll_ctl(number0, number1, number2, (struct epoll_event *)datainput); + } + DT_FUZZ_END() + printf("end----test_epoll_ctl\n"); +} diff --git a/testsuites/fuzz/epoll_wait_fuzzer.cpp b/testsuites/fuzz/epoll_wait_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1633f776e6549a72695e43b25db27bc6a1ca0294 --- /dev/null +++ b/testsuites/fuzz/epoll_wait_fuzzer.cpp @@ -0,0 +1,48 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_epoll_wait(void) +{ + struct epoll_event fa; + printf("start----test_epoll_wait\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_epoll_wait"), 0) + { + s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + s32 number2 = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + char *datainput = DT_SetGetFixBlob(&g_Element[3], sizeof(struct epoll_event), sizeof(struct epoll_event), + (char *)&fa); + epoll_wait(number0, (struct epoll_event *)datainput, number1, number2); + } + DT_FUZZ_END() + printf("end----test_epoll_wait\n"); +} diff --git a/testsuites/fuzz/fesetenv_fuzzer.cpp b/testsuites/fuzz/fesetenv_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..462714eed9bc766945b698d149178577b306705d --- /dev/null +++ b/testsuites/fuzz/fesetenv_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_fesetenv(void) +{ + fenv_t fa; + printf("start----fesetenv\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_fesetenv"), 0) + { + char *envp = DT_SetGetFixBlob(&g_Element[0], sizeof(fenv_t), sizeof(fenv_t), (char *)&fa); + fesetenv((fenv_t *)envp); + } + DT_FUZZ_END() + printf("end----fesetenv\n"); +} diff --git a/testsuites/fuzz/getrlimit_fuzzer.cpp b/testsuites/fuzz/getrlimit_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a270a8880f0e2c8c2caf18d32b48df08678a5655 --- /dev/null +++ b/testsuites/fuzz/getrlimit_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_getrlimit(void) +{ + struct rlimit fa; + printf("start----getrlimit\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_getrlimit"), 0) + { + s32 resource = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + char *datainput = DT_SetGetFixBlob(&g_Element[1], sizeof(struct rlimit), sizeof(struct rlimit), (char *)&fa); + getrlimit(resource, (struct rlimit *)datainput); + } + DT_FUZZ_END() + printf("end----getrlimit\n"); +} diff --git a/testsuites/fuzz/main.cpp b/testsuites/fuzz/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7caa3e36a38a7ba42d8d964c825cf327183da687 --- /dev/null +++ b/testsuites/fuzz/main.cpp @@ -0,0 +1,127 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +extern void test_posix_spawn_file_actions_addchdir_np(void); +extern void test_posix_spawn_file_actions_adddup2(void); +extern void test_posix_spawn_file_actions_addfchdir_np(void); +extern void test_posix_spawn_file_actions_addopen(void); +extern void test_posix_spawn_file_actions_destroy(void); +extern void test_posix_spawn_file_actions_init(void); +extern void test_posix_spawn(void); +extern void test_posix_spawnattr_destroy(void); +extern void test_posix_spawnattr_getflags(void); +extern void test_posix_spawnattr_getpgroup(void); +extern void test_posix_spawnattr_getschedparam(void); +extern void test_posix_spawnattr_getschedpolicy(void); +extern void test_posix_spawnattr_getsigdefault(void); +extern void test_posix_spawnattr_getsigmask(void); +extern void test_posix_spawnattr_init(void); +extern void test_posix_spawnattr_setflags(void); +extern void test_posix_spawnattr_setpgroup(void); +extern void test_posix_spawnattr_setschedparam(void); +extern void test_posix_spawnattr_setschedpolicy(void); +extern void test_posix_spawnattr_setsigdefault(void); +extern void test_posix_spawnattr_setsigmask(void); +extern void test_posix_spawnp(void); +extern void test_adjtime(void); +extern void test_fesetenv(void); +extern void test_getrlimit(void); +extern void test_readlink(void); +extern void test_readlinkatat(void); +extern void test_syslog(void); +extern void test_system(void); +extern void test_times(void); +extern void test_clone(void); +extern void test_epoll_create(void); +extern void test_epoll_ctl(void); +extern void test_epoll_wait(void); +extern void test_mlock(void); +extern void test_mlockall(void); +extern void test_pthread_mutex_consistent(void); +extern void test_pthread_mutex_getprioceiling(void); +extern void test_pthread_mutexattr_setprotocol(void); +extern void test_pthread_mutexattr_setrobust(void); +extern void test_pthread_mutexattr_settype(void); +extern void test_pthread_setconcurrency(void); +extern void test_setns(void); +extern void test_unshare(void); +extern void test_sem_open(void); + +int main() +{ + DT_Set_Report_Path("/storage/"); + test_posix_spawn_file_actions_addchdir_np(); + test_posix_spawn_file_actions_addopen(); + test_posix_spawn_file_actions_adddup2(); + test_posix_spawn_file_actions_addfchdir_np(); + test_posix_spawn_file_actions_destroy(); + test_posix_spawn_file_actions_init(); + test_posix_spawnattr_destroy(); + test_posix_spawnattr_getflags(); + test_posix_spawnattr_getpgroup(); + test_posix_spawnattr_getschedparam(); + test_posix_spawnattr_getschedpolicy(); + test_posix_spawnattr_getsigdefault(); + test_posix_spawnattr_getsigmask(); + test_posix_spawnattr_init(); + test_posix_spawnattr_setflags(); + test_posix_spawnattr_setpgroup(); + test_posix_spawnattr_setschedparam(); + test_posix_spawnattr_setschedpolicy(); + test_posix_spawnattr_setsigdefault(); + test_posix_spawnattr_setsigmask(); + test_posix_spawn(); + test_posix_spawnp(); + test_syslog(); + test_system(); + test_mlock(); + test_mlockall(); + test_adjtime(); + test_fesetenv(); + test_getrlimit(); + test_readlink(); + test_readlinkatat(); + test_times(); + test_clone(); + test_epoll_create(); + test_epoll_ctl(); + test_epoll_wait(); + test_pthread_mutex_consistent(); + test_pthread_mutex_getprioceiling(); + test_pthread_mutexattr_setprotocol(); + test_pthread_mutexattr_setrobust(); + test_pthread_mutexattr_settype(); + test_pthread_setconcurrency(); + test_setns(); + test_sem_open(); + test_unshare(); + + return 0; +} diff --git a/testsuites/fuzz/mlock_fuzzer.cpp b/testsuites/fuzz/mlock_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2057e3235234e73e3b48f4de3fa616b1790bd2ef --- /dev/null +++ b/testsuites/fuzz/mlock_fuzzer.cpp @@ -0,0 +1,44 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_mlock(void) +{ + int lockSize = 4096 + 1; + printf("start----test_mlock\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_mlock"), 0) + { + char *p = DT_SetGetString(&g_Element[0], 6, 10000, "123456"); + mlock(p, lockSize); + munlock(p, lockSize); + } + DT_FUZZ_END() + printf("end----test_mlock\n"); +} diff --git a/testsuites/fuzz/mlockall_fuzzer.cpp b/testsuites/fuzz/mlockall_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..990bb2b0ae96966762cc39f58293d57e83051aff --- /dev/null +++ b/testsuites/fuzz/mlockall_fuzzer.cpp @@ -0,0 +1,42 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_mlockall(void) +{ + printf("start----test_mlockall\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_mlockall"), 0) + { + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + mlockall(number); + } + DT_FUZZ_END() + printf("end----test_mlockall\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_addchdir_np_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_addchdir_np_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afde72a1e5426cf0be8e229f8b39244ecc1b58dc --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_addchdir_np_fuzzer.cpp @@ -0,0 +1,52 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawn_file_actions_addchdir_np(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_addchdir_np\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_addchdir_np"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + char *path = DT_SetGetString(&g_Element[19], 6, 10000, "123456"); + posix_spawn_file_actions_addchdir_np(&fa, path); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_addchdir_np\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_adddup2_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_adddup2_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6d88b32731d531b47c7c5f6f4c1ca2002b0e8a76 --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_adddup2_fuzzer.cpp @@ -0,0 +1,53 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include "gtest/gtest.h" + +void test_posix_spawn_file_actions_adddup2(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_adddup2\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_adddup2"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], 0x123456); + posix_spawn_file_actions_adddup2(&fa, STDOUT_FILENO, tmpfd); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_adddup2\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_addfchdir_np_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_addfchdir_np_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..20a7ed35deea38b96dd8bee0ce522e232bf388e1 --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_addfchdir_np_fuzzer.cpp @@ -0,0 +1,52 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawn_file_actions_addfchdir_np(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_addfchdir_np\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_addfchdir_np"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], 0x123456); + posix_spawn_file_actions_addfchdir_np(&fa, tmpfd); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_addfchdir_np\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_addopen_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_addopen_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26e90b5787fc458d67d27d64d993327c9de2f0fe --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_addopen_fuzzer.cpp @@ -0,0 +1,55 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawn_file_actions_addopen(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_addopen\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_addopen"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], 0x123456); + char *path = DT_SetGetBlob(&g_Element[20], 6, 10000, "123456"); + s32 flag = *(s32 *)DT_SetGetS32(&g_Element[21], 0x123456); + posix_spawn_file_actions_addopen(&fa, tmpfd, path, flag, 0); + posix_spawn_file_actions_addclose(&fa, tmpfd); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_addopen\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_destroy_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_destroy_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6d0be08219ba4dfb2a5b0a4d0040a80bb2555af9 --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_destroy_fuzzer.cpp @@ -0,0 +1,52 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawn_file_actions_destroy(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_destroy\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_destroy"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + posix_spawn_file_actions_init(&fa); + posix_spawn_file_actions_destroy(&fa); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_destroy\n"); +} diff --git a/testsuites/fuzz/posix_spawn_file_actions_init_fuzzer.cpp b/testsuites/fuzz/posix_spawn_file_actions_init_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60fdb294b9e78798057659fb73ccb4b884dcc791 --- /dev/null +++ b/testsuites/fuzz/posix_spawn_file_actions_init_fuzzer.cpp @@ -0,0 +1,51 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawn_file_actions_init(void) +{ + posix_spawn_file_actions_t fa; + printf("start ---- test_posix_spawn_file_actions_init\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn_file_actions_init"), 0) + { + fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], 0x123456); + for (int i = 0; i < 16; i++) { + fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], 0x123456); + } + char *action = DT_SetGetBlob(&g_Element[18], 6, 10000, "123456"); + fa.__actions=(void *)action; + posix_spawn_file_actions_init(&fa); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn_file_actions_init\n"); +} diff --git a/testsuites/fuzz/posix_spawn_fuzzer.cpp b/testsuites/fuzz/posix_spawn_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc01cd0605774a76489134f65319593382416c0d --- /dev/null +++ b/testsuites/fuzz/posix_spawn_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_posix_spawn(void) +{ + printf("start ---- test_posix_spawn\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawn"), 0) + { + s32 pid = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + char *argv[] = {"tftp", nullptr}; + posix_spawn(&pid, "/bin/tftp", nullptr, nullptr, argv, nullptr); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawn\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_destroy_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_destroy_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b185b2bd48294e8acbe486bdf5ac2c4bdc4c78f2 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_destroy_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_destroy(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_destroy\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_destroy"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + posix_spawnattr_destroy((posix_spawnattr_t *)datainput); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_destroy\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getflags_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getflags_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..46fa151cf52945f596327a17d4cf8bb06d5e32c9 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getflags_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_getflags(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_getflags\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getflags"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s16 flag = *(s16 *)DT_SetGetS16(&g_Element[1], 0x123456); + posix_spawnattr_getflags((posix_spawnattr_t *)datainput, &flag); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getflags\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getpgroup_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getpgroup_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aef563c2ce34518efe450af3327818d4977ec1ca --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getpgroup_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_getpgroup(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_getpgroup\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getpgroup"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s32 pgrp = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + posix_spawnattr_getpgroup((posix_spawnattr_t *)datainput, &pgrp); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getpgroup\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getschedparam_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getschedparam_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ba30bfc523387615facecf96fb626e2c427c975 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getschedparam_fuzzer.cpp @@ -0,0 +1,49 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +void test_posix_spawnattr_getschedparam(void) +{ + posix_spawnattr_t attr; + struct sched_param schedparam; + printf("start ---- test_posix_spawnattr_getschedparam\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getschedparam"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(struct sched_param), sizeof(struct sched_param), + (char *)&schedparam); + posix_spawnattr_getschedparam((posix_spawnattr_t *)datainput, (struct sched_param *)datainput); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getschedparam\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getschedpolicy_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getschedpolicy_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2452a8f5313fc5a9a59cc05e19fe52cc25eb2f95 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getschedpolicy_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_getschedpolicy(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_getschedpolicy\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getschedpolicy"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s32 policy = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + posix_spawnattr_getschedpolicy((posix_spawnattr_t *)datainput, &policy); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getschedpolicy\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getsigdefault_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getsigdefault_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bdd4298a6c30520960101f8c85a050cb60ed7b18 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getsigdefault_fuzzer.cpp @@ -0,0 +1,47 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_getsigdefault(void) +{ + posix_spawnattr_t attr; + sigset_t signalset; + printf("start ---- test_posix_spawnattr_getsigdefault\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getsigdefault"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(signalset), sizeof(signalset), (char *)&signalset); + posix_spawnattr_getsigdefault((posix_spawnattr_t *)datainput, (sigset_t *)datainput1); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getsigdefault\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_getsigmask_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_getsigmask_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d53b31905691282866e1383abebdb821c70b3aea --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_getsigmask_fuzzer.cpp @@ -0,0 +1,47 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_getsigmask(void) +{ + posix_spawnattr_t attr; + sigset_t signalset; + printf("start ---- test_posix_spawnattr_getsigmask\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_getsigmask"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(sigset_t), sizeof(sigset_t), (char *)&signalset); + posix_spawnattr_getsigmask((posix_spawnattr_t *)datainput, (sigset_t *)datainput1); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_getsigmask\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_init_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_init_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7ac37368691f92a468bf545a6e961c770cfa28ae --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_init_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_init(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_init\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_init"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + posix_spawnattr_init((posix_spawnattr_t *)datainput); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_init\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_setflags_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setflags_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a93f76fa90616408424239aa6b5bb845c3a67d44 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setflags_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_setflags(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_setflags\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setflags"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s16 flags = *(s16 *)DT_SetGetS16(&g_Element[1], 0x123456); + posix_spawnattr_setflags((posix_spawnattr_t *)datainput, flags); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setflags\n"); +} \ No newline at end of file diff --git a/testsuites/fuzz/posix_spawnattr_setpgroup_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setpgroup_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1e35ffa068abf7b3bc13ee91391cd8ac24a6d2f3 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setpgroup_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_setpgroup(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_setpgroup\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setpgroup"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s32 pgrp = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + posix_spawnattr_setpgroup((posix_spawnattr_t *)datainput, pgrp); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setpgroup\n"); +} \ No newline at end of file diff --git a/testsuites/fuzz/posix_spawnattr_setschedparam_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setschedparam_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2458f300aee4e2a62a3dd99e76ffabfa1b9e4ec --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setschedparam_fuzzer.cpp @@ -0,0 +1,49 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +void test_posix_spawnattr_setschedparam(void) +{ + posix_spawnattr_t attr; + struct sched_param schedparam; + printf("start ---- test_posix_spawnattr_setschedparam\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setschedparam"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(struct sched_param), sizeof(struct sched_param), + (char *)&schedparam); + posix_spawnattr_setschedparam((posix_spawnattr_t *)datainput, (struct sched_param *)datainput1); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setschedparam\n"); +} \ No newline at end of file diff --git a/testsuites/fuzz/posix_spawnattr_setschedpolicy_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setschedpolicy_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f60291e7e4a4c8b9b51ad6d0811697717219193 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setschedpolicy_fuzzer.cpp @@ -0,0 +1,47 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +void test_posix_spawnattr_setschedpolicy(void) +{ + posix_spawnattr_t attr; + printf("start ---- test_posix_spawnattr_setschedpolicy\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setschedpolicy"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + s32 policy = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + posix_spawnattr_setschedpolicy((posix_spawnattr_t *)datainput, policy); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setschedpolicy\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_setsigdefault_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setsigdefault_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a5a6b1614c730e5d2a2900cf79d6b088a309c964 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setsigdefault_fuzzer.cpp @@ -0,0 +1,47 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_setsigdefault(void) +{ + posix_spawnattr_t attr; + sigset_t sigdefault; + printf("start ---- test_posix_spawnattr_setsigdefault\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setsigdefault"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(sigset_t), sizeof(sigset_t), (char *)&sigdefault); + posix_spawnattr_setsigdefault((posix_spawnattr_t *)datainput, (sigset_t *)datainput1); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setsigdefault\n"); +} diff --git a/testsuites/fuzz/posix_spawnattr_setsigmask_fuzzer.cpp b/testsuites/fuzz/posix_spawnattr_setsigmask_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a46b6e41f459fdef4a83e432b7de981269468068 --- /dev/null +++ b/testsuites/fuzz/posix_spawnattr_setsigmask_fuzzer.cpp @@ -0,0 +1,47 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_posix_spawnattr_setsigmask(void) +{ + posix_spawnattr_t attr; + sigset_t signalset; + printf("start ---- test_posix_spawnattr_setsigmask\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnattr_setsigmask"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(posix_spawnattr_t), sizeof(posix_spawnattr_t), + (char *)&attr); + char *datainput1 = DT_SetGetFixBlob(&g_Element[1], sizeof(sigset_t), sizeof(sigset_t), (char *)&signalset); + posix_spawnattr_setsigmask((posix_spawnattr_t *)datainput, (sigset_t *)datainput1); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnattr_setsigmask\n"); +} diff --git a/testsuites/fuzz/posix_spawnp_fuzzer.cpp b/testsuites/fuzz/posix_spawnp_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..745a23585e0b84cb1e6d1927fbee593d0d17a331 --- /dev/null +++ b/testsuites/fuzz/posix_spawnp_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +void test_posix_spawnp(void) +{ + printf("start ---- test_posix_spawnp\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_posix_spawnp"), 0) + { + s32 pid = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + char *argv[] = {"tftp", nullptr}; + posix_spawnp(&pid, "/bin/tftp", nullptr, nullptr, argv, nullptr); + } + DT_FUZZ_END(); + printf("end --- test_posix_spawnp\n"); +} diff --git a/testsuites/fuzz/pthread_mutex_consistent_fuzzer.cpp b/testsuites/fuzz/pthread_mutex_consistent_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..180df2a825481c3194edacd17711b28c0cccd304 --- /dev/null +++ b/testsuites/fuzz/pthread_mutex_consistent_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_pthread_mutex_consistent(void) +{ + pthread_mutex_t fa; + printf("start----pthread_mutex_consistent\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_mutex_consistent"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(pthread_mutex_t), sizeof(pthread_mutex_t), + (char *)&fa); + pthread_mutex_consistent((pthread_mutex_t *)datainput); + } + DT_FUZZ_END() + printf("end----pthread_mutex_consistent\n"); +} diff --git a/testsuites/fuzz/pthread_mutex_getprioceiling_fuzzer.cpp b/testsuites/fuzz/pthread_mutex_getprioceiling_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..45857e8f826a1b51ca90b75b7de9ecae5cf07f92 --- /dev/null +++ b/testsuites/fuzz/pthread_mutex_getprioceiling_fuzzer.cpp @@ -0,0 +1,49 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_pthread_mutex_getprioceiling(void) +{ + pthread_mutex_t g_muxLock; + printf("start----pthread_mutex_getprioceiling\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_mutex_getprioceiling"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(pthread_mutex_t), sizeof(pthread_mutex_t), + (char *)&g_muxLock); + s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + pthread_mutex_init((pthread_mutex_t *)datainput, NULL); + pthread_mutex_setprioceiling((pthread_mutex_t *)datainput, number0, NULL); + pthread_mutex_getprioceiling((pthread_mutex_t *)datainput, &number0); + pthread_mutex_destroy((pthread_mutex_t *)datainput); + } + DT_FUZZ_END(); + printf("end----pthread_mutex_getprioceiling\n"); +} diff --git a/testsuites/fuzz/pthread_mutexattr_setprotocol_fuzzer.cpp b/testsuites/fuzz/pthread_mutexattr_setprotocol_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a18dc958dd858a99a197b797dbf8248f22c936e3 --- /dev/null +++ b/testsuites/fuzz/pthread_mutexattr_setprotocol_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_pthread_mutexattr_setprotocol(void) +{ + pthread_mutexattr_t fa; + printf("start----pthread_mutexattr_setprotocol\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_mutexattr_setprotocol"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(pthread_mutexattr_t), sizeof(pthread_mutexattr_t), + (char *)&fa); + s32 number = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + pthread_mutexattr_setprotocol((pthread_mutexattr_t *)datainput, number); + } + DT_FUZZ_END() + printf("end----pthread_mutexattr_setprotocol\n"); +} diff --git a/testsuites/fuzz/pthread_mutexattr_setrobust_fuzzer.cpp b/testsuites/fuzz/pthread_mutexattr_setrobust_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..985739e06261afb2880984eb3e275f310743bbd3 --- /dev/null +++ b/testsuites/fuzz/pthread_mutexattr_setrobust_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_pthread_mutexattr_setrobust(void) +{ + pthread_mutexattr_t fa; + printf("start----pthread_mutexattr_setrobust\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_mutexattr_setrobust"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(pthread_mutexattr_t), sizeof(pthread_mutexattr_t), + (char *)&fa); + s32 number = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + pthread_mutexattr_setrobust((pthread_mutexattr_t *)datainput, number); + } + DT_FUZZ_END() + printf("end----pthread_mutexattr_setrobust\n"); +} diff --git a/testsuites/fuzz/pthread_mutexattr_settype_fuzzer.cpp b/testsuites/fuzz/pthread_mutexattr_settype_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0efb8a9158fa4c50e95c18827e0d7d54f0ec20fa --- /dev/null +++ b/testsuites/fuzz/pthread_mutexattr_settype_fuzzer.cpp @@ -0,0 +1,46 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include + +void test_pthread_mutexattr_settype(void) +{ + pthread_mutexattr_t fa; + printf("start----pthread_mutexattr_settype\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_mutexattr_settype"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(pthread_mutexattr_t), sizeof(pthread_mutexattr_t), + (char *)&fa); + s32 number = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + pthread_mutexattr_settype((pthread_mutexattr_t *)datainput, number); + } + DT_FUZZ_END() + printf("end----pthread_mutexattr_settype\n"); +} diff --git a/testsuites/fuzz/pthread_setconcurrency_fuzzer.cpp b/testsuites/fuzz/pthread_setconcurrency_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e0e0e5e7b7aea12ac2daae6ddffd7feea5f37b90 --- /dev/null +++ b/testsuites/fuzz/pthread_setconcurrency_fuzzer.cpp @@ -0,0 +1,42 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_pthread_setconcurrency(void) +{ + printf("start----pthread_setconcurrency\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_pthread_setconcurrency"), 0) + { + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + pthread_setconcurrency(number); + } + DT_FUZZ_END() + printf("end----pthread_setconcurrency\n"); +} diff --git a/testsuites/fuzz/readlink_fuzzer.cpp b/testsuites/fuzz/readlink_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9cb7ce975d99a1b01771d56d3757654195861bd1 --- /dev/null +++ b/testsuites/fuzz/readlink_fuzzer.cpp @@ -0,0 +1,44 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_readlink(void) +{ + printf("start----readlink\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_readlink"), 0) + { + char *pathname = DT_SetGetBlob(&g_Element[0], 6, 10000, "123456"); + char *buf = DT_SetGetBlob(&g_Element[1], 6, 10000, "123456"); + int bufsize = DT_GET_MutatedValueLen(&g_Element[1]); + readlink(pathname, buf, bufsize); + } + DT_FUZZ_END() + printf("end----readlink\n"); +} diff --git a/testsuites/fuzz/readlinkat_fuzzer.cpp b/testsuites/fuzz/readlinkat_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96bb13b95d182158d1bebfa84bfe53154f7999cc --- /dev/null +++ b/testsuites/fuzz/readlinkat_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_readlinkatat(void) +{ + printf("start----readlinkat\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 1000, const_cast("test_readlinkatat"), 0) + { + s32 dirfd = *(s32*)DT_SetGetS32(&g_Element[0], 0x123456); + char *pathname = DT_SetGetBlob(&g_Element[1], 6, 10000, "123456"); + char *buf = DT_SetGetBlob(&g_Element[2], 6, 10000, "123456"); + int bufsize = DT_GET_MutatedValueLen(&g_Element[2]); + readlinkat(dirfd, pathname, buf, bufsize); + } + DT_FUZZ_END() + printf("end----readlinkat\n"); +} diff --git a/testsuites/fuzz/sem_open_fuzzer.cpp b/testsuites/fuzz/sem_open_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e0ec8723546488ebc2655cb3b966c9f64ed1cc55 --- /dev/null +++ b/testsuites/fuzz/sem_open_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include "gtest/gtest.h" + +void test_sem_open(void) +{ + printf("start ---- test_sem_open\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_sem_open"), 0) + { + char *buf = DT_SetGetString(&g_Element[0], 6, 10000, "123456"); + sem_open(buf, O_CREAT | O_EXCL, 0700, 1); + } + DT_FUZZ_END(); + printf("end --- test_sem_open\n"); +} diff --git a/testsuites/fuzz/setns_fuzzer.cpp b/testsuites/fuzz/setns_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..568b1f166108a78a0fe02c97b7c276bd71eaa12d --- /dev/null +++ b/testsuites/fuzz/setns_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_setns(void) +{ + printf("start----test_setns\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_setns"), 0) + { + s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], 0x123456); + setns(number0, number1); + } + DT_FUZZ_END() + printf("end----test_setns\n"); +} diff --git a/testsuites/fuzz/syslog_fuzzer.cpp b/testsuites/fuzz/syslog_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c04f1b3433ba6ebeee0338a17c39441243520a5f --- /dev/null +++ b/testsuites/fuzz/syslog_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_syslog(void) +{ + printf("start----test_syslog\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_syslog"), 0) + { + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + char *buf = DT_SetGetString(&g_Element[1], 6, 10000, "123456"); + syslog(number, "%s\n", buf); + } + DT_FUZZ_END() + printf("end----test_syslog\n"); +} diff --git a/testsuites/fuzz/system_fuzzer.cpp b/testsuites/fuzz/system_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f06a779c4404b2ef91b0582ffa0b17576502b620 --- /dev/null +++ b/testsuites/fuzz/system_fuzzer.cpp @@ -0,0 +1,43 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_system(void) +{ + printf("start----test_system\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_system"), 0) + { + char *buf = DT_SetGetString(&g_Element[0], 6, 10000, "123456"); + printf("buf: %s\n",buf); + system(buf); + } + DT_FUZZ_END() + printf("end----test_system\n"); +} diff --git a/testsuites/fuzz/times_fuzzer.cpp b/testsuites/fuzz/times_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee4cb1c76014c4f830ab33fa9220ae9822222f14 --- /dev/null +++ b/testsuites/fuzz/times_fuzzer.cpp @@ -0,0 +1,45 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include + +void test_times(void) +{ + struct tms buf; + printf("start----test_times\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_times"), 0) + { + char *datainput = DT_SetGetFixBlob(&g_Element[0], sizeof(struct tms), sizeof(struct tms), (char *)&buf); + times((struct tms *)datainput); + } + DT_FUZZ_END() + printf("end----test_times\n"); +} diff --git a/testsuites/fuzz/unshare_fuzzer.cpp b/testsuites/fuzz/unshare_fuzzer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..02b058781e7ae353403835870e4492cf5d374c68 --- /dev/null +++ b/testsuites/fuzz/unshare_fuzzer.cpp @@ -0,0 +1,42 @@ +# Copyright (c) 2022-2023 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include + +void test_unshare(void) +{ + printf("start----test_unshare\n"); + DT_Enable_Support_Loop(1); + DT_FUZZ_START(0, 100000, const_cast("test_unshare"), 0) + { + s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], 0x123456); + unshare(number); + } + DT_FUZZ_END() + printf("end----test_unshare\n"); +}