Bruno Haible <[email protected]> writes:
> Collin Funk wrote:
>> $ ./configure CFLAGS='-fsanitize=address,undefined' && make check
>
> The CI uses these environment variables:
>
> export CC="clang
> -fsanitize=address,undefined,signed-integer-overflow,shift,integer-divide-by-zero
> -fno-sanitize-recover=undefined"
> export CFLAGS="-O0 -fno-omit-frame-pointer -ggdb"
> export ASAN_OPTIONS="detect_leaks=0 abort_on_error=1
> allocator_may_return_null=1"
I think I see what happens. The lines that cause the issue:
# if __GLIBC__ >= 2
/* Arrange for the inline definition of getline() in <bits/stdio.h>
to call our getdelim() override. */
# define rpl_getdelim __getdelim
# endif
If you go into gdb and set a break point at __getdelim and continue you
will end up at __interceptor_trampoline___getdelim. I guess __getdelim
is a weak symbol when ASAN is used.
How about the attached patch to avoid the symbol when glibc is used but
it is not using extern inlines? It works with my machine with
'clang -O3 -fsanitize=address', so I assume optimizations are disabled
once '-fsanitize' is used.
Collin
>From 0778a7a55b0bca00ba8803cdcfcb1cf2ed955cc1 Mon Sep 17 00:00:00 2001
Message-ID: <0778a7a55b0bca00ba8803cdcfcb1cf2ed955cc1.1760409712.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Mon, 13 Oct 2025 18:58:46 -0700
Subject: [PATCH] getdelim: Avoid the symbol __getdelim with ASAN (regr.
2025-10-10).
* lib/stdio.in.h (rpl_getdelim)
[!(__GLIBC__ >= 2 && defined __USE_EXTERN_INLINES]: Don't define to
__getdelim so that ___interceptor_getdelim doesn't override our symbol.
---
ChangeLog | 7 +++++++
lib/stdio.in.h | 6 ++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0e01db0789..530a8e6a69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-10-13 Collin Funk <[email protected]>
+
+ getdelim: Avoid the symbol __getdelim with ASAN (regr. 2025-10-10).
+ * lib/stdio.in.h (rpl_getdelim)
+ [!(__GLIBC__ >= 2 && defined __USE_EXTERN_INLINES]: Don't define to
+ __getdelim so that ___interceptor_getdelim doesn't override our symbol.
+
2025-10-13 Bruno Haible <[email protected]>
getline: Fix compilation error in C++ mode (regression 2025-10-10).
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 2c70bc049f..6d3c3acffb 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1044,9 +1044,11 @@ _GL_CXXALIASWARN (getchar);
# undef getdelim
# define getdelim rpl_getdelim
# endif
-# if __GLIBC__ >= 2
+# if __GLIBC__ >= 2 && defined __USE_EXTERN_INLINES
/* Arrange for the inline definition of getline() in <bits/stdio.h>
- to call our getdelim() override. */
+ to call our getdelim() override. Only use it if __USE_EXTERN_INLINES is
+ defined otherwise ___interceptor_getdelim might override __getdelim when
+ -fsanitize=address is in use. */
# define rpl_getdelim __getdelim
# endif
_GL_FUNCDECL_RPL (getdelim, ssize_t,
--
2.51.0