History

syscall_user_dispatch: Add PR_SYS_DISPATCH_INCLUSIVE_ON

There are two possible scenarios for syscall filtering: - having a trusted/allowed range of PCs, and intercepting everything else - or the opposite: a single untrusted/intercepted range and allowing everything else (this is relevant for any kind of sandboxing scenario, or monitoring behavior of a single library) The current API only allows the former use case due to allowed range wrap-around check. Add PR_SYS_DISPATCH_INCLUSIVE_ON that enables the second use case. Add PR_SYS_DISPATCH_EXCLUSIVE_ON alias for PR_SYS_DISPATCH_ON to make it clear how it's different from the new PR_SYS_DISPATCH_INCLUSIVE_ON.

Dmitry Vyukov committed 1 year ago

Commit a2fc4221 parent b89732c4 files · +49 −24Browse files

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

Unified · Split

tools/include/uapi/linux/prctl.h+6−1
@@ -255,7 +255,12 @@ struct prctl_mm_map { · 254 unmodified lines
255/* Dispatch syscalls to a userspace handler */255/* Dispatch syscalls to a userspace handler */
256#define PR_SET_SYSCALL_USER_DISPATCH 59256#define PR_SET_SYSCALL_USER_DISPATCH 59
257# define PR_SYS_DISPATCH_OFF 0257# define PR_SYS_DISPATCH_OFF 0
258# define PR_SYS_DISPATCH_ON 1258/* Enable dispatch except for the specified range */
259# define PR_SYS_DISPATCH_EXCLUSIVE_ON 1
260/* Enable dispatch for the specified range */
261# define PR_SYS_DISPATCH_INCLUSIVE_ON 2
262/* Legacy name for backwards compatibility */
263# define PR_SYS_DISPATCH_ON PR_SYS_DISPATCH_EXCLUSIVE_ON
259/* The control values for the user space selector when dispatch is enabled */264/* The control values for the user space selector when dispatch is enabled */
260# define SYSCALL_DISPATCH_FILTER_ALLOW 0265# define SYSCALL_DISPATCH_FILTER_ALLOW 0
261# define SYSCALL_DISPATCH_FILTER_BLOCK 1266# define SYSCALL_DISPATCH_FILTER_BLOCK 1