1
linux/samples
Tahera Fahimi 369b48b43a
samples/landlock: Add support for abstract UNIX socket scoping
The sandboxer can receive the character "a" as input from the
environment variable LL_SCOPE to restrict sandboxed processes from
connecting to an abstract UNIX socket created by a process outside of
the sandbox.

Example
=======

Create an abstract UNIX socket to listen with socat(1):
  socat abstract-listen:mysocket -

Create a sandboxed shell and pass the character "a" to LL_SCOPED:
  LL_FS_RO=/ LL_FS_RW=. LL_SCOPED="a" ./sandboxer /bin/bash

Note that any other form of input (e.g. "a:a", "aa", etc) is not
acceptable.

If the sandboxed process tries to connect to the listening socket, the
connection will fail:
  socat - abstract-connect:mysocket

Signed-off-by: Tahera Fahimi <fahimitahera@gmail.com>
Link: https://lore.kernel.org/r/d8af908f00b77415caa3eb0f4de631c3794e4909.1725494372.git.fahimitahera@gmail.com
[mic: Improve commit message, simplify check_ruleset_scope() with
inverted error code and only one scoped change, always unset environment
variable]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
2024-09-16 23:50:51 +02:00
..
acrn virt: acrn: Fix typos 2024-05-04 18:59:44 +02:00
auxdisplay
binderfs
bpf bpf-next-for-netdev 2024-05-28 07:27:29 -07:00
cgroup
configfs samples: configfs: add missing MODULE_DESCRIPTION() macro 2024-07-10 14:59:01 +02:00
connector .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
coresight
fanotify
fprobe fprobe: add missing MODULE_DESCRIPTION() macro 2024-06-12 08:44:27 +09:00
ftrace
hid HID: samples: fix the 2 struct_ops definitions 2024-07-05 14:08:31 +02:00
hidraw
hw_breakpoint samples/hw_breakpoint: mark sample_hbp as static 2023-07-26 11:17:19 -07:00
kdb
kfifo kfifo: add missing MODULE_DESCRIPTION() macros 2024-06-28 19:36:29 -07:00
kmemleak kmemleak-test: add missing MODULE_DESCRIPTION() macro 2024-07-03 19:30:04 -07:00
kobject samples/kobject: add missing MODULE_DESCRIPTION() macros 2024-06-04 18:04:28 +02:00
kprobes samples: kprobes: add missing MODULE_DESCRIPTION() macros 2024-06-12 08:44:27 +09:00
landlock samples/landlock: Add support for abstract UNIX socket scoping 2024-09-16 23:50:51 +02:00
livepatch
mei
nitro_enclaves
pfsm
pidfd
pktgen
qmi samples: qmi: Convert to platform remove callback returning void 2024-05-27 10:14:15 +02:00
rpmsg
rust rust: sync: update Arc and UniqueArc to take allocation flags 2024-04-16 22:50:04 +02:00
seccomp
timers
trace_events treewide: remove unnecessary <linux/version.h> inclusion 2024-08-12 18:36:44 +09:00
trace_printk samples/trace_printk: Wait for IRQ work to finish 2019-12-21 16:08:22 -05:00
uhid kbuild: introduce hostprogs-always-y and userprogs-always-y 2020-08-10 01:32:59 +09:00
user_events
v4l media updates for v6.8-rc1 2024-01-12 14:29:48 -08:00
vfio-mdev vfio-mdev: add missing MODULE_DESCRIPTION() macros 2024-07-17 12:24:13 -06:00
vfs .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
watch_queue
watchdog
Kconfig samples: introduce new samples subdir for cgroup 2023-12-10 16:51:54 -08:00
Makefile samples: introduce new samples subdir for cgroup 2023-12-10 16:51:54 -08:00