tests: extend test coverage of setgid syscall
* tests/setgid.c: New file. * tests/setgid.test: New test. * tests/.gitignore: Add setgid. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add setgid.test.
This commit is contained in:
parent
8f0e41afb7
commit
cf273016fe
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -142,6 +142,7 @@ semop
|
||||
sendfile
|
||||
sendfile64
|
||||
set_ptracer_any
|
||||
setgid
|
||||
sethostname
|
||||
setuid
|
||||
setuid32
|
||||
|
@ -192,6 +192,7 @@ check_PROGRAMS = \
|
||||
sendfile \
|
||||
sendfile64 \
|
||||
set_ptracer_any \
|
||||
setgid \
|
||||
sethostname \
|
||||
setuid \
|
||||
setuid32 \
|
||||
@ -401,6 +402,7 @@ DECODER_TESTS = \
|
||||
semop.test \
|
||||
sendfile.test \
|
||||
sendfile64.test \
|
||||
setgid.test \
|
||||
sethostname.test \
|
||||
setuid.test \
|
||||
setuid32.test \
|
||||
|
25
tests/setgid.c
Normal file
25
tests/setgid.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include "tests.h"
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef __NR_setgid
|
||||
|
||||
# define SYSCALL_NR __NR_setgid
|
||||
# define SYSCALL_NAME "setgid"
|
||||
|
||||
# if defined __NR_setgid32 && __NR_setgid != __NR_setgid32
|
||||
# define UGID_TYPE short
|
||||
# define GETUGID syscall(__NR_getegid)
|
||||
# define CHECK_OVERFLOWUGID(arg) check_overflowgid(arg)
|
||||
# else
|
||||
# define UGID_TYPE int
|
||||
# define GETUGID getegid()
|
||||
# define CHECK_OVERFLOWUGID(arg)
|
||||
# endif
|
||||
|
||||
# include "setugid.c"
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("__NR_setgid")
|
||||
|
||||
#endif
|
6
tests/setgid.test
Executable file
6
tests/setgid.test
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check setgid syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
run_strace_match_diff -a10
|
Loading…
x
Reference in New Issue
Block a user