[RFC PATCH 02/12] tests/inject-nf.test: replace getpid with geteuid

Dmitry V. Levin ldv at altlinux.org
Fri Jun 12 16:19:55 UTC 2020


On Fri, Jun 12, 2020 at 04:33:46PM +0200, Ákos Uzonyi wrote:
> tests/inject-nf.c: Replace getpid with geteuid.
> tests/inject-nf.test: Likewise.

It would be nice to provide a rationale for this change.

Also, geteuid syscall was introduced on Alpha by Linux kernel commit
v5.1-rc1~160^2~3^2~1.  It doesn't mean we cannot throw old Alpha kernels
under the bus, but we should understand potential side effects.
Fortunately, SYSCALL_NEVER_FAILS flag has no effect on Alpha,
otherwise it would be an error to add NF flag to these syscalls
in strace commit v5.1~86.

> ---
>  tests/inject-nf.c    | 17 +++++------------
>  tests/inject-nf.test | 11 +----------
>  2 files changed, 6 insertions(+), 22 deletions(-)
> 
> diff --git a/tests/inject-nf.c b/tests/inject-nf.c
> index c3774f6c..2213a98c 100644
> --- a/tests/inject-nf.c
> +++ b/tests/inject-nf.c
> @@ -16,28 +16,21 @@
>  
>  #include "raw_syscall.h"
>  
> -#ifdef __alpha__
> -/* alpha has no getpid */
> -# define SC_NR __NR_getpgrp
> -# define SC_NAME "getpgrp"
> -# define getpid getpgrp
> -#else
> -# define SC_NR __NR_getpid
> -# define SC_NAME "getpid"
> -#endif
> +#define SC_NR __NR_geteuid
> +#define SC_NAME "geteuid"
>  
>  #ifdef raw_syscall_0
>  # define INVOKE_SC(err) raw_syscall_0(SC_NR, &err)
>  #else
>  /* No raw_syscall_0, let's use getpid() and hope for the best.  */
> -# define INVOKE_SC(err) getpid()
> +# define INVOKE_SC(err) geteuid()
>  #endif

Please update the comment as well.


-- 
ldv


More information about the Strace-devel mailing list