linux/include/uapi
Emanuele Rocca 701f7f4fba
pidfds: add coredump_code field to pidfd_info
The struct pidfd_info currently exposes in a field called coredump_signal the
signal number (si_signo) that triggered the dump (for example, 11 for SIGSEGV).
However, it is also valuable to understand the reason why that signal was sent.
This additional context is provided by the signal code (si_code), such as 2 for
SEGV_ACCERR.

Add a new field to struct pidfd_info called coredump_code with the value of
si_code for the benefit of sysadmins who pipe core dumps to user-space programs
for later analysis. The following snippet illustrates a simplified C program
that consumes coredump_signal and coredump_code, and then logs core dump
signals and codes to a file:

    int pidfd = (int)atoi(argv[1]);

    struct pidfd_info info = {
        .mask = PIDFD_INFO_EXIT | PIDFD_INFO_COREDUMP,
    };

    if (ioctl(pidfd, PIDFD_GET_INFO, &info) == 0)
        if (info.mask & PIDFD_INFO_COREDUMP)
            fprintf(f, "PID=%d, si_signo: %d si_code: %d\n",
                info.pid, info.coredump_signal, info.coredump_code);

Assuming the program is installed under /usr/local/bin/core-logger, core dump
processing can be enabled by setting /proc/sys/kernel/core_pattern to
'|/usr/local/bin/dumpstuff %F'.

systemd-coredump(8) already uses pidfds to process core dumps, and it could be
extended to include the values of coredump_code too.

Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>
Link: https://patch.msgid.link/acE52HIFivNZN3nE@NH27D9T0LF
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2026-03-23 16:29:15 +01:00
..
asm-generic Scheduler changes for v7.0: 2026-02-10 12:50:10 -08:00
cxl
drm drm/amdgpu: set family for GC 11.5.4 2026-02-12 15:23:09 -05:00
fwctl
linux pidfds: add coredump_code field to pidfd_info 2026-03-23 16:29:15 +01:00
misc Char/Misc/IIO/Binder changes for 6.18-rc1 2025-10-04 16:26:32 -07:00
mtd
rdma RDMA v7.0 merge window 2026-02-12 17:05:20 -08:00
regulator regulator: uapi: Use UAPI integer type 2025-12-22 09:00:42 +00:00
scsi scsi: ufs: core: Improve the documentation of UFS data frames 2026-01-11 22:04:10 -05:00
sound ASoC: SOF: ipc4-topology: Add new tokens for pipeline direction 2026-02-04 13:26:05 +00:00
video
xen
Kbuild