From c090d74dd974994552f1a29a2d65400f0c07dd9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Thu, 25 May 2017 06:47:08 +0200 Subject: [PATCH] test: ensure 'InaccessiblePaths=/proc' option works (#6017) Test case for PR #5985. --- Makefile.am | 1 + src/test/test-execute.c | 5 +++++ test/meson.build | 1 + test/test-execute/exec-inaccessiblepaths-proc.service | 7 +++++++ 4 files changed, 14 insertions(+) create mode 100644 test/test-execute/exec-inaccessiblepaths-proc.service diff --git a/Makefile.am b/Makefile.am index 1cbb278c68..e95cbe4b97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1737,6 +1737,7 @@ TEST_DATA_FILES += \ test/test-execute/exec-readonlypaths-mount-propagation.service \ test/test-execute/exec-readwritepaths-mount-propagation.service \ test/test-execute/exec-inaccessiblepaths-mount-propagation.service \ + test/test-execute/exec-inaccessiblepaths-proc.service \ test/test-execute/exec-spec-interpolation.service \ test/test-execute/exec-systemcallerrornumber.service \ test/test-execute/exec-systemcallfilter-failing2.service \ diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 90540b884b..2dfa90ed19 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -233,6 +233,10 @@ static void test_exec_inaccessiblepaths(Manager *m) { test(m, "exec-inaccessiblepaths-mount-propagation.service", 0, CLD_EXITED); } +static void test_exec_inaccessiblepaths_proc(Manager *m) { + test(m, "exec-inaccessiblepaths-proc.service", 0, CLD_EXITED); +} + static void test_exec_systemcallfilter(Manager *m) { #ifdef HAVE_SECCOMP if (!is_seccomp_available()) @@ -479,6 +483,7 @@ int main(int argc, char *argv[]) { test_exec_readonlypaths, test_exec_readwritepaths, test_exec_inaccessiblepaths, + test_exec_inaccessiblepaths_proc, test_exec_privatenetwork, test_exec_systemcallfilter, test_exec_systemcallerrornumber, diff --git a/test/meson.build b/test/meson.build index b7fb507c9c..55e693ac72 100644 --- a/test/meson.build +++ b/test/meson.build @@ -85,6 +85,7 @@ test_data_files = ''' test-execute/exec-readonlypaths-mount-propagation.service test-execute/exec-readwritepaths-mount-propagation.service test-execute/exec-inaccessiblepaths-mount-propagation.service + test-execute/exec-inaccessiblepaths-proc.service test-execute/exec-spec-interpolation.service test-execute/exec-systemcallerrornumber.service test-execute/exec-systemcallfilter-failing2.service diff --git a/test/test-execute/exec-inaccessiblepaths-proc.service b/test/test-execute/exec-inaccessiblepaths-proc.service new file mode 100644 index 0000000000..ebdb4843d1 --- /dev/null +++ b/test/test-execute/exec-inaccessiblepaths-proc.service @@ -0,0 +1,7 @@ +[Unit] +Description=Test to make sure that mount namespace setup works properly with the 'InaccessiblePaths=/proc' option + +[Service] +InaccessiblePaths=/proc +ExecStart=/bin/sh -x -c 'test "$$(stat -c %%a /proc)" = "0"' +Type=oneshot