Subject: kern/14332: Can not execute FreeBSD 4.4-RELEASE binary
To: None <gnats-bugs@gnats.netbsd.org>
From: None <nabe@nabechan.org>
List: netbsd-bugs
Date: 10/23/2001 08:56:12
>Number:         14332
>Category:       kern
>Synopsis:       Can not execute FreeBSD 4.4-RELEASE binary
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 23 08:57:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Shingo WATANABE
>Release:        NetBSD current Oct 24, 2001
>Organization:
nabechan.org
>Environment:
NetBSD x20.i.nabechan.org 1.5Y NetBSD 1.5Y (X20) #118: Tue Oct 23 18:12:45 JST 2001     nabe@x20.i.nabechan.org:/usr/local/src/NetBSD/src/sys/arch/i386/compile/X20 i386

>Description:
The NetBSD execute the FreeBSD 4.4-RELEASE binary as
 a linux binary, so I can not execute.
The reason is related to the integration of binutils 2.11.2 in FreeBSD.
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/contrib/binutils/bfd/elf.c.diff?r1=1.3.6.4&r2=1.3.6.5

>How-To-Repeat:
Get the binary from FreeBSD 4.4-RELEASE tar balls and execute it.
>Fix:
--- /home/nabe/work/cvs/NetBSD/src/sys/compat/freebsd/freebsd_exec_elf32.c	Sun Jul 15 13:44:59 2001
+++ freebsd_exec_elf32.c	Tue Oct 23 17:39:27 2001
@@ -71,8 +71,9 @@
 #define EI_BRAND 8
 #endif
         if (eh->e_ident[EI_BRAND] == '\0'
-	  || strcmp(&eh->e_ident[EI_BRAND], wantBrand))
-		return ENOEXEC;
+			|| strcmp(&eh->e_ident[EI_BRAND], wantBrand))
+			if (eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
+				return ENOEXEC;
 
 	i = eh->e_phnum;
 	if (i != 0) {

>Release-Note:
>Audit-Trail:
>Unformatted: