Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Dec 2005 17:46:28 +0100
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Patrick =?UTF-8?B?TGFtYWl6acOocmU=?= <patfbsde@davenulle.org>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: compat Linux and ELF type
Message-ID:  <20051217174628.4323a286@Magellan.Leidinger.net>
In-Reply-To: <200512171654.44214.patfbsde@davenulle.org>
References:  <200512171654.44214.patfbsde@davenulle.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 17 Dec 2005 16:54:44 +0100
Patrick Lamaizière <patfbsde@davenulle.org> wrote:

> Hello,
> 
> Could you explain to me why Linux executables are of brand "Linux" and Linux 
> libraries "SVR4" ?
> 
> $ brandelf /compat/linux/bin/ls
> File '/compat/linux/bin/ls' is of brand 'Linux' (3).

Some files are of brand SVR4 too, but this is a bug in the port which
installs those files then.

For statically linked programs we absolutely have to brand them as
Linux, else you will shoot yourself in the foot (if you want to try it:
try it with in single user mode and make sure every FS is mounted
read-only to prevent data-loss or the need to fsck). Background:
FreeBSD will use the wrong syscall table and executes syscalls you
don't want to execute.

For dynamic programs, most of the time you don't need to brand them,
but we can't guarantee this. So to be on the safe side (and consistency
and POLA), every program has to be branded as Linux.

> $ brandelf /compat/linux/lib/libc-2.3.2.so
> File '/compat/linux/lib/libc-2.3.2.so' is of brand 'SVR4' (0).

The Linux ELF loader (ld-*.so) only loads SVR4 branded ones, not Linux
branded ones. It's enough to brand the programs (except you want to
execute a lib directly instead of loading it into a program). 

> May it is a stupid question! Thanks.

It isn't.

Bye,
Alexander.

-- 
               I believe the technical term is "Oops!"

http://www.Leidinger.net                       Alexander @ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051217174628.4323a286>