]> git.ipfire.org Git - thirdparty/systemd.git/commit
test-bpf-restrict-fs: skip if manager startup fails due to lack of privileges (#43202)
authorEric Curtin <eric.curtin@docker.com>
Wed, 29 Jul 2026 02:46:05 +0000 (03:46 +0100)
committerGitHub <noreply@github.com>
Wed, 29 Jul 2026 02:46:05 +0000 (11:46 +0900)
commitd47b07d05fd596cb539da01981ae08be141013bd
treec1bf5e1b024442eebc57036742c5ae03f01599de
parentb8968c492108506952ab2748c4a44ce32fc9477c
test-bpf-restrict-fs: skip if manager startup fails due to lack of privileges (#43202)

test-bpf-restrict-fs.c creates a Manager with RUNTIME_SCOPE_SYSTEM, which
tries to set up the real system runtime directory hierarchy (e.g. create
/run/systemd/), and that requires privileges the test process may not
have (e.g. unprivileged sandboxed builders such as OBS).

Previously this was masked because bpf_restrict_fs_supported() did a
trial open/load/attach of the BPF program itself, which also requires
elevated privileges and so failed first, causing the test to skip
before ever reaching manager_new()/manager_startup(). Since
bpf_restrict_fs_supported() no longer does that trial load, the test
now reaches manager_new()/manager_startup() in these unprivileged
environments and hard-fails instead of skipping, e.g.:

  Assertion failed: Expected "manager_startup(m, NULL, NULL, NULL, NULL)"
  to succeed, but got error: -13/EACCES

Use the same manager_errno_skip_test() pattern already used by other
tests (test-engine.c, test-execute.c, test-path.c, ...) to skip
gracefully when manager_new() or manager_startup() fail due to missing
privileges, instead of asserting.

Follow-up for c99678eedaad88defe440d6102952926a61e72cf.
src/test/test-bpf-restrict-fs.c