diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-05-22 23:36:44 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-05-26 04:50:08 +0200 |
commit | a60f96fcf55c3452e5b13d6daec537af1909eda3 (patch) | |
tree | a9d1d2ccbc3bcc8dae98443b4cb613c109a00ff6 /test | |
parent | core/unit: drop doubled empty line (diff) | |
download | systemd-a60f96fcf55c3452e5b13d6daec537af1909eda3.tar.xz systemd-a60f96fcf55c3452e5b13d6daec537af1909eda3.zip |
core/unit: make JoinsNamespaceOf= implies the inverse dependency
Previously, even if a.service has JoinsNamespaceOf=b.service, the
inverse direction of reference was not introduced.
Hence, a.service is started earlier than b.service, the namespace will
not shared with b.service.
Also, even if a.service had the reference to b.service, b.service did not.
If b.service is freed earlier, then unit_clear_dependencies() does not clear
the reference from a to b, and will cause use-after-free on unit_free() for
a.service.
Let's make JoinsNamespaceOf=b.service in a.service implies the inverse
dependency, i.e. JoinsNamespaceOf=a.service for b.service. Then, we can safely
free b.service.
Diffstat (limited to 'test')
3 files changed, 3 insertions, 3 deletions
diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service index 80594ccba2..c3d316bfa2 100644 --- a/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service @@ -3,4 +3,4 @@ Type=oneshot MountAPIVFS=yes PrivateTmp=yes -ExecStart=test ! -e /tmp/shared-private-file +ExecStart=test -e /tmp/shared-private-file diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service index f3ec0668de..42053b99f8 100644 --- a/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service @@ -4,6 +4,6 @@ Type=notify NotifyAccess=all MountAPIVFS=yes PrivateTmp=yes -ExecStartPre=test ! -e /tmp/shared-private-file-x +ExecStartPre=test -e /tmp/shared-private-file-x ExecStartPre=test ! -e /tmp/hoge ExecStart=/bin/bash -c 'touch /tmp/shared-private-file-y && systemd-notify --ready && sleep infinity' diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service index 01de7f9054..a50a7fcdc2 100644 --- a/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service @@ -7,5 +7,5 @@ Type=oneshot MountAPIVFS=yes PrivateTmp=yes ExecStart=test ! -e /tmp/shared-private-file-x -ExecStart=test -e /tmp/shared-private-file-y +ExecStart=test ! -e /tmp/shared-private-file-y ExecStart=test ! -e /tmp/hoge |