lapi/syscalls: Add syscall numbers for execveat
PATCH 1/2 lapi/syscalls: Add syscall numbers for execveat
--- include/lapi/syscalls/aarch64.in | 1 + include/lapi/syscalls/hppa.in | 1 + include/lapi/syscalls/ia64.in | 1 + include/lapi/syscalls/powerpc.in | 1 + include/lapi/syscalls/powerpc64.in | 1 + include/lapi/syscalls/s390x.in | 1 + include/lapi/syscalls/sh.in | 1 + include/lapi/syscalls/sparc.in | 1 + include/lapi/syscalls/sparc64.in | 1 + 9 files changed, 9 insertions(+)
include/lapi/syscalls/aarch64.in +1 -0
@@ -256,6 +256,7 @@ sendmmsg 269 kcmp 272 getrandom 278 memfd_create 279 +execveat 281 mlock2 284 copy_file_range 285 _sysctl 1078
include/lapi/syscalls/hppa.in +1 -0
@@ -17,5 +17,6 @@ splice 291 tee 293 vmsplice 294 memfd_create 340 +execveat 342 mlock2 345 copy_file_range 346
include/lapi/syscalls/ia64.in +1 -0
@@ -296,5 +296,6 @@ prlimit64 1325 renameat2 1338 getrandom 1339 memfd_create 1340 +execveat 1342 mlock2 1346 copy_file_range 1347
include/lapi/syscalls/powerpc.in +1 -0
@@ -347,6 +347,7 @@ sched_getattr 356 renameat2 357 getrandom 359 memfd_create 360 +execveat 362 mlock2 378 copy_file_range 379 statx 383
include/lapi/syscalls/powerpc64.in +1 -0
@@ -347,6 +347,7 @@ sched_getattr 356 renameat2 357 getrandom 359 memfd_create 360 +execveat 362 mlock2 378 copy_file_range 379 statx 383
include/lapi/syscalls/s390x.in +1 -0
@@ -331,5 +331,6 @@ sched_getattr 346 renameat2 347 getrandom 349 memfd_create 350 +execveat 354 mlock2 374 copy_file_range 375
include/lapi/syscalls/sh.in +1 -0
@@ -364,5 +364,6 @@ fanotify_mark 368 prlimit64 369 kcmp 378 memfd_create 385 +execveat 387 mlock2 390 copy_file_range 391
include/lapi/syscalls/sparc.in +1 -0
@@ -336,5 +336,6 @@ kcmp 341 renameat2 345 getrandom 347 memfd_create 348 +execveat 350 mlock2 356 copy_file_range 357
include/lapi/syscalls/sparc64.in +1 -0
@@ -312,5 +312,6 @@ kcmp 341 renameat2 345 getrandom 347 memfd_create 348 +execveat 350 mlock2 356 copy_file_range 357
Signature · 1 line
1.8.3.1
PATCH 2/2 syscalls/execveat01: Add new testcase
1) Factor out check_execveat().
2) Check the basic functionality of execveat(2).
--- runtest/syscalls | 1 + testcases/kernel/syscalls/execveat/.gitignore | 1 + testcases/kernel/syscalls/execveat/execveat.h | 14 +++ testcases/kernel/syscalls/execveat/execveat01.c | 103 +++++++++++++++++++++ testcases/kernel/syscalls/execveat/execveat03.c | 10 +- .../kernel/syscalls/execveat/execveat_child.c | 2 +- 6 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 testcases/kernel/syscalls/execveat/execveat.h create mode 100644 testcases/kernel/syscalls/execveat/execveat01.c
runtest/syscalls +1 -0
@@ -148,6 +148,7 @@ execve03 execve03 execve04 execve04 execve05 execve05 -i 5 -n 32 execvp01 execvp01 +execveat01 execveat01 execveat03 execveat03 exit01 exit01
testcases/kernel/syscalls/execveat/.gitignore +1 -0
@@ -1,2 +1,3 @@ +/execveat01 /execveat03 /execveat_child
testcases/kernel/syscalls/execveat/execveat.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. +* Authors: Jinhui huang <[email protected]> +* Xiao Yang <[email protected]> +*/ + +void check_execveat (void ) +{ +int ret; + + ret =execveat (-1 ,"" ,NULL ,NULL ,AT_EMPTY_PATH ); +if (ret ==-1 && errno ==EINVAL ) +tst_brk (TCONF ,"execveat() not supported" ); +}
testcases/kernel/syscalls/execveat/execveat01.c new file +103 -0
103 lines not on this page · raw message
testcases/kernel/syscalls/execveat/execveat03.c +1 -9
@@ -53,6 +53,7 @@#include "tst_test.h" #include "lapi/execveat.h" #include "lapi/fcntl.h" +#include "execveat.h" #define OVL_MNT "ovl"#define TEST_APP "execveat_child"
@@ -83,15 +84,6 @@ static void verify_execveat(void)do_child (); } -static void check_execveat (void ) -{ -int ret; - - ret =execveat (-1 ,"" ,NULL ,NULL ,AT_EMPTY_PATH ); -if (ret ==-1 && errno ==EINVAL ) -tst_brk (TCONF ,"execveat() not supported" ); -} -static void setup (void ) {int ret;
testcases/kernel/syscalls/execveat/execveat_child.c +1 -1
@@ -24,7 +24,7 @@/* * execveat_child.c -* dummy program which is used by execveat01.c testcase +* dummy program which is used by execveat01.c and execveat03.c testcases */ #define TST_NO_DEFAULT_MAIN
Signature · 1 line
1.8.3.1
PATCH 2/2 syscalls/execveat01: Add new testcase
Hi!
Quoted 2 lines
1) Factor out
check_execveat().
2) Check the basic functionality of execveat(2).
I looked into the kernel and it seems that the test is mostly excercising common filesystem lookup code and since we have a dentry cache I doubt that we will ever call to the filesystem driver for the pathname lookup for the directory and file we just created. Hence AFAIK there is no point in running the test for all filesystems.
So I've simplified the test so that it does not set .all_filesystems and pushed, thanks!
testcases/kernel/syscalls/execveat/execveat01.c +4 -7
@@ -27,9 +27,9 @@#include "lapi/fcntl.h" #include "execveat.h" -#define MNTPOINT "mntpoint" +#define TESTDIR "testdir"#define TEST_APP "execveat_child" -#define TEST_REL_APP MNTPOINT"/"TEST_APP +#define TEST_REL_APP TESTDIR"/"TEST_APPstatic int fd1, fd4;static int fd2 =AT_FDCWD , fd3 =-1 ;
@@ -65,12 +65,13 @@ static void setup(void)check_execveat (); +SAFE_MKDIR (TESTDIR ,0777 );SAFE_CP (TEST_APP ,TEST_REL_APP );SAFE_GETCWD (cur_dir_path,sizeof (cur_dir_path));sprintf (app_abs_path,"%s/%s" , cur_dir_path,TEST_REL_APP ); - fd1 =SAFE_OPEN (MNTPOINT ,O_DIRECTORY ); + fd1 =SAFE_OPEN (TESTDIR ,O_DIRECTORY ); fd4 =SAFE_OPEN (TEST_REL_APP ,O_PATH ); }
@@ -93,11 +94,7 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .test = verify_execveat, .child_needs_reinit = 1, - .all_filesystems = 1, - .mntpoint = MNTPOINT, - .mount_device = 1, .forks_child = 1, - .needs_root = 1, .cleanup = cleanup, .setup = setup, };
Signature · 2 lines
Cyril Hrubis [email protected]