From owner-freebsd-bugs@FreeBSD.ORG Tue Oct 18 12:10:30 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02A2A16A421 for ; Tue, 18 Oct 2005 12:10:30 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0065943D5C for ; Tue, 18 Oct 2005 12:10:17 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9ICAHLq050174 for ; Tue, 18 Oct 2005 12:10:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j9ICAH4C050173; Tue, 18 Oct 2005 12:10:17 GMT (envelope-from gnats) Resent-Date: Tue, 18 Oct 2005 12:10:17 GMT Resent-Message-Id: <200510181210.j9ICAH4C050173@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Marcin Koziej Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDFF616A41F for ; Tue, 18 Oct 2005 12:05:21 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 476DF43D48 for ; Tue, 18 Oct 2005 12:05:21 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j9IC5KvE051919 for ; Tue, 18 Oct 2005 12:05:20 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j9IC5Kwi051914; Tue, 18 Oct 2005 12:05:20 GMT (envelope-from nobody) Message-Id: <200510181205.j9IC5Kwi051914@www.freebsd.org> Date: Tue, 18 Oct 2005 12:05:20 GMT From: Marcin Koziej To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: kern/87615: Linux binaries need execution of shared libraries (ld.so) under linux emulation X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2005 12:10:30 -0000 >Number: 87615 >Category: kern >Synopsis: Linux binaries need execution of shared libraries (ld.so) under linux emulation >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Oct 18 12:10:17 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Marcin Koziej >Release: 6.0-RC1 >Organization: >Environment: FreeBSD carnivore 6.0-RC1 FreeBSD 6.0-RC1 #0: Wed Oct 12 12:03:21 CEST 2005 creep@carnivore:/home/src/sys/i386/compile/AVI i386 >Description: Under linux, libraries can be run as executables. It is used particuralry with dynamic linker /lib/ld-linux.so.2 (symlink to /lib/ld-2.y.z.so) which is run by ldd, or can be run with an executable as an argument to alternate it's interpreter. It is also linked to normal executables and has e_type = ET_DYN and e_itent[EI_OSABI]=0. FreeBSD will not allow running libraries which results with: /lib/ld-linux.so.2: cannot execute binary file errors. ( http://docs.freebsd.org/cgi/getmsg.cgi?fetch=23819+0+archive/2001/freebsd-emulation/20010520.freebsd-emulation http://lists.freebsd.org/pipermail/freebsd-questions/2004-April/045349.html ) >How-To-Repeat: Run a library uner linux emulation. In linux running /lib/libc.so.6 gives GNU C Library stable release version 2.3.2, by Roland McGrath et al. Copyright (C) 2003 Free Software Foundation, Inc. This is free software;(...) Report bugs using the `glibcbug' script to . and /lib/ld-linux.so Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...] You have invoked `ld.so', the helper program for shared library executables. (....) Under FreeBSD linux emulation: zsh: exec format error: /compat/linux/lib/libc.so.6 or sh: /lib/ld-linux.so.2: cannot execute binary file (message depends on shell) meaning execve returned ENOEXEC. >Fix: The ultimate solution would be to allow execution of shared libraries under linux emulation. The hacks/workarounds do not fix the problem entirely. Changing the e_type to ET_EXEC and e_ident[EI_OSABI] to ELFOSABI_LINUX allows one to execute ld-linux.so, but it breaks linking against ld-linux.so. A workaround can be to make executable copy of ld-linux.so and point ldd to that copy, but this hack is hard to use when one tries to build glibc, because makefiles repeatedly link and execute new ld.so, there is no global variable to specify a different RTLD and sometimes the name ld.so is hardcoded in Makefiles. This can also be true for other applications using ld.so as executable. >Release-Note: >Audit-Trail: >Unformatted: