All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/4] pidfd: improve uapi when task isn't found
@ 2025-04-03 14:09 Christian Brauner
  2025-04-03 14:09 ` [PATCH RFC 1/4] selftests/pidfd: adapt to recent changes Christian Brauner
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Christian Brauner @ 2025-04-03 14:09 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: linux-fsdevel, Jeff Layton, Lennart Poettering, Daan De Meyer,
	Mike Yuan, linux-kernel, Christian Brauner

Oleg,

We currently report EINVAL whenever a struct pid has no tasked attached
anymore thereby conflating two concepts:

(1) The task has already been reaped.
(2) The caller requested a pidfd for a thread-group leader but the pid
    actually references a struct pid that isn't used as a thread-group
    leader.

This is causing issues for non-threaded workloads as in [1] where they
expect ESRCH to be reported, not EINVAL. I think that's a very resonable
assumption.

This patch tries to allow userspace to distinguish between (1) and (2).
This is racy of course but that shouldn't matter.

Christian

Signed-off-by: Christian Brauner <brauner@kernel.org>
---
Christian Brauner (4):
      selftests/pidfd: adapt to recent changes
      pidfd: remove unneeded NULL check from pidfd_prepare()
      pidfd: improve uapi when task isn't found
      selftest/pidfd: add test for thread-group leader pidfd open for thread

 kernel/fork.c                                   | 31 ++++++++++++++++++++++---
 tools/testing/selftests/pidfd/pidfd_info_test.c | 13 ++++++-----
 2 files changed, 35 insertions(+), 9 deletions(-)
---
base-commit: a2cc6ff5ec8f91bc463fd3b0c26b61166a07eb11
change-id: 20250403-work-pidfd-fixes-54c5b13ee0ee


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

end of thread, other threads:[~2025-04-11 11:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 14:09 [PATCH RFC 0/4] pidfd: improve uapi when task isn't found Christian Brauner
2025-04-03 14:09 ` [PATCH RFC 1/4] selftests/pidfd: adapt to recent changes Christian Brauner
2025-04-03 14:09 ` [PATCH RFC 2/4] pidfd: remove unneeded NULL check from pidfd_prepare() Christian Brauner
2025-04-03 14:09 ` [PATCH RFC 3/4] pidfd: improve uapi when task isn't found Christian Brauner
2025-04-04 12:37   ` Oleg Nesterov
2025-04-04 13:38     ` Christian Brauner
2025-04-04 14:53       ` Oleg Nesterov
2025-04-09 15:38         ` Christian Brauner
2025-04-09 18:18           ` [RFC PATCH] pidfs: ensure consistent ENOENT/ESRCH reporting Christian Brauner
2025-04-09 18:40             ` Oleg Nesterov
2025-04-10 10:18               ` Oleg Nesterov
2025-04-10 10:43                 ` Christian Brauner
2025-04-10 13:10                   ` Oleg Nesterov
2025-04-10 20:05                     ` Christian Brauner
2025-04-10 20:24                       ` Christian Brauner
2025-04-11 11:08                         ` Christian Brauner
2025-04-11 11:25                           ` Oleg Nesterov
2025-04-11 11:41                             ` Oleg Nesterov
2025-04-03 14:09 ` [PATCH RFC 4/4] selftest/pidfd: add test for thread-group leader pidfd open for thread Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.