strace/tests/uid.test
Dmitry V. Levin 530bed0ca8 Fix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls
Convert parsers of these syscalls to the same scheme as were applied to
parsers of other uid/gid related syscalls.
That is, define two sets of parsers on architectures that support
(either directly or via multiarch) 16-bit and 32-bit gid getgroups
and setgroups syscalls simultaneously, and reuse essentially the same
code by parametrizing uid_t and names of parser functions.

* groups.c: Remove.
(sys_getgroups, sys_setgroups): Move ...
* uid.c: ... here and parametrize their names.
* Makefile.am (strace_SOURCES): Remove groups.c.
* linux/syscall.h (sys_getgroups32, sys_setgroups32): Remove.
[NEED_UID16_PARSERS] (sys_getgroups16, sys_setgroups16): New prototypes.
* linux/arm/syscallent.h: Rename sys_[gs]etgroups to sys_[gs]etgroups16,
rename sys_[gs]etgroups32 to sys_[gs]etgroups.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* tests/uid.c: Test for getgroups.
* tests/uid16.c: Likewise.
* tests/uid32.c: Test for getgroups32.
* tests/uid.awk: Test for getgroups/getgroups32 decoding.
* tests/uid.test: Trace getgroups/getgroups32 syscalls.
2014-12-16 01:09:23 +00:00

33 lines
579 B
Bash
Executable File

#!/bin/sh
# Check uid decoding.
. "${srcdir=.}/init.sh"
check_prog awk
s="${uid_syscall_suffix-}"
w="${uid_t_size-}"
uid="uid$s$w"
./"$uid" || {
if [ $? -eq 77 ]; then
framework_skip_ "some uid$s or uid${w}_t syscalls are not available"
else
fail_ "$uid failed"
fi
}
syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,chown$s,getgroups$s"
args="-e trace=$syscalls"
$STRACE -o "$LOG" $args ./"$uid"|| {
cat "$LOG"
fail_ "$STRACE $args ./$uid failed"
}
awk -f "$srcdir"/uid.awk -v suffix="$s" "$LOG" || {
cat "$LOG"
fail_ 'unexpected output'
}
exit 0