[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <512441263.43096.1560350163180.JavaMail.zimbra@efficios.com>
Date: Wed, 12 Jun 2019 10:36:03 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Florian Weimer <fweimer@...hat.com>
Cc: carlos <carlos@...hat.com>, Joseph Myers <joseph@...esourcery.com>,
Szabolcs Nagy <szabolcs.nagy@....com>,
libc-alpha <libc-alpha@...rceware.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ben Maurer <bmaurer@...com>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
Will Deacon <will.deacon@....com>,
Dave Watson <davejwatson@...com>, Paul Turner <pjt@...gle.com>,
Rich Felker <dalias@...c.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-api <linux-api@...r.kernel.org>
Subject: Re: [PATCH 1/5] glibc: Perform rseq(2) registration at C startup
and thread creation (v10)
----- On Jun 12, 2019, at 4:22 PM, Florian Weimer fweimer@...hat.com wrote:
> * Mathieu Desnoyers:
>
>>> It's the registration from libc.so which needs some care. In
>>> particular, we must not override an existing registration.
>>
>> OK, so it could check if __rseq_abi.cpu_id is -1, and only
>> perform registration if it is the case. Or do you have another
>> approach in mind ?
>
> No, __rseq_abi will not be shared with the outer libc, so the inner libc
> will always see -1 there, even if the outer libc has performed
> registration.
>
> libio/vtables.c has some example what you can do:
>
> /* In case this libc copy is in a non-default namespace, we always
> need to accept foreign vtables because there is always a
> possibility that FILE * objects are passed across the linking
> boundary. */
> {
> Dl_info di;
> struct link_map *l;
> if (!rtld_active ()
> || (_dl_addr (_IO_vtable_check, &di, &l, NULL) != 0
> && l->l_ns != LM_ID_BASE))
> return;
> }
>
> _IO_vtable_check would have to be replaced with your own function; the
> actual function doesn't really matter.
>
> The rtld_active check covers the static dlopen case, where
> rtld_active () is false in the inner libc.
Then out of curiosity, would it also work if I check for
if (!__libc_multiple_libcs)
in LIBC_START_MAIN ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists