[PATCH v4 0/2] pidfds: add coredump_code field to pidfd_info

From: Emanuele Rocca

Date: Mon Mar 23 2026 - 09:01:07 EST


This patchs series adds a new field called coredump_code to struct pidfd_info,
as well as the relevant selftests. Note that the coredump selftests are
currently not passing, and the following patch is needed to fix them:
https://lore.kernel.org/lkml/ab2kI0PI_Vk6bU88@NH27D9T0LF/
I have not included it in this series as it is not directly related to the
coredump_code changes.

v1: https://lore.kernel.org/lkml/ab29J6KsQm8Xg3LR@NH27D9T0LF/

v2: Add coredump_pad to struct pidfd_info to ensure the struct has the same
size on both 64 bit and 32 bit systems. The issue was spotted by the kernel
test robot.
https://lore.kernel.org/lkml/202603211842.JCwUVYTI-lkp@xxxxxxxxx/
https://lore.kernel.org/lkml/ab68fUmCK4An1UH-@NH27D9T0LF/

v3: Sending as a new thread, same as v2 otherwise.
https://lore.kernel.org/lkml/acBRj-DSCpqlKt6t@NH27D9T0LF/

v4: Split kernel code from selftest code as suggested by Christian Brauner. Add
Acked-by: Oleg Nesterov to the commit adding the coredump_code field. Thanks!
https://lore.kernel.org/lkml/20260323-hochsehen-kurort-862912a1d7b5@brauner/
https://lore.kernel.org/lkml/acEoVeBaP7bQRHLT@xxxxxxxxxx/

Emanuele Rocca (2):
pidfds: add coredump_code field to pidfd_info
selftests: check pidfd_info->coredump_code correctness

fs/pidfs.c | 12 ++++---
include/uapi/linux/pidfd.h | 4 +++
.../coredump/coredump_socket_protocol_test.c | 26 +++++++++++++++
.../selftests/coredump/coredump_socket_test.c | 32 +++++++++++++++++++
.../coredump/coredump_test_helpers.c | 4 +--
tools/testing/selftests/pidfd/pidfd.h | 5 +++
.../testing/selftests/pidfd/pidfd_info_test.c | 1 +
7 files changed, 78 insertions(+), 6 deletions(-)

--
2.47.3