This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> Thanks! That sounds like a good solution. Unfortunately while
> implementing it I stumbled over another problem.  Using AT_PHDR for
> locating the ELF header will not work if the executable is not directly
> executed by the kernel e.g.  if it is passed as parameter to ld.so.  Then
> AT_PHDR will point to the program headers of ld.so instead of the
> executable.  I'm not sure how to work around this.  I think the situation
> can be detected by comparing the AT_ENTRY field with the first IP in
> _start but finding the ELF header using the AT_PHDR will be impossible
> then.  Perhaps it is ok to simply skip checking in that case?!

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.

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.


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]