ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
4bff0a
From ee93272cf9915710251704c7bf7c1f1a0b02cb7f Mon Sep 17 00:00:00 2001
4bff0a
From: Frantisek Sumsal <frantisek@sumsal.cz>
4bff0a
Date: Fri, 9 Nov 2018 12:47:30 +0100
4bff0a
Subject: [PATCH] tests: keep SYS_PTRACE when running under ASan
4bff0a
4bff0a
(cherry picked from commit 7a3025658836c536f81fdd742fa338545294f5bf)
4bff0a
4bff0a
Resolves: #1683319
4bff0a
---
4bff0a
 src/test/test-capability.c | 7 ++++++-
4bff0a
 1 file changed, 6 insertions(+), 1 deletion(-)
4bff0a
4bff0a
diff --git a/src/test/test-capability.c b/src/test/test-capability.c
4bff0a
index 72975cef94..20eb877a3c 100644
4bff0a
--- a/src/test/test-capability.c
4bff0a
+++ b/src/test/test-capability.c
4bff0a
@@ -19,8 +19,13 @@
4bff0a
 static uid_t test_uid = -1;
4bff0a
 static gid_t test_gid = -1;
4bff0a
 
4bff0a
+#ifdef __SANITIZE_ADDRESS__
4bff0a
+/* Keep CAP_SYS_PTRACE when running under Address Sanitizer */
4bff0a
+static const uint64_t test_flags = UINT64_C(1) << CAP_SYS_PTRACE;
4bff0a
+#else
4bff0a
 /* We keep CAP_DAC_OVERRIDE to avoid errors with gcov when doing test coverage */
4bff0a
-static uint64_t test_flags = 1ULL << CAP_DAC_OVERRIDE;
4bff0a
+static const uint64_t test_flags = UINT64_C(1) << CAP_DAC_OVERRIDE;
4bff0a
+#endif
4bff0a
 
4bff0a
 /* verify cap_last_cap() against /proc/sys/kernel/cap_last_cap */
4bff0a
 static void test_last_cap_file(void) {