lkml.org 
[lkml]   [2019]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/5] glibc: Perform rseq(2) registration at C startup and thread creation (v10)
Date
* Mathieu Desnoyers:

> Should we plan ahead for such scheme to override which library "owns" rseq
> registration from a LD_PRELOAD library ? If so, then we would want glibc to
> set __rseq_handled _after_ LD_PRELOAD ctors are executed.

I don't think so. The LD_PRELOAD phase is not clearly delineated from
the non-preload phase. So it's not clear to me what this would even
mean in practice.

Let me ask the key question again: Does it matter if code observes the
rseq area first without kernel support, and then with kernel support?
If we don't expect any problems immediately, we do not need to worry
much about the constructor ordering right now. I expect that over time,
fixing this properly will become easier.

>> The final remaining case is static dlopen. There is a copy of ld.so on
>> the dynamic side, but it is completely inactive and has never run. I do
>> not think we need to support that because multi-threading does not work
>> reliably in this scenario, either. However, we should skip rseq
>> registration in a nested libc (see the rtld_active function).
>
> So for SHARED, if (!rtld_active ()), we should indeed leave the state of
> __rseq_handled as it is, because we are within a nested inactive ld.so.

I think we should add __rseq_handled initialization to ld.so, so it will
only run once, ever.

It's the registration from libc.so which needs some care. In
particular, we must not override an existing registration.

Thanks,
Florian

\
 
 \ /
  Last update: 2019-06-06 13:58    [W:0.081 / U:14.036 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site