summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2018-11-09 12:47:30 +0100
committerLukáš Nykrýn <lnykryn@redhat.com>2019-05-03 13:00:29 +0200
commitee93272cf9915710251704c7bf7c1f1a0b02cb7f (patch)
treee8cd4369e1f1c9d69f71a512e88619714e96e2cc
parentd84b1c62b9739e9c043a717aecec2da181eb9df7 (diff)
downloadsystemd-ee93272cf9915710251704c7bf7c1f1a0b02cb7f.tar.gz
tests: keep SYS_PTRACE when running under ASan
(cherry picked from commit 7a3025658836c536f81fdd742fa338545294f5bf) Resolves: #1683319
-rw-r--r--src/test/test-capability.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/test-capability.c b/src/test/test-capability.c
index 72975cef94..20eb877a3c 100644
--- a/src/test/test-capability.c
+++ b/src/test/test-capability.c
@@ -19,8 +19,13 @@
static uid_t test_uid = -1;
static gid_t test_gid = -1;
+#ifdef __SANITIZE_ADDRESS__
+/* Keep CAP_SYS_PTRACE when running under Address Sanitizer */
+static const uint64_t test_flags = UINT64_C(1) << CAP_SYS_PTRACE;
+#else
/* We keep CAP_DAC_OVERRIDE to avoid errors with gcov when doing test coverage */
-static uint64_t test_flags = 1ULL << CAP_DAC_OVERRIDE;
+static const uint64_t test_flags = UINT64_C(1) << CAP_DAC_OVERRIDE;
+#endif
/* verify cap_last_cap() against /proc/sys/kernel/cap_last_cap */
static void test_last_cap_file(void) {