systemd/test/fuzz/fuzz-unit-file
Jakub Sitnicki 97df75d7bd socket: pass socket FDs to all ExecXYZ= commands but ExecStartPre=
Today listen file descriptors created by socket unit don't get passed to
commands in Exec{Start,Stop}{Pre,Post}= socket options.

This prevents ExecXYZ= commands from accessing the created socket FDs to do
any kind of system setup which involves the socket but is not covered by
existing socket unit options.

One concrete example is to insert a socket FD into a BPF map capable of
holding socket references, such as BPF sockmap/sockhash [1] or
reuseport_sockarray [2]. Or, similarly, send the file descriptor with
SCM_RIGHTS to another process, which has access to a BPF map for storing
sockets.

To unblock this use case, pass ListenXYZ= file descriptors to ExecXYZ=
commands as listen FDs [4]. As an exception, ExecStartPre= command does not
inherit any file descriptors because it gets invoked before the listen FDs
are created.

This new behavior can potentially break existing configurations. Commands
invoked from ExecXYZ= might not expect to inherit file descriptors through
sd_listen_fds protocol.

To prevent breakage, add a new socket unit parameter,
PassFileDescriptorsToExec=, to control whether ExecXYZ= programs inherit
listen FDs.

[1] https://docs.kernel.org/bpf/map_sockmap.html
[2] https://lore.kernel.org/r/20180808075917.3009181-1-kafai@fb.com
[3] https://man.archlinux.org/man/socket.7#SO_INCOMING_CPU
[4] https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
2024-03-27 01:41:26 +08:00
..
ask-password-console.path test: shorten sample names, drop numerical prefixes 2023-09-02 17:32:19 +03:00
binfmt_misc.automount test: shorten sample names, drop numerical prefixes 2023-09-02 17:32:19 +03:00
directives-all.service socket: pass socket FDs to all ExecXYZ= commands but ExecStartPre= 2024-03-27 01:41:26 +08:00
dm-back\x2dslash.swap fuzz: rename long samples 2023-05-18 15:23:27 +02:00
empty.scope
github-19178 fuzzer: add a test case for #19178 2021-04-03 10:38:06 +01:00
machine.slice license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
oss-fuzz-6884 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6885 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6886 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6892 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6897 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6897-evverx fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6908 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6917 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6977 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-6977-unminimized fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-7004 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-8064 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-8827 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-10007 fuzz: unify the "fuzz-regressions" directory with the main corpus 2018-10-02 09:41:25 +02:00
oss-fuzz-11569 fuzz-unit-file: add one more test case 2018-12-10 11:57:26 +01:00
oss-fuzz-13125 shared/calendarspec: do not allocate a big string on stack 2019-02-16 23:31:07 +01:00
oss-fuzz-32991 core: fix memleak of ipc_namespace_path 2021-04-07 22:12:50 +01:00
oss-fuzz-33270 core: fix crash in BPFProgram parsing 2021-05-05 17:15:04 +02:00
oss-fuzz-33876 core: fix crash in parsing of SocketBind{Allow,Deny}= 2021-05-05 17:14:58 +02:00
syslog.socket license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
systemd-machined.service tree-wide: replace obsolete wiki links with systemd.io/manpages 2022-05-21 14:29:14 +02:00
systemd-resolved.service tree-wide: replace obsolete wiki links with systemd.io/manpages 2022-05-21 14:29:14 +02:00
timers.target license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
tmpfiles-clean.timer test: shorten sample names, drop numerical prefixes 2023-09-02 17:32:19 +03:00
var-lib-machines.mount license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00