This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] RFC: avoid cancellable I/O primitives in ld.so
On Tue, Apr 3, 2018 at 10:18 PM, Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> On 03/04/2018 22:43, Zack Weinberg wrote:
>> Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor
>> initial shared library load-up, are cancellation points, so ld.so
>> should exclusively use I/O primitives that are not cancellable; in
>> addition to streamlining low-level operations, this means we do not
>> require a copy of nptl/unwind.c in ld.so.
>>
>> The bulk of the change is splitting up the files that define the
>> _nocancel I/O functions, so they don't also define the variants that
>> *are* cancellation points; after which, the existing logic for picking
>> out the bits of libc that need to be recompiled as part of ld.so Just
>> Works. I did this for all of the _nocancel functions, not just the
>> ones used by ld.so, for consistency.
>>
>
> There is no need to call *_cancel primitives in loader, rtld-* objects
> will built with both LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET being dummy
> values:
...
> So why do you need to explicit call *_cancel symbols?
The Makefile logic for deciding which libc objects will be recompiled
as part of librtld.a does not know this, so libc-cancellation.c,
unwind.c, and unwind-forcedunwind.c get dragged into ld.so
unnecessarily. It's nearly 2KB of dead machine code on x86-64 and
it's also interfering with my attempts to minimize the number of
symbols defined in more than one of ld.so, libc.so, and libpthread.so.
If we stick to using explicit _nocancel symbols in the loader, and
they are all defined in their own files, then these unnecessary
objects are not included.
zw