This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to implement a kernel feature check in the crt* files?
Roland McGrath wrote:
But it would still be necessary to recognize that situation in order to
prevent the check from being executed since accessing the ELF header field
would segfault. The only way I see is to compare the AT_ENTRY field with
the _start address which basically tells you if the current auxv does belong
to the executable or not.
I don't really see what you are talking about there. There is nothing to
recognize. ld.so creates the situation, so it knows what it should do.
The above was meant for the case where ld.so does not get fixed and I would
simply ignore the case when an executable gets invoked as parameter to ld.so.
In that case I would still have to deal with the situation since the check would
segfault otherwise.
That said, it seems like ld.so could fix this. i.e., update the auxv
fields on the stack to point to where it's loaded the executable
rather than to ld.so itself.
Ok sounds reasonable. In order to fix it completely this would mean to
duplicate the auxv setup from the kernel in ld.so and keep both in sync.
I don't know exactly what you have in mind, but it sounds rather off to me.
There is nothing to "duplicate". There are a few known auxv entries that
refer to the loaded image, so ld.so needs to change those entries.
Perhaps I've seen that too pessimistic. From a first glance it looked like more
work to me.
Bye,
-Andreas-