From 347ebd02974ec4d2d7c4a6a388012a223b14583c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 17 Nov 2016 20:57:22 -0500 Subject: [PATCH 1/4] test-process-util: bind mount fails under selinux, skip test --- src/test/test-process-util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index 9ada46b1e9..7242b2c8b5 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -193,7 +193,14 @@ static void test_get_process_cmdline_harder(void) { fd = mkostemp(path, O_CLOEXEC); assert_se(fd >= 0); - assert_se(mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) >= 0); + + if (mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) < 0) { + /* This happens under selinux… Abort the test in this case. */ + log_warning_errno(errno, "mount(..., \"/proc/self/cmdline\", \"bind\", ...) failed: %m"); + assert(errno == EACCES); + return; + } + assert_se(unlink(path) >= 0); assert_se(prctl(PR_SET_NAME, "testa") >= 0); From 041b5ae170fe0b0d49611d26ae09e8438099733f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 17 Nov 2016 20:57:22 -0500 Subject: [PATCH 2/4] basic/process-util: we need to take the shorter of two strings ==30496== Conditional jump or move depends on uninitialised value(s) ==30496== at 0x489F654: memcmp (vg_replace_strmem.c:1091) ==30496== by 0x49BF203: getenv_for_pid (process-util.c:678) ==30496== by 0x4993ACB: detect_container (virt.c:442) ==30496== by 0x182DFF: test_get_process_comm (test-process-util.c:98) ==30496== by 0x185847: main (test-process-util.c:368) ==30496== --- src/basic/process-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 48a5c719af..1f4c2e4e43 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -675,7 +675,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) { } line[i] = 0; - if (memcmp(line, field, l) == 0 && line[l] == '=') { + if (strneq(line, field, l) && line[l] == '=') { value = strdup(line + l + 1); if (!value) return -ENOMEM; From 5c7119f43e8ae91d4310838f7ddd8b05d0eece32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 17 Nov 2016 20:57:22 -0500 Subject: [PATCH 3/4] test-ipcrm: skip test if nfsnobody is missing --- src/test/test-ipcrm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/test-ipcrm.c b/src/test/test-ipcrm.c index 551eba7215..463e135e2b 100644 --- a/src/test/test-ipcrm.c +++ b/src/test/test-ipcrm.c @@ -28,9 +28,11 @@ int main(int argc, char *argv[]) { r = get_user_creds(&name, &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(r, "Failed to resolve \"%s\": %m", name); - return EXIT_FAILURE; + log_full_errno(r == -ESRCH ? LOG_NOTICE : LOG_ERR, + r, "Failed to resolve \"%s\": %m", name); + return r == -ESRCH ? EXIT_TEST_SKIP : EXIT_FAILURE; } - return clean_ipc_by_uid(uid) < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + r = clean_ipc_by_uid(uid); + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } From cf5f9bb8402906d37cdd55e8b06da9c7b5ac06a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 19 Nov 2016 22:45:23 -0500 Subject: [PATCH 4/4] test-functions: also add qemu define for ppc64 --- test/test-functions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test-functions b/test/test-functions index c0128b8b00..fd7c198166 100644 --- a/test/test-functions +++ b/test/test-functions @@ -40,6 +40,9 @@ function find_qemu_bin() { # i386 version of QEMU [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu 2>/dev/null | grep '^/' -m1) ;; + ppc64*) + [ "$QEMU_BIN" ] || QEMU_BIN=$(which -a qemu-system-$ARCH 2>/dev/null | grep '^/' -m1) + ;; esac if [ ! -e "$QEMU_BIN" ]; then