Re: sanitizers broken (was RE: libc/libsys split coming soon)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Wed, 21 Feb 2024 17:02:36 UTC
On Feb 21, 2024, at 08:38, Mark Millard <marklmi@yahoo.com> wrote:

> Mark Johnston <markj_at_freebsd.org> wrote on
> Date: Wed, 21 Feb 2024 13:33:43 UTC :
> 
>> On Wed, Feb 21, 2024 at 09:52:23AM +0000, Hartmut.Brandt@dlr.de wrote:
>>> Hi,
>>> 
>>> I updated yesterday and now event a minimal program with
>>> 
>>> cc -fsanitize=address
>>> 
>>> produces
>>> 
>>> ld: error: undefined symbol: __elf_aux_vector
>>>>>> referenced by sanitizer_linux_libcdep.cpp:950 (/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:950)
>>>>>> sanitizer_linux_libcdep.o:(__sanitizer::ReExec()) in archive /usr/lib/clang/17/lib/freebsd/libclang_rt.asan-x86_64.a
>>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>>> 
>>> I think this is caused by the libsys split.
>> 
>> I don't see any such problem on a system running 5f7ac491eef4, which
>> includes the libsys split. Which compiler are you using, and which
>> revision are you running?
> 
> Trivial to reproduce via pkgbase install/upgrade:
> 
> # uname -apKU
> FreeBSD aarch64-main-pkgs 15.0-CURRENT FreeBSD 15.0-CURRENT main-n268410-445d3d227e68 GENERIC-NODEBUG arm64 aarch64 1500014 1500014

Gack: pkgbase does not have the kernel and world at the same place
relative to git commits of source code. See my note from yesterday:

https://lists.freebsd.org/archives/freebsd-pkgbase/2024-February/000319.html

Looking at /usr/src/tests/sys/kern/sigsys.c in this pkgbse context
shows the content from about 10 hours after 445d3d227e68's commit:

git: e53b83a849e3 - main - tests/sigsys: initialize parameter passed to sysctlbyname() Gleb Smirnoff
(CommitDate: 2024-02-20 22:37:45 +0000)

(Note: The next commit's source was not present.)


> # more main.c
> int main(void) { return 0; }
> 
> # cc -fsanitize=address main.c
> ld: error: undefined symbol: __elf_aux_vector
>>>> referenced by sanitizer_linux_libcdep.cpp:950 (/home/bapt/worktrees/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:950)
>>>>              sanitizer_linux_libcdep.o:(__sanitizer::ReExec()) in archive /usr/lib/clang/17/lib/freebsd/libclang_rt.asan-aarch64.a
>>>> referenced by sanitizer_linux_libcdep.cpp:950 (/home/bapt/worktrees/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:950)
>>>>              sanitizer_linux_libcdep.o:(__sanitizer::ReExec()) in archive /usr/lib/clang/17/lib/freebsd/libclang_rt.asan-aarch64.a
> cc: error: linker command failed with exit code 1 (use -v to see invocation)

I do not see the issue in my (somehwat older) personal builds:

# uname -apKU
you have mail
FreeBSD CA72-16Gp-ZFS 15.0-CURRENT FreeBSD 15.0-CURRENT #134 main-n268363-8b67c670a49b-dirty: Sat Feb 17 16:22:31 PST 2024     root@CA72-16Gp-ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA72 arm64 aarch64 1500014 1500014

(Here kernel and world match git hashes: 8b67c670a49b . But
my personal builds have patches and other tailoring relative
to the official git hash they are based on.)

===
Mark Millard
marklmi at yahoo.com