On Wed, 21 Feb 2024, Mark Johnston wrote:

MJ>On Wed, Feb 21, 2024 at 09:52:23AM +0000, hartmut.bra...@dlr.de wrote:
MJ>> Hi,
MJ>> 
MJ>> I updated yesterday and now event a minimal program with
MJ>> 
MJ>> cc -fsanitize=address
MJ>> 
MJ>> produces
MJ>> 
MJ>> ld: error: undefined symbol: __elf_aux_vector
MJ>> >>> referenced by sanitizer_linux_libcdep.cpp:950 
(/usr/src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:950)
MJ>> >>>               sanitizer_linux_libcdep.o:(__sanitizer::ReExec()) in 
archive /usr/lib/clang/17/lib/freebsd/libclang_rt.asan-x86_64.a
MJ>> cc: error: linker command failed with exit code 1 (use -v to see 
invocation)
MJ>> 
MJ>> I think this is caused by the libsys split.
MJ>
MJ>I don't see any such problem on a system running 5f7ac491eef4, which
MJ>includes the libsys split.  Which compiler are you using, and which
MJ>revision are you running?

That is 445d3d227e68. The compiler is the system cc.

Harti

MJ>
MJ>> Cheers,
MJ>> Harti
MJ>> 
MJ>> -----Original Message-----
MJ>> From: owner-freebsd-curr...@freebsd.org 
<owner-freebsd-curr...@freebsd.org> On Behalf Of Brooks Davis
MJ>> Sent: Friday, February 2, 2024 11:32 PM
MJ>> To: curr...@freebsd.org
MJ>> Subject: libc/libsys split coming soon
MJ>> 
MJ>> TL;DR: The implementation of system calls is moving to a seperate library 
(libsys).  No changes are required to existing software (except to ensure that 
libsys is present when building custom disk images).
MJ>> 
MJ>> Code: https://github.com/freebsd/freebsd-src/pull/908
MJ>> 
MJ>> After nearly a decade of intermittent work, I'm about to land a series of 
patches which moves system calls, vdso support, and libc's parsing of the ELF 
auxiliary argument vector into a separate library (libsys).  I plan to do this 
early next week (February 5th).
MJ>> 
MJ>> This change serves three primary purposes:
MJ>>   1. It's easier to completely replace system call implementations for
MJ>>      tracing or compartmentalization purposes.
MJ>>   2. It simplifies the implementation of restrictions on system calls such
MJ>>      as those implemented by OpenBSD's msyscall(2)
MJ>>      (https://man.openbsd.org/msyscall.2).
MJ>>   3. It allows language runtimes to link with libsys for system call
MJ>>      implementations without requiring libc.
MJ>> 
MJ>> libsys is an auxiliary filter for libc.  This means that for any symbol 
defined by both, the libsys version takes precedence at runtime.  For system 
call implementations, libc contains empty stubs.  For others it contains copies 
of the functions (this could be further refined at a later date).  The 
statically linked libc contains the full implementations so linking libsys is 
not required.
MJ>> 
MJ>> Additionally, libthr is now linked with libsys to provide _umtx_op_err().
MJ>> 
MJ>> The overall implementation follows https://reviews.freebsd.org/D14609,
MJ>> but is redone from scratch as multiple commits to facilitate review and 
assist git's rename detection.
MJ>> 
MJ>> Testing:
MJ>>   - Boot testing on amd64, aarch64, and riscv
MJ>>   - make tinderbox (prior version, final run in progress)
MJ>>   - exp-run: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276391
MJ>>   - Kyua tests in poudriere amd64 jails: same 359 failures as with the
MJ>>     latest freebsdci build
MJ>> 
MJ>> Thanks to Ali Mashtizadeh and Tal Garfinkel for D14609 and many apologies 
for not landing this in a timely manner.  Additional thanks to kib@ for many 
rounds of review, markj@ and kib@ for debugging rtld issues exposed by this 
patch, and antoine@ for exp-runs.
MJ>> 
MJ>> Future work:
MJ>>   - Purely functional interfaces to system calls (no errorno).
MJ>>     Unfortunately there isn't an obvious way to do this without
MJ>>     significant (possibly generated) assembly code.
MJ>>   - Investigate msyscall(2) and pinsyscalls(2).
MJ>>   - Reduce the size of stubs in libc.  I’ve errored on the
MJ>>     side of not touching the copies that end up in libc to keep diff
MJ>>     size down.  We might want to generate empty stubs instead.
MJ>> 
MJ>> See also:
MJ>>   - Solaris Linker and Libraries Guide:
MJ>>     https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter4-4.html
MJ>> 
MJ>> -- Brooks
MJ>> 
MJ>

Reply via email to