提交 272c4906 编写于 作者: G gaorui

增加fuzz测试用例

Change-Id: Ib07c89fe4fb840f2be4eec40a379a8f13e5ef2b6
Signed-off-by: Ngaorui <gaorui23@huawei.com>
上级 f3a7a9c6
...@@ -37,5 +37,6 @@ group("testsuites") { ...@@ -37,5 +37,6 @@ group("testsuites") {
deps = [] deps = []
if (liteos_kernel_unittest) { if (liteos_kernel_unittest) {
deps += [ "unittest" ] deps += [ "unittest" ]
#deps += [ "//kernel/liteos_a/testsuites/fuzz:fuzztest" ]
} }
} }
# 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",
"chroot_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",
"sethostname_fuzzer.cpp",
"setns_fuzzer.cpp",
"syslog_fuzzer.cpp",
"system_fuzzer.cpp",
"times_fuzzer.cpp",
"unshare_fuzzer.cpp",
]
include_dirs = []
deps = []
}
group("fuzztest") {
deps = [ ":FuzzDemoTest" ]
}
/*
* 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 <sys/time.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestAdjtime(void)
{
struct timeval fa;
printf("start----TestAdjtime\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestAdjtime"), 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----TestAdjtime\n");
}
/*
* 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 <secodeFuzz.h>
#include <unistd.h>
#include "fuzzertest.h"
void TestChroot(void)
{
printf("start----TestChroot\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestChroot"), 0) {
char *buf = DT_SetGetString(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
chroot(buf);
}
DT_FUZZ_END()
printf("end----TestChroot\n");
}
/*
* 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 <secodeFuzz.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <fcntl.h>
#include <cstdio>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sched.h>
#include "fuzzertest.h"
static int childFunc(void *)
{
return 0;
}
void TestClone(void)
{
printf("start----TestClone\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestClone"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
pid_t pid = clone(childFunc, NULL, number, NULL);
waitpid(pid, NULL, 0);
}
DT_FUZZ_END()
printf("end----TestClone\n");
}
/*
* 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 <secodeFuzz.h>
#include <sys/epoll.h>
#include "fuzzertest.h"
void TestEpollCreate(void)
{
printf("start----TestEpollCreate\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestEpollCreate"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
epoll_create(number);
}
DT_FUZZ_END()
printf("end----TestEpollCreate\n");
}
/*
* 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 <secodeFuzz.h>
#include <sys/epoll.h>
#include "fuzzertest.h"
void TestEpollCtl(void)
{
struct epoll_event fa;
printf("start----TestEpollCtl\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestEpollCtl"), 0) {
s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
s32 number2 = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
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----TestEpollCtl\n");
}
/*
* 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 <secodeFuzz.h>
#include <sys/epoll.h>
#include "fuzzertest.h"
void TestEpollWait(void)
{
struct epoll_event fa;
printf("start----TestEpollWait\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestEpollWait"), 0) {
s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
s32 number2 = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
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----TestEpollWait\n");
}
/*
* 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 <secodeFuzz.h>
#include <fenv.h>
#include "fuzzertest.h"
void TestFesetenv(void)
{
fenv_t fa;
printf("start----TestFesetenv\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestFesetenv"), 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----TestFesetenv\n");
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _FUZZERTEST_H
#define _FUZZERTEST_H
#define FREQUENCY 100000
#define INITVALUE_S32 0x123456
#define INITVALUE_STRING "123456"
#define LENGTH_STRING 6
#define MAXLENGTH_STRING 10000
#endif
\ No newline at end of file
/*
* 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 <secodeFuzz.h>
#include <sys/resource.h>
#include "fuzzertest.h"
void TestGetrlimit(void)
{
struct rlimit fa;
printf("start----TestGetrlimit\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestGetrlimit"), 0) {
s32 resource = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
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----TestGetrlimit\n");
}
/*
* 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 <secodeFuzz.h>
extern void TestPosixSpawnFileActionsAddchdirNp(void);
extern void TestPosixSpawnFileActionsAdddup2(void);
extern void TestPosixSpawnFileActionsAddfchdirNp(void);
extern void TestPosixSpawnFileActionsAddopen(void);
extern void TestPosixSpawnFileActionsDestroy(void);
extern void TestPosixSpawnFileActionsInit(void);
extern void TestPosixSpawn(void);
extern void TestPosixSpawnattrDestroy(void);
extern void TestPosixSpawnattrGetflags(void);
extern void TestPosixSpawnattrGetpgroup(void);
extern void TestPosixSpawnattrGetschedparam(void);
extern void TestPosixSpawnattrGetschedpolicy(void);
extern void TestPosixSpawnattrGetsigdefault(void);
extern void TestPosixSpawnattrGetsigmask(void);
extern void TestPosixSpawnattrInit(void);
extern void TestPosixSpawnattrSetflags(void);
extern void TestPosixSpawnattrSetpgroup(void);
extern void TestPosixSpawnattrSetschedparam(void);
extern void TestPosixSpawnattrSetschedpolicy(void);
extern void TestPosixSpawnattrSetsigdefault(void);
extern void TestPosixSpawnattrSetsigmask(void);
extern void TestPosixSpawnp(void);
extern void TestAdjtime(void);
extern void TestFesetenv(void);
extern void TestGetrlimit(void);
extern void TestReadlink(void);
extern void TestReadlinkat(void);
extern void TestSyslog(void);
extern void TestSystem(void);
extern void TestTimes(void);
extern void TestClone(void);
extern void TestEpollCreate(void);
extern void TestEpollCtl(void);
extern void TestEpollWait(void);
extern void TestMlock(void);
extern void TestMlockall(void);
extern void TestPthreadMutexConsistent(void);
extern void TestPthreadMutexGetprioceiling(void);
extern void TestPthreadMutexattrSetprotocol(void);
extern void TestPthreadMutexattrSetrobust(void);
extern void TestPthreadMutexattrSettype(void);
extern void TestPthreadSetconcurrency(void);
extern void TestSetns(void);
extern void TestUnshare(void);
extern void TestSemOpen(void);
extern void TestChroot(void);
extern void TestSethostname(void);
int main()
{
DT_Set_Report_Path("/storage/");
TestPosixSpawnFileActionsAddchdirNp();
TestPosixSpawnFileActionsAddopen();
TestPosixSpawnFileActionsAdddup2();
TestPosixSpawnFileActionsAddfchdirNp();
TestPosixSpawnFileActionsDestroy();
TestPosixSpawnFileActionsInit();
TestPosixSpawnattrDestroy();
TestPosixSpawnattrGetflags();
TestPosixSpawnattrGetpgroup();
TestPosixSpawnattrGetschedparam();
TestPosixSpawnattrGetschedpolicy();
TestPosixSpawnattrGetsigdefault();
TestPosixSpawnattrGetsigmask();
TestPosixSpawnattrInit();
TestPosixSpawnattrSetflags();
TestPosixSpawnattrSetpgroup();
TestPosixSpawnattrSetschedparam();
TestPosixSpawnattrSetschedpolicy();
TestPosixSpawnattrSetsigdefault();
TestPosixSpawnattrSetsigmask();
TestPosixSpawn();
TestPosixSpawnp();
TestSyslog();
TestSystem();
TestMlock();
TestMlockall();
TestAdjtime();
TestFesetenv();
TestGetrlimit();
TestReadlink();
TestReadlinkat();
TestTimes();
TestClone();
TestEpollCreate();
TestEpollCtl();
TestEpollWait();
TestPthreadMutexConsistent();
TestPthreadMutexGetprioceiling();
TestPthreadMutexattrSetprotocol();
TestPthreadMutexattrSetrobust();
TestPthreadMutexattrSettype();
TestPthreadSetconcurrency();
TestSetns();
TestSemOpen();
TestUnshare();
TestChroot();
TestSethostname();
return 0;
}
/*
* 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 <secodeFuzz.h>
#include <sys/mman.h>
#include "fuzzertest.h"
void TestMlock(void)
{
int lockSize = 4096 + 1;
printf("start----TestMlock\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestMlock"), 0) {
char *p = DT_SetGetString(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
mlock(p, lockSize);
munlock(p, lockSize);
}
DT_FUZZ_END()
printf("end----TestMlock\n");
}
/*
* 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 <secodeFuzz.h>
#include <sys/mman.h>
#include "fuzzertest.h"
void TestMlockall(void)
{
printf("start----TestMlockall\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestMlockall"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
mlockall(number);
}
DT_FUZZ_END()
printf("end----TestMlockall\n");
}
/*
* 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 <secodeFuzz.h>
#include <spawn.h>
#include "fuzzertest.h"
void TestPosixSpawnFileActionsAddchdirNp(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsAddchdirNp\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsAddchdirNp"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
char *path = DT_SetGetString(&g_Element[19], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
posix_spawn_file_actions_addchdir_np(&fa, path);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsAddchdirNp\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "gtest/gtest.h"
#include "fuzzertest.h"
void TestPosixSpawnFileActionsAdddup2(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsAdddup2\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsAdddup2"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], INITVALUE_S32);
posix_spawn_file_actions_adddup2(&fa, STDOUT_FILENO, tmpfd);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsAdddup2\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnFileActionsAddfchdirNp(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsAddfchdirNp\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsAddfchdirNp"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], INITVALUE_S32);
posix_spawn_file_actions_addfchdir_np(&fa, tmpfd);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsAddfchdirNp\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnFileActionsAddopen(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsAddopen\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsAddopen"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
s32 tmpfd = *(s32 *)DT_SetGetS32(&g_Element[19], INITVALUE_S32);
char *path = DT_SetGetBlob(&g_Element[20], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
s32 flag = *(s32 *)DT_SetGetS32(&g_Element[21], INITVALUE_S32);
posix_spawn_file_actions_addopen(&fa, tmpfd, path, flag, 0);
posix_spawn_file_actions_addclose(&fa, tmpfd);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsAddopen\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnFileActionsDestroy(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsDestroy\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsDestroy"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
posix_spawn_file_actions_init(&fa);
posix_spawn_file_actions_destroy(&fa);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsDestroy\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnFileActionsInit(void)
{
posix_spawn_file_actions_t fa;
printf("start ---- TestPosixSpawnFileActionsInit\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnFileActionsInit"), 0) {
fa.__pad0[0] = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
fa.__pad0[1] = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
fa.__pad0[2] = *(s32 *)DT_SetGetS32(&g_Element[2], INITVALUE_S32);
for (int i = 0; i < 16; i++) {
fa.__pad[i] = *(s32 *)DT_SetGetS32(&g_Element[i+3], INITVALUE_S32);
}
char *action = DT_SetGetBlob(&g_Element[18], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
fa.__actions=(void *)action;
posix_spawn_file_actions_init(&fa);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnFileActionsInit\n");
}
/*
* 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 <spawn.h>
#include <unistd.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawn(void)
{
printf("start ---- TestPosixSpawn\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawn"), 0) {
s32 pid = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
char *argv[] = {"tftp", nullptr};
posix_spawn(&pid, "/bin/tftp", nullptr, nullptr, argv, nullptr);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawn\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrDestroy(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrDestroy\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrDestroy"), 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 --- TestPosixSpawnattrDestroy\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetflags(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrGetflags\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetflags"), 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], INITVALUE_S32);
posix_spawnattr_getflags((posix_spawnattr_t *)datainput, &flag);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrGetflags\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetpgroup(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrGetpgroup\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetpgroup"), 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], INITVALUE_S32);
posix_spawnattr_getpgroup((posix_spawnattr_t *)datainput, &pgrp);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrGetpgroup\n");
}
/*
* 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 <sched.h>
#include <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetschedparam(void)
{
posix_spawnattr_t attr;
struct sched_param schedparam;
printf("start ---- TestPosixSpawnattrGetschedparam\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetschedparam"), 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 --- TestPosixSpawnattrGetschedparam\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetschedpolicy(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrGetschedpolicy\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetschedpolicy"), 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], INITVALUE_S32);
posix_spawnattr_getschedpolicy((posix_spawnattr_t *)datainput, &policy);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrGetschedpolicy\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetsigdefault(void)
{
posix_spawnattr_t attr;
sigset_t signalset;
printf("start ---- TestPosixSpawnattrGetsigdefault\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetsigdefault"), 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 --- TestPosixSpawnattrGetsigdefault\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrGetsigmask(void)
{
posix_spawnattr_t attr;
sigset_t signalset;
printf("start ---- TestPosixSpawnattrGetsigmask\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrGetsigmask"), 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 --- TestPosixSpawnattrGetsigmask\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrInit(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrInit\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrInit"), 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 --- TestPosixSpawnattrInit\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetflags(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrSetflags\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetflags"), 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], INITVALUE_S32);
posix_spawnattr_setflags((posix_spawnattr_t *)datainput, flags);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrSetflags\n");
}
\ No newline at end of file
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetpgroup(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrSetpgroup\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetpgroup"), 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], INITVALUE_S32);
posix_spawnattr_setpgroup((posix_spawnattr_t *)datainput, pgrp);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrSetpgroup\n");
}
\ No newline at end of file
/*
* 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 <sched.h>
#include <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetschedparam(void)
{
posix_spawnattr_t attr;
struct sched_param schedparam;
printf("start ---- TestPosixSpawnattrSetschedparam\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetschedparam"), 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 --- TestPosixSpawnattrSetschedparam\n");
}
\ No newline at end of file
/*
* 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 <sched.h>
#include <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetschedpolicy(void)
{
posix_spawnattr_t attr;
printf("start ---- TestPosixSpawnattrSetschedpolicy\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetschedpolicy"), 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], INITVALUE_S32);
posix_spawnattr_setschedpolicy((posix_spawnattr_t *)datainput, policy);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnattrSetschedpolicy\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetsigdefault(void)
{
posix_spawnattr_t attr;
sigset_t sigdefault;
printf("start ---- TestPosixSpawnattrSetsigdefault\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetsigdefault"), 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 --- TestPosixSpawnattrSetsigdefault\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnattrSetsigmask(void)
{
posix_spawnattr_t attr;
sigset_t signalset;
printf("start ---- TestPosixSpawnattrSetsigmask\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnattrSetsigmask"), 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 --- TestPosixSpawnattrSetsigmask\n");
}
/*
* 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 <spawn.h>
#include <unistd.h>
#include <secodeFuzz.h>
#include "fuzzertest.h"
void TestPosixSpawnp(void)
{
printf("start ---- TestPosixSpawnp\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPosixSpawnp"), 0) {
s32 pid = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
char *argv[] = {"tftp", nullptr};
posix_spawnp(&pid, "/bin/tftp", nullptr, nullptr, argv, nullptr);
}
DT_FUZZ_END();
printf("end --- TestPosixSpawnp\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadMutexConsistent(void)
{
pthread_mutex_t fa;
printf("start----TestPthreadMutexConsistent\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadMutexConsistent"), 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----TestPthreadMutexConsistent\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadMutexGetprioceiling(void)
{
pthread_mutex_t g_muxLock;
printf("start----TestPthreadMutexGetprioceiling\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadMutexGetprioceiling"), 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], INITVALUE_S32);
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----TestPthreadMutexGetprioceiling\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadMutexattrSetprotocol(void)
{
pthread_mutexattr_t fa;
printf("start----TestPthreadMutexattrSetprotocol\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadMutexattrSetprotocol"), 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], INITVALUE_S32);
pthread_mutexattr_setprotocol((pthread_mutexattr_t *)datainput, number);
}
DT_FUZZ_END()
printf("end----TestPthreadMutexattrSetprotocol\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadMutexattrSetrobust(void)
{
pthread_mutexattr_t fa;
printf("start----TestPthreadMutexattrSetrobust\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadMutexattrSetrobust"), 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], INITVALUE_S32);
pthread_mutexattr_setrobust((pthread_mutexattr_t *)datainput, number);
}
DT_FUZZ_END()
printf("end----TestPthreadMutexattrSetrobust\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadMutexattrSettype(void)
{
pthread_mutexattr_t fa;
printf("start----TestPthreadMutexattrSettype\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadMutexattrSettype"), 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], INITVALUE_S32);
pthread_mutexattr_settype((pthread_mutexattr_t *)datainput, number);
}
DT_FUZZ_END()
printf("end----TestPthreadMutexattrSettype\n");
}
/*
* 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 <secodeFuzz.h>
#include <pthread.h>
#include "fuzzertest.h"
void TestPthreadSetconcurrency(void)
{
printf("start----TestPthreadSetconcurrency\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestPthreadSetconcurrency"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
pthread_setconcurrency(number);
}
DT_FUZZ_END()
printf("end----TestPthreadSetconcurrency\n");
}
/*
* 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 <secodeFuzz.h>
#include <unistd.h>
#include "fuzzertest.h"
void TestReadlink(void)
{
printf("start----TestReadlink\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestReadlink"), 0) {
char *pathname = DT_SetGetBlob(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
char *buf = DT_SetGetBlob(&g_Element[1], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
int bufsize = DT_GET_MutatedValueLen(&g_Element[1]);
readlink(pathname, buf, bufsize);
}
DT_FUZZ_END()
printf("end----TestReadlink\n");
}
/*
* 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 <secodeFuzz.h>
#include <fcntl.h>
#include <unistd.h>
#include "fuzzertest.h"
void TestReadlinkat(void)
{
printf("start----TestReadlinkat\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestReadlinkat"), 0) {
s32 dirfd = *(s32*)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
char *pathname = DT_SetGetBlob(&g_Element[1], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
char *buf = DT_SetGetBlob(&g_Element[2], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
int bufsize = DT_GET_MutatedValueLen(&g_Element[2]);
readlinkat(dirfd, pathname, buf, bufsize);
}
DT_FUZZ_END()
printf("end----TestReadlinkat\n");
}
/*
* 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 <spawn.h>
#include <secodeFuzz.h>
#include "sys/types.h"
#include "gtest/gtest.h"
#include "fuzzertest.h"
void TestSemOpen(void)
{
printf("start ---- TestSemOpen\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestSemOpen"), 0) {
char *buf = DT_SetGetString(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
sem_open(buf, O_CREAT | O_EXCL, 0700, 1);
}
DT_FUZZ_END();
printf("end --- TestSemOpen\n");
}
/*
* 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 <secodeFuzz.h>
#include <unistd.h>
#include "fuzzertest.h"
void TestSethostname(void)
{
printf("start----TestSethostname\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestSethostname"), 0) {
char *buf = DT_SetGetString(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
s32 number = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
sethostname(buf, number);
}
DT_FUZZ_END()
printf("end----TestSethostname\n");
}
/*
* 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 <secodeFuzz.h>
#include <sched.h>
#include "fuzzertest.h"
void TestSetns(void)
{
printf("start----TestSetns\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestSetns"), 0) {
s32 number0 = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
s32 number1 = *(s32 *)DT_SetGetS32(&g_Element[1], INITVALUE_S32);
setns(number0, number1);
}
DT_FUZZ_END()
printf("end----TestSetns\n");
}
/*
* 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 <secodeFuzz.h>
#include <syslog.h>
#include "fuzzertest.h"
void TestSyslog(void)
{
printf("start----TestSyslog\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestSyslog"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
char *buf = DT_SetGetString(&g_Element[1], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
syslog(number, "%s\n", buf);
}
DT_FUZZ_END()
printf("end----TestSyslog\n");
}
/*
* 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 <secodeFuzz.h>
#include <stdlib.h>
#include "fuzzertest.h"
void TestSystem(void)
{
printf("start----TestSystem\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestSystem"), 0) {
char *buf = DT_SetGetString(&g_Element[0], LENGTH_STRING, MAXLENGTH_STRING, INITVALUE_STRING);
system(buf);
}
DT_FUZZ_END()
printf("end----TestSystem\n");
}
/*
* 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 <climits>
#include <secodeFuzz.h>
#include <sys/times.h>
#include "fuzzertest.h"
void TestTimes(void)
{
struct tms buf;
printf("start----TestTimes\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestTimes"), 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----TestTimes\n");
}
/*
* 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 <secodeFuzz.h>
#include <sched.h>
#include "fuzzertest.h"
void TestUnshare(void)
{
printf("start----TestUnshare\n");
DT_Enable_Support_Loop(1);
DT_FUZZ_START(0, FREQUENCY, const_cast<char *>("TestUnshare"), 0) {
s32 number = *(s32 *)DT_SetGetS32(&g_Element[0], INITVALUE_S32);
unshare(number);
}
DT_FUZZ_END()
printf("end----TestUnshare\n");
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册