From owner-freebsd-emulation@FreeBSD.ORG Sat Dec 17 16:46:42 2005 Return-Path: X-Original-To: freebsd-emulation@freebsd.org Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 126AE16A420 for ; Sat, 17 Dec 2005 16:46:42 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from www.ebusiness-leidinger.de (jojo.ms-net.de [84.16.236.246]) by mx1.FreeBSD.org (Postfix) with ESMTP id 97C3A43D66 for ; Sat, 17 Dec 2005 16:46:36 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from Andro-Beta.Leidinger.net (p54A5F6B8.dip.t-dialin.net [84.165.246.184]) (authenticated bits=0) by www.ebusiness-leidinger.de (8.13.1/8.13.1) with ESMTP id jBHGk6ig091700; Sat, 17 Dec 2005 17:46:07 +0100 (CET) (envelope-from Alexander@Leidinger.net) Received: from Magellan.Leidinger.net (Magellan.Leidinger.net [192.168.1.1]) by Andro-Beta.Leidinger.net (8.13.3/8.13.3) with ESMTP id jBHGkSx0058594; Sat, 17 Dec 2005 17:46:28 +0100 (CET) (envelope-from Alexander@Leidinger.net) Date: Sat, 17 Dec 2005 17:46:28 +0100 From: Alexander Leidinger To: Patrick =?UTF-8?B?TGFtYWl6acOocmU=?= Message-ID: <20051217174628.4323a286@Magellan.Leidinger.net> In-Reply-To: <200512171654.44214.patfbsde@davenulle.org> References: <200512171654.44214.patfbsde@davenulle.org> X-Mailer: Sylpheed-Claws 1.9.100 (GTK+ 2.8.9; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new Cc: freebsd-emulation@freebsd.org Subject: Re: compat Linux and ELF type X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2005 16:46:42 -0000 On Sat, 17 Dec 2005 16:54:44 +0100 Patrick Lamaizière 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