RE: [PATCH 1/5] glibc: Perform rseq(2) registration at C startup and thread creation (v10)

From: David Laight
Date: Fri Jun 14 2019 - 09:34:19 EST


From: Mathieu Desnoyers
> Sent: 14 June 2019 14:02
...
> But my original issue remains: if I define a variable called __rseq_handled
> within either the main executable or the preloaded library, it overshadows
> the libc one:

1) That is the was elf symbol resolution is required to work.
Otherwise variables like 'errno' (non-thread safe form) wouldn't work.

2) Don't do it then :-)
Names starting with __ will be reserved (probably 'for the implementation').

The real 'fun' starts because, under some circumstances, looking up a symbol as:
foo = dlsym(lib_handle, "foo");
Can find the data item instead of the function!
Usually it works (even when foo is global data) because 'lib_handle' refers
to a different symbol table.
But it can go horribly wrong.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)