This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: Running SO files


On Sunday 01 June 2008, Segher Boessenkool wrote:
> > I have noticed that some shared object (.so) files can be executed. For
> > example, I can type:
> >
> > $ /lib/libc.so.6
> >
> > which prints a message with the version of GNU C library and other
> > information. How does this work? How is it possible to execute a shared
> > object file?
>
> It's a little hack in the Linux kernel.

no it isnt ... it's standard ELF

> The SO needs an entry point, 

yes

> and a ".interp" section.

no ... an .interp is only needed if the ELF itself is not capable of direct 
execution.  and the kernel doesnt parse the section headers looking 
for ".interp", it parses the dynamic table for DT_INTERP.

> > I have also noticed that this is not true
> > for every SO file. I would appreciate any information on how this
> > works.
>
> You can't "run" a SO if it's not marked +x.  The Linux kernel will
> happily
> try to run any SO that is executable, but will segfault it just as
> happily
> unless you get all the little bits right.

generally speaking, a SO wouldnt be usable anyways if it werent +x.  userspace 
needs to mmap() it with exec access so that the functions in it are 
executable.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


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