public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)
@ 2022-08-15  5:38 Florian Weimer
  2022-08-15 14:23 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2022-08-15  5:38 UTC (permalink / raw)
  To: libc-alpha; +Cc: Mark Wielaard, freswa, sam

---
 sysdeps/unix/sysv/linux/tst-pidfd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/tst-pidfd.c b/sysdeps/unix/sysv/linux/tst-pidfd.c
index 037af22290..5711d1c312 100644
--- a/sysdeps/unix/sysv/linux/tst-pidfd.c
+++ b/sysdeps/unix/sysv/linux/tst-pidfd.c
@@ -147,8 +147,11 @@ do_test (void)
        may be denied if the process doesn't have CAP_SYS_PTRACE or
        if a LSM security_ptrace_access_check denies access.  */
     if (fd == -1 && errno == EPERM)
-      FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, "
-			"skipping test");
+      {
+	TEST_COMPARE (pidfd_send_signal (pidfd, SIGKILL, NULL, 0), 0);
+	FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, "
+			  "skipping test");
+      }
     TEST_VERIFY (fd > 0);
 
     char *path = xasprintf ("/proc/%d/fd/%d", pid, remote_fd);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485)
  2022-08-15  5:38 [PATCH] Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485) Florian Weimer
@ 2022-08-15 14:23 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2022-08-15 14:23 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha; +Cc: Mark Wielaard, freswa

On 8/15/22 01:38, Florian Weimer via Libc-alpha wrote:
> ---
>  sysdeps/unix/sysv/linux/tst-pidfd.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/tst-pidfd.c b/sysdeps/unix/sysv/linux/tst-pidfd.c
> index 037af22290..5711d1c312 100644
> --- a/sysdeps/unix/sysv/linux/tst-pidfd.c
> +++ b/sysdeps/unix/sysv/linux/tst-pidfd.c
> @@ -147,8 +147,11 @@ do_test (void)
>         may be denied if the process doesn't have CAP_SYS_PTRACE or
>         if a LSM security_ptrace_access_check denies access.  */
>      if (fd == -1 && errno == EPERM)
> -      FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, "
> -			"skipping test");
> +      {
> +	TEST_COMPARE (pidfd_send_signal (pidfd, SIGKILL, NULL, 0), 0);
> +	FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, "
> +			  "skipping test");
> +      }
>      TEST_VERIFY (fd > 0);
>  
>      char *path = xasprintf ("/proc/%d/fd/%d", pid, remote_fd);
> 
I reviewed the original and missed this. Thanks.

On line 107 we fork the new process.

On line 150 we are testing for the unsupported failure but the child process is still alive.

You add the termination via TEST_COMPARE sending SIGKILL via pidfd_send_signal.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15  5:38 [PATCH] Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485) Florian Weimer
2022-08-15 14:23 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).