2024-02-12 16:00:50 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2026-07-16 13:28:20 +08:00
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2026-02-26 14:51:01 +01:00
|
|
|
|
|
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
2024-02-19 16:30:57 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
2024-02-19 16:30:57 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:14 +01:00
|
|
|
|
2025-06-24 10:29:07 +02:00
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
|
|
|
|
|
2025-06-24 10:29:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:14 +01:00
|
|
|
|
2025-10-28 09:45:51 +01:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
2025-03-05 11:08:14 +01:00
|
|
|
|
|
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
2025-10-28 09:45:51 +01:00
|
|
|
|
2025-10-28 09:45:52 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-03-05 11:08:14 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
2026-07-23 18:01:13 +02:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-14 22:01:28 +01:00
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2024-12-14 22:01:28 +01:00
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
2024-12-14 22:01:28 +01:00
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
2024-12-14 22:01:28 +01:00
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-14 22:01:28 +01:00
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 19:45:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-23 14:50:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-20 14:24:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-20 14:24:08 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-20 23:48:55 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2026-05-20 23:48:55 +02:00
|
|
|
|
2026-05-20 23:48:52 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2026-05-20 23:48:52 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2026-05-20 23:48:52 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:50 +01:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
2025-08-14 17:44:53 +08:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-10-28 09:45:49 +01:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-27 22:51:37 +00:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
2025-10-28 09:45:51 +01:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:52 +01:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:52 +01:00
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
|
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
|
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:47 +01:00
|
|
|
|
2026-05-20 23:48:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-15 14:36:33 +02:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-04 15:03:42 +00:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
2025-10-28 09:45:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:11 +01:00
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
2024-11-29 21:16:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 14:51:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-12 13:52:24 +02:00
|
|
|
|
2025-02-04 14:51:20 +01:00
|
|
|
|
|
|
|
|
|
2024-11-29 21:16:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-22 15:13:54 +02:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
2024-11-29 21:16:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pidfd: add ioctl to retrieve pid info
A common pattern when using pid fds is having to get information
about the process, which currently requires /proc being mounted,
resolving the fd to a pid, and then do manual string parsing of
/proc/N/status and friends. This needs to be reimplemented over
and over in all userspace projects (e.g.: I have reimplemented
resolving in systemd, dbus, dbus-daemon, polkit so far), and
requires additional care in checking that the fd is still valid
after having parsed the data, to avoid races.
Having a programmatic API that can be used directly removes all
these requirements, including having /proc mounted.
As discussed at LPC24, add an ioctl with an extensible struct
so that more parameters can be added later if needed. Start with
returning pid/tgid/ppid and creds unconditionally, and cgroupid
optionally.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Link: https://lore.kernel.org/r/20241010155401.2268522-1-luca.boccassi@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-10-10 16:52:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-24 12:09:00 +01:00
|
|
|
|
|
|
|
|
|
2024-07-22 15:13:54 +02:00
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2025-11-17 13:36:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-26 18:51:46 +02:00
|
|
|
|
2026-02-24 12:09:00 +01:00
|
|
|
|
|
|
|
|
|
2024-07-22 15:13:54 +02:00
|
|
|
|
2025-12-24 13:00:24 +01:00
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-22 15:13:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-16 13:28:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-26 14:51:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2026-02-26 14:51:01 +01:00
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 16:11:42 +02:00
|
|
|
|
2026-07-16 13:28:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:00:50 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-05 00:05:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:52 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:52 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:51 +01:00
|
|
|
|
|
|
|
|
|
2025-03-05 11:08:15 +01:00
|
|
|
|
|
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
2026-05-20 23:48:55 +02:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
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 14:02:16 +01:00
|
|
|
|
2025-10-28 09:45:53 +01:00
|
|
|
|
|
|
|
|
|
2025-05-16 13:25:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-07 11:54:18 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-07 11:54:16 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:18 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-15 14:57:29 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-21 14:34:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
2024-05-21 14:34:43 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
2024-12-19 18:01:32 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2024-02-21 09:59:51 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:50 +02:00
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-22 13:56:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-06 21:32:41 -04:00
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
2026-07-22 13:56:28 +02:00
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
2026-07-22 13:56:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-12 10:39:44 +01:00
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
|
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
2025-04-21 10:27:40 +02:00
|
|
|
|
2025-06-18 22:53:45 +02:00
|
|
|
|
|
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-29 14:02:24 +01:00
|
|
|
|
2024-11-29 14:02:23 +01:00
|
|
|
|
2024-11-29 14:02:24 +01:00
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2026-06-07 08:33:43 +08:00
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2026-06-07 08:33:43 +08:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2026-06-07 08:33:43 +08:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-07 08:33:43 +08:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-07 08:33:43 +08:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:18 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:18 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-05 15:53:19 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 14:32:01 +01:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-29 13:20:17 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2024-11-29 14:38:05 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
2024-03-01 10:26:03 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-16 13:49:09 +01:00
|
|
|
|
2024-02-19 16:30:57 +01:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2025-03-16 13:49:09 +01:00
|
|
|
|
2026-02-26 14:51:01 +01:00
|
|
|
|
|
|
|
|
|
2025-03-16 13:49:09 +01:00
|
|
|
|
2026-02-26 14:51:01 +01:00
|
|
|
|
|
|
|
|
|
2025-03-16 13:49:09 +01:00
|
|
|
|
2024-03-12 10:39:44 +01:00
|
|
|
|
2024-02-19 16:30:57 +01:00
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
2025-06-18 22:53:50 +02:00
|
|
|
|
2025-03-16 13:49:09 +01:00
|
|
|
|
2025-04-25 10:11:32 +02:00
|
|
|
|
2026-07-22 13:56:28 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-20 15:52:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-03-05 11:08:14 +01:00
|
|
|
|
2025-06-18 22:53:39 +02:00
|
|
|
|
2025-06-18 22:53:46 +02:00
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-24 10:29:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-12 16:32:38 +01:00
|
|
|
|