1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

test: add test to make sure that ProtectKernelModules=yes disconnect mount propagation

This commit is contained in:
Djalal Harouni 2016-10-09 12:38:45 +02:00
parent e66a2f658b
commit 4982dbcc30
3 changed files with 11 additions and 2 deletions

View File

@ -1641,6 +1641,7 @@ EXTRA_DIST += \
test/test-execute/exec-privatedevices-yes-capability-mknod.service \
test/test-execute/exec-protectkernelmodules-no-capabilities.service \
test/test-execute/exec-protectkernelmodules-yes-capabilities.service \
test/test-execute/exec-protectkernelmodules-yes-mount-propagation.service \
test/test-execute/exec-privatetmp-no.service \
test/test-execute/exec-privatetmp-yes.service \
test/test-execute/exec-readonlypaths.service \

View File

@ -144,7 +144,7 @@ static void test_exec_privatedevices_capabilities(Manager *m) {
test(m, "exec-privatedevices-no-capability-sys-rawio.service", 0, CLD_EXITED);
}
static void test_exec_protectkernelmodules_capabilities(Manager *m) {
static void test_exec_protectkernelmodules(Manager *m) {
if (detect_container() > 0) {
log_notice("testing in container, skipping protectkernelmodules tests");
return;
@ -152,6 +152,7 @@ static void test_exec_protectkernelmodules_capabilities(Manager *m) {
test(m, "exec-protectkernelmodules-no-capabilities.service", 0, CLD_EXITED);
test(m, "exec-protectkernelmodules-yes-capabilities.service", 0, CLD_EXITED);
test(m, "exec-protectkernelmodules-yes-mount-propagation.service", 0, CLD_EXITED);
}
static void test_exec_readonlypaths(Manager *m) {
@ -380,7 +381,7 @@ int main(int argc, char *argv[]) {
test_exec_privatetmp,
test_exec_privatedevices,
test_exec_privatedevices_capabilities,
test_exec_protectkernelmodules_capabilities,
test_exec_protectkernelmodules,
test_exec_readonlypaths,
test_exec_readwritepaths,
test_exec_inaccessiblepaths,

View File

@ -0,0 +1,7 @@
[Unit]
Description=Test to make sure that passing ProtectKernelModules=yes disconnect mount propagation
[Service]
ProtectKernelModules=yes
ExecStart=/bin/sh -x -c 'mkdir -p /TEST; mount -t tmpfs tmpfs /TEST; grep TEST /proc/self/mountinfo && ! grep TEST /proc/$${PPID}/mountinfo && ! grep TEST /proc/1/mountinfo'
Type=oneshot