History

pidfs, coredump: add PIDFD_INFO_COREDUMP

Extend the PIDFD_INFO_COREDUMP ioctl() with the new PIDFD_INFO_COREDUMP mask flag. This adds the @coredump_mask field to struct pidfd_info. When a task coredumps the kernel will provide the following information to userspace in @coredump_mask: * PIDFD_COREDUMPED is raised if the task did actually coredump. * PIDFD_COREDUMP_SKIP is raised if the task skipped coredumping (e.g., undumpable). * PIDFD_COREDUMP_USER is raised if this is a regular coredump and doesn't need special care by the coredump server. * PIDFD_COREDUMP_ROOT is raised if the generated coredump should be treated as sensitive and the coredump server should restrict to the generated coredump to sufficiently privileged users. The kernel guarantees that by the time the connection is made the all PIDFD_INFO_COREDUMP info is available.

Christian Brauner committed 1 year ago

Commit 1d8db6f1 parent a9194f84 files · +107 −0Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/pidfd.h+16−0
@@ -25,9 +25,23 @@ · 24 unmodified lines
25#define PIDFD_INFO_CREDS (1UL << 1) /* Always returned, even if not requested */25#define PIDFD_INFO_CREDS (1UL << 1) /* Always returned, even if not requested */
26#define PIDFD_INFO_CGROUPID (1UL << 2) /* Always returned if available, even if not requested */26#define PIDFD_INFO_CGROUPID (1UL << 2) /* Always returned if available, even if not requested */
27#define PIDFD_INFO_EXIT (1UL << 3) /* Only returned if requested. */27#define PIDFD_INFO_EXIT (1UL << 3) /* Only returned if requested. */
28#define PIDFD_INFO_COREDUMP (1UL << 4) /* Only returned if requested. */
28 29
29#define PIDFD_INFO_SIZE_VER0 64 /* sizeof first published struct */30#define PIDFD_INFO_SIZE_VER0 64 /* sizeof first published struct */
30 31
32/*
33 * Values for @coredump_mask in pidfd_info.
34 * Only valid if PIDFD_INFO_COREDUMP is set in @mask.
35 *
36 * Note, the @PIDFD_COREDUMP_ROOT flag indicates that the generated
37 * coredump should be treated as sensitive and access should only be
38 * granted to privileged users.
39 */
40#define PIDFD_COREDUMPED (1U << 0) /* Did crash and... */
41#define PIDFD_COREDUMP_SKIP (1U << 1) /* coredumping generation was skipped. */
42#define PIDFD_COREDUMP_USER (1U << 2) /* coredump was done as the user. */
43#define PIDFD_COREDUMP_ROOT (1U << 3) /* coredump was done as root. */
44
31/*45/*
32 * The concept of process and threads in userland and the kernel is a confusing46 * The concept of process and threads in userland and the kernel is a confusing
33 * one - within the kernel every thread is a 'task' with its own individual PID,47 * one - within the kernel every thread is a 'task' with its own individual PID,
@@ -92,6 +106,8 @@ struct pidfd_info { · 58 unmodified lines
92 __u32 fsuid;106 __u32 fsuid;
93 __u32 fsgid;107 __u32 fsgid;
94 __s32 exit_code;108 __s32 exit_code;
109 __u32 coredump_mask;
110 __u32 __spare1;
95};111};
96 112
97#define PIDFS_IOCTL_MAGIC 0xFF113#define PIDFS_IOCTL_MAGIC 0xFF

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t