[PATCH 1/2] tests/inject-nf.test: replace getpid with geteuid

Dmitry V. Levin ldv at altlinux.org
Thu Jun 18 00:01:09 UTC 2020


On Wed, Jun 17, 2020 at 12:34:02PM +0200, Ákos Uzonyi wrote:
> Since we treat PIDs as signed integers, large values (>=2^31) will
> cause overflow when we use printpid.
> UIDs are treated as unsigned integers, so geteuid is a good alternative.
> (getuid would be problematic, as it does not exists on alpha).
> Also, on systems where geteuid32 exists, geteuid returns maximum 16 bit
> values, so we have to use geteuid32 in this case.
[...]
> diff --git a/tests/inject-nf.test b/tests/inject-nf.test
> index cadb5adb..4b79b194 100755
> --- a/tests/inject-nf.test
> +++ b/tests/inject-nf.test
> @@ -9,14 +9,7 @@
>  
>  . "${srcdir=.}/scno_tampering.sh"
>  
> -case "$STRACE_ARCH" in
> -alpha)
> -	SYSCALL=getpgrp
> -	;;
> -*)
> -	SYSCALL=getpid
> -	;;
> -esac
> +SYSCALL="geteuid,geteuid32"

This expression will work only on those architectures where geteuid32
exists, on others it will be rejected with the following diagnostics:

strace: invalid system call 'geteuid32'

I suggest using a more flexible expression, e.g.
SYSCALL='/^geteuid(32)?$'


-- 
ldv


More information about the Strace-devel mailing list