From a07cc00bb0e6d971375790555ea021c53520a21d Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 22 Sep 2026 23:45:41 +0200 Subject: [PATCH] test: restore dumpable flag after setuid drop so LSan can run under ASan --- tests/test_file.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_file.c b/tests/test_file.c index 744ec6d..7958687 100644 --- a/tests/test_file.c +++ b/tests/test_file.c @@ -21,6 +21,9 @@ #include #include #include +#ifdef __linux__ +#include +#endif #include static void test_file_create() { @@ -1414,8 +1417,15 @@ static void test_device_mknod_failure_is_per_entry() { if (saved == 0 && seteuid(65534) == 0) dropped = true; FileSaveResult result = file_save_to_disk_full(root, f, cfg); - if (dropped) + if (dropped) { EXPECT_EQ_INT(seteuid(saved), 0); +#ifdef __linux__ + /* A setuid transition clears the process dumpable flag, which makes + * LeakSanitizer's ptrace-based thread suspension fail at exit. Restore it + * so the ASan/UBSan CI jobs can still run the leak check. */ + (void)prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); +#endif + } EXPECT_EQ_INT(result, FILE_SAVE_FAILED); /* Nothing was created: no device node and no regular-file fallback. */