History

landlock: Add signal scoping

Currently, a sandbox process is not restricted to sending a signal (e.g. SIGKILL) to a process outside the sandbox environment. The ability to send a signal for a sandboxed process should be scoped the same way abstract UNIX sockets are scoped. Therefore, we extend the "scoped" field in a ruleset with LANDLOCK_SCOPE_SIGNAL to specify that a ruleset will deny sending any signal from within a sandbox process to its parent (i.e. any parent sandbox or non-sandboxed processes). This patch adds file_set_fowner and file_free_security hooks to set and release a pointer to the file owner's domain. This pointer, fown_domain in landlock_file_security will be used in file_send_sigiotask to check if the process can send a signal. The ruleset_with_unknown_scope test is updated to support LANDLOCK_SCOPE_SIGNAL. This depends on two new changes: - commit 1934b212615d ("file: reclaim 24 bytes from f_owner"): replace container_of(fown, struct file, f_owner) with fown->file . - commit 26f204380a3c ("fs: Fix file_set_fowner LSM hook inconsistencies"): lock before calling the hook.

Tahera Fahimi committed 2 years ago

Commit 54a6e6b1 parent dba40c77 files · +94 −3Browse files

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

Unified · Split

include/uapi/linux/landlock.h+3−0
@@ -296,9 +296,12 @@ struct landlock_net_port_attr { · 295 unmodified lines
296296 * - %LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET: Restrict a sandboxed process from
297297 * connecting to an abstract UNIX socket created by a process outside the
298298 * related Landlock domain (e.g. a parent domain or a non-sandboxed process).
299+ * - %LANDLOCK_SCOPE_SIGNAL: Restrict a sandboxed process from sending a signal
300+ * to another process outside the domain.
299301 */
300302 /* clang-format off */
301303 #define LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET (1ULL << 0)
304+#define LANDLOCK_SCOPE_SIGNAL (1ULL << 1)
302305 /* clang-format on*/
303306
304307 #endif /* _UAPI_LINUX_LANDLOCK_H */