Pull seccomp updates from Kees Cook: "There are a bunch of clean ups and selftest improvements along with two major updates to the SECCOMP_RET_USER_NOTIF filter return: EPOLLHUP support to more easily detect the death of a monitored process, and being able to inject fds when intercepting syscalls that expect an fd-opening side-effect (needed by both container folks and Chrome). The latter continued the refactoring of __scm_install_fd() started by Christoph, and in the process found and fixed a handful of bugs in various callers. - Improved selftest coverage, timeouts, and reporting - Add EPOLLHUP support for SECCOMP_RET_USER_NOTIF (Christian Brauner) - Refactor __scm_install_fd() into __receive_fd() and fix buggy callers - Introduce 'addfd' command for SECCOMP_RET_USER_NOTIF (Sargun Dhillon)" * tag 'seccomp-v5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (30 commits) selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD seccomp: Introduce addfd ioctl to seccomp user notifier fs: Expand __receive_fd() to accept existing fd pidfd: Replace open-coded receive_fd() fs: Add receive_fd() wrapper for __receive_fd() fs: Move __scm_install_fd() to __receive_fd() net/scm: Regularize compat handling of scm_detach_fds() pidfd: Add missing sock updates for pidfd_getfd() net/compat: Add missing sock updates for SCM_RIGHTS selftests/seccomp: Check ENOSYS under tracing selftests/seccomp: Refactor to use fixture variants selftests/harness: Clean up kern-doc for fixtures seccomp: Use -1 marker for end of mode 1 syscall list seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID selftests/seccomp: Rename user_trap_syscall() to user_notif_syscall() selftests/seccomp: Make kcmp() less required seccomp: Use pr_fmt selftests/seccomp: Improve calibration loop selftests/seccomp: use 90s as timeout selftests/seccomp: Expand benchmark to per-filter measurements ...
Showing the changes to include/uapi/linux (1 of 21 files). Show all
Unified · Split
| @@ -113,6 +113,25 @@ struct seccomp_notif_resp { · 112 unmodified lines | |||
| 113 | __u32 flags; | 113 | __u32 flags; |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | /* valid flags for seccomp_notif_addfd */ | ||
| 117 | #define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */ | ||
| 118 | |||
| 119 | /** | ||
| 120 | * struct seccomp_notif_addfd | ||
| 121 | * @id: The ID of the seccomp notification | ||
| 122 | * @flags: SECCOMP_ADDFD_FLAG_* | ||
| 123 | * @srcfd: The local fd number | ||
| 124 | * @newfd: Optional remote FD number if SETFD option is set, otherwise 0. | ||
| 125 | * @newfd_flags: The O_* flags the remote FD should have applied | ||
| 126 | */ | ||
| 127 | struct seccomp_notif_addfd { | ||
| 128 | __u64 id; | ||
| 129 | __u32 flags; | ||
| 130 | __u32 srcfd; | ||
| 131 | __u32 newfd; | ||
| 132 | __u32 newfd_flags; | ||
| 133 | }; | ||
| 134 | |||
| 116 | #define SECCOMP_IOC_MAGIC '!' | 135 | #define SECCOMP_IOC_MAGIC '!' |
| 117 | #define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr) | 136 | #define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr) |
| 118 | #define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type) | 137 | #define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type) |
| @@ -123,5 +142,9 @@ struct seccomp_notif_resp { · 4 unmodified lines | |||
| 123 | #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) | 142 | #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) |
| 124 | #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ | 143 | #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ |
| 125 | struct seccomp_notif_resp) | 144 | struct seccomp_notif_resp) |
| 126 | #define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) | 145 | #define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) |
| 146 | /* On success, the return value is the remote process's added fd number */ | ||
| 147 | #define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \ | ||
| 148 | struct seccomp_notif_addfd) | ||
| 149 | |||
| 127 | #endif /* _UAPI_LINUX_SECCOMP_H */ | 150 | #endif /* _UAPI_LINUX_SECCOMP_H */ |