Subject: [PATCH v4 0/6] landlock: Signal scoping support

From: Tahera Fahimi <[email-masked]>
Date: Fri, 6 Sep 2024 15:30:02 -0600

This patch series adds scoping mechanism for signals.
Closes: https://github.com/landlock-lsm/linux/issues/8

Problem
=======

A sandboxed process is currently not restricted from sending signals
(e.g. SIGKILL) to processes outside the sandbox since Landlock has no
restriction on signals(see more details in [1]).

A simple way to apply this restriction would be to scope signals the
same way abstract unix sockets are restricted.

[1]https://lore.kernel.org/all/[email-masked]/

Solution
========

To solve this issue, we extend the "scoped" field in the Landlock
ruleset attribute structure by introducing "LANDLOCK_SCOPED_SIGNAL"
field to specify that a ruleset will deny sending any signals from
within the sandbox domain to its parent(i.e. any parent sandbox or
non-sandbox processes).

Example
=======

Create a sansboxed shell and pass the character "s" to LL_SCOPED:
LL_FD_RO=/ LL_FS_RW=. LL_SCOPED="s" ./sandboxer /bin/bash
Try to send a signal(like SIGTRAP) to a process ID <PID> through:
kill -SIGTRAP <PID>
The sandboxed process should not be able to send the signal.

Previous Versions
=================
v3:https://lore.kernel.org/all/[email-masked]/
v2:https://lore.kernel.org/all/[email-masked]/
v1:https://lore.kernel.org/all/[email-masked]/

Tahera Fahimi (6):
  landlock: Add signal scoping control
  selftest/landlock: Signal restriction tests
  selftest/landlock: Add signal_scoping_threads test
  selftest/landlock: Test file_send_sigiotask by sending out-of-bound
    message
  sample/landlock: Support sample for signal scoping restriction
  landlock: Document LANDLOCK_SCOPED_SIGNAL

 Documentation/userspace-api/landlock.rst      |  22 +-
 include/uapi/linux/landlock.h                 |   3 +
 samples/landlock/sandboxer.c                  |  17 +-
 security/landlock/fs.c                        |  17 +
 security/landlock/fs.h                        |   6 +
 security/landlock/limits.h                    |   2 +-
 security/landlock/task.c                      |  59 +++
 .../selftests/landlock/scoped_signal_test.c   | 371 ++++++++++++++++++
 .../testing/selftests/landlock/scoped_test.c  |   2 +-
 9 files changed, 486 insertions(+), 13 deletions(-)
 create mode 100644 tools/testing/selftests/landlock/scoped_signal_test.c

-- 
2.34.1