core: serialize device cgroup bpf progs across daemon-reload/reexec
Follows what was done in b57d752326 and
adds a test that verifies the device BPF program is not detached during
reload/reexec.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Service that uses device isolation
|
||||
|
||||
[Service]
|
||||
DevicePolicy=strict
|
||||
DeviceAllow=/dev/null r
|
||||
StandardOutput=file:/tmp/testsuite66serviceresults
|
||||
ExecStartPre=rm -f /tmp/testsuite66serviceresults
|
||||
ExecStart=/bin/bash -c "while true; do sleep 0.01 && echo meow > /dev/null && echo thisshouldnotbehere; done"
|
||||
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=TESTSUITE-66-DEVICEISOLATION
|
||||
|
||||
[Service]
|
||||
ExecStartPre=rm -f /failed /testok
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=oneshot
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eux
|
||||
set -o pipefail
|
||||
|
||||
RESULTS_FILE=/tmp/testsuite66serviceresults
|
||||
|
||||
systemd-analyze log-level debug
|
||||
systemd-analyze log-target console
|
||||
|
||||
systemctl start testsuite-66-deviceisolation.service
|
||||
|
||||
sleep 5
|
||||
grep -q "Operation not permitted" "$RESULTS_FILE"
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl daemon-reexec
|
||||
|
||||
systemctl stop testsuite-66-deviceisolation.service
|
||||
|
||||
grep -q "thisshouldnotbehere" "$RESULTS_FILE" && exit 42
|
||||
|
||||
systemd-analyze log-level info
|
||||
|
||||
echo OK >/testok
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user