How to implement a kernel feature check in the crt* files?

Andreas Krebbel krebbel@linux.vnet.ibm.com
Mon Jan 11 11:42:00 GMT 2010


Roland McGrath wrote:
> I would call this ld.so's problem.  It's failing to simulate program
> loading as it intends to.  
> 
> I don't think this is really a hard issue, since using ld.so this way
> is not a normal thing to do.  AFAIK it's only used in the libc build,
> or in special situations by hand, or ldd.  I doubt it really needs to
> have all the compatibility checks that vanilla running of executables
> should.

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.

> 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.

Bye,

-Andreas-



More information about the Libc-help mailing list