Re: [PATCH] build: allow turning off --no-undefined and -z,defs

2021-12-04 Thread Florian Weimer via Elfutils-devel
* Evgeny Vereshchagin: > ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined > and -z,defs: > https://clang.llvm.org/docs/AddressSanitizer.html#usage > https://github.com/google/sanitizers/issues/380 > so to build elfutils with clang with the sanitizers it should be possi

[PATCH v2] build: allow turning off --no-undefined and -z,defs

2021-12-04 Thread Evgeny Vereshchagin
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs: https://clang.llvm.org/docs/AddressSanitizer.html#usage https://github.com/google/sanitizers/issues/380 so to build elfutils with clang with the sanitizers it should be possible to turn them off. Without thi

Re: [PATCH v2] build: allow turning off --no-undefined and -z,defs

2021-12-04 Thread Mark Wielaard
Hi Evgeny, On Fri, Dec 03, 2021 at 02:17:21PM +, Evgeny Vereshchagin wrote: > ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined > and -z,defs: > https://clang.llvm.org/docs/AddressSanitizer.html#usage > https://github.com/google/sanitizers/issues/380 > so to build e

[PATCH] readelf: Workaround stringop-truncation error

2021-12-04 Thread Mark Wielaard
In function ‘strncpy’, inlined from ‘print_ehdr’ at readelf.c:1175:4: error: ‘__builtin_strncpy’ specified bound 512 equals destination size [-Werror=stringop-truncation] strncpy doesn't terminate the copied string if there is not enough room. We compensate later by explicitly adding a

[PATCH] tests: varlocs workaround format-overflow errors

2021-12-04 Thread Mark Wielaard
In function ‘printf’, inlined from ‘handle_attr’ at varlocs.c:932:3: error: ‘%s’ directive argument is null [-Werror=format-overflow=] The warning is technically correct. A %s argument should not be NULL. Although in practice all implementations will print it as "(null)". Workaround this by si

[PATCH] debuginfod: Fix debuginfod_pool leak

2021-12-04 Thread Mark Wielaard
gcc address sanitizer detected a dangling debuginfod_client handler when debuginfod exits. Make sure to groom the debuginfod client pool before exit after all threads are done. Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 4 debuginfod/debuginfod.cxx | 2 ++ 2 files changed,

[PATCH] debuginfod: sqlite3_sharedprefix_fn should not compare past end of string

2021-12-04 Thread Mark Wielaard
gcc address sanitizer detected a read after the end of string in sqlite3_sharedprefix_fn. Make sure to stop comparing the strings when seeing the zero terminator. Signed-off-by: Mark Wielaard --- debuginfod/debuginfod.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debugi

[PATCH] debuginfod: Clear and reset debuginfod_client winning_headers on reuse

2021-12-04 Thread Mark Wielaard
gcc address sanitizer detected a leak of the debuginfod_client winning_headers when the handle was reused. Make sure to free and reset the winning_headers field before reuse. Signed-off-by: Mark Wielaard --- debuginfod/ChangeLog | 5 + debuginfod/debuginfod-client.c | 7 ++- 2

[PATCH v3] build: allow turning off --no-undefined and -z,defs

2021-12-04 Thread Evgeny Vereshchagin
ASan, UBSan and MSan provided by clang aren't compatible with --no-undefined and -z,defs: https://clang.llvm.org/docs/AddressSanitizer.html#usage https://github.com/google/sanitizers/issues/380 so to build elfutils with clang with the sanitizers it should be possible to turn them off. It's implem

[PATCH] configure: Add --enable-sanitize-address

2021-12-04 Thread Mark Wielaard
--enable-sanitize-address makes sure that all code is compiled with -fsanitizer=address and all tests run against libasan. It can be combined with --enable-sanitize-undefined, but not with --enable-valgrind. In maintainer mode there is one program that causes leaks, i386_gendis, so disable leak d