Subject: Re: COMPAT_FREEBSD problem
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-help
Date: 11/19/2002 19:01:36
In article <20021119185405.GA286@glen.takilma.net>,
 <collver1@attbi.com> wrote:
>I should add that eh->e_ident[EI_BRAND] == '\0'
>
>Ben
>
>On Tue, Nov 19, 2002 at 10:44:42AM -0800, collver1@attbi.com wrote:
>> In ELFNAME2(freebsd,probe) near the top, there is a test:
>> 	eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD
>> 
>> eh->e_ident[EI_OSABI] == 0, and so it fails this test.
>> 
>> On Tue, Nov 19, 2002 at 04:40:51PM +0000, Christos Zoulas wrote:
>> > Excellent. Now we need to find where the freebsd probe function goes south.
>> > Add some more debugging in /usr/src/sys/compat/freebsd/freebsd_exec_elf32.c;
>> > something might be wrong with the branding detection is my guess.

ok then:
        /*
	 * If a binary has a brand, make sure that it is "FreeBSD".
	 * Newer FreeBSD binaries have OSABI set to ELFOSABI_FREEBSD. This
	 * is arguably broken, but they seem to think they need it, for
	 * whatever reason. If the OSABI field is set, insist that it is
	 * ELFOSABI_FREEBSD.
	 */
        if ((eh->e_ident[EI_BRAND] != '\0' &&
	    strcmp(&eh->e_ident[EI_BRAND], wantBrand) != 0) ||
	    (eh->e_ident[EI_OSABI] != 0 &&
	    eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD))
		return ENOEXEC;


christos