Bill Jonas on Sat, 2 Jun 2001 19:57:27 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] ELF Init section


On Sat, Jun 02, 2001 at 12:14:19AM -0400, Tim Peeler wrote:
>    Really the thing I'm concerned with, is that if the init section of
> a binary is executed first, would that section be executed as the uid/euid
> of the user who invoked the program or would that section be executed as
> the uid/euid assigned to the loader (which is root).  The problem that

bj@epoch:~$ ls -l /lib/ld.so
-rwxr-xr-x    2 root     root        99568 Mar  6 21:17 /lib/ld.so

No problem there; it's owned by root, but you'll notice that the SUID
bit is not set.  Therefore, it runs with the privileges of the user who
started it.

> Something else that just keeps gnawing at my brain, is what binary format
> do the various bsds use?

I currently have an OpenBSD box up:

bj@morpheus:~$ ls -l /usr/libexec/ld.so
-r-xr-xr-x  1 root  bin  61440 Nov  6  2000 /usr/libexec/ld.so
bj@morpheus:~$ file /bin/ls
/bin/ls: OpenBSD/i386 demand paged executable

I'm not exactly sure what the file type means, but I'm pretty sure it's
not ELF. ;)  Although all three BSDs (to my knowledge) can run Linux
binaries as a sort of emulation mode.

 From my Linux box, if that sheds any light on the matter:
bj@epoch:~$ scp morpheus:/bin/ls .
ls                   100% |*****************************|   164 KB 00:01
bj@epoch:~$ file ls
ls: NetBSD/i386 demand paged executable

BTW, I think this is a rather interesting discussion we're having here.
Totally on-topic.  ;-)  I mean, the executable file format is pretty
basic to the functioning of any system...  While it's probably true you
can get better answers to some of these questions elsewhere, don't feel
as though it's off-topic here.

-- 
Bill Jonas    *    bill@billjonas.com    *    http://www.billjonas.com/
"As we enjoy great advantages from the inventions of others,  we should
be glad of an opportunity to serve others by any invention of ours; and
this we should do freely and generously."          -- Benjamin Franklin


______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug