Subject: Re: COMPAT_IBCS2, SCO OSR5 executables SEGV on NetBSD 2.0
To: None <tech-kern@netbsd.org>
From: J Chapman Flack <flack@cs.purdue.edu>
List: tech-kern
Date: 12/29/2004 18:09:46
> >$ readelf -x 14 wc       
> >
> >Hex dump of section '.note':
> >  0x00000000 004f4353 00000001 0000000c 00000004 ............SCO.
> >  0x00000010          00010000 00000003 00010001 ............
> 
> Hmm.  I note that ibcs2_exec_elf32.c contains:
> 
> #define SCO_SIGNATURE	"\004\0\0\0\014\0\0\0\001\0\0\0SCO\0"
> 
> which I don't think matches yours.  I think the signature-matching code

hmm ... I haven't tried your patch yet, but I'm not sure what in the
signature doesn't match.  I'm a little thrown by the output format of
readelf, where the correspondence of the character dump to the hex dump
seems backwards not only in groups of four (which I expect on a little
endian machine) but for the whole group of sixteen - hmpf, it looks like
readelf is handling 'littleendian' by completely reversing every group
of sixteen bytes for the hex output.  oops.  Here's the same section of
the executable, from a nice safe hexdump -C:

00001120  04 00 00 00 0c 00 00 00  01 00 00 00 53 43 4f 00  |............SCO.|
00001130  01 00 01 00 03 00 00 00  00 00 01 00 00 2e 69 6e  |..............in|

Viewed that way, I think SCO_SIGNATURE should match, no?  I mean, the
section is longer than the signature, but the test only seems concerned with
the first sizeof(signature)-1 bytes anyway, and there they are.

Am I missing something?

-Chap