[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Endian safe mkelf32.c



On Wed, Feb 23, 2005 at 01:37:32PM -0500, Jimi Xenidis wrote:
> apply in xen/arch/x86/boot

> +    if ( (in32_ehdr.e_type >> 8) == ET_EXEC &&
> +        (in32_ehdr.e_type & 0xff) != ET_EXEC )
> +    {
> +       swap = 1;
> +       swap_ehdr32(&in32_ehdr);
> +    }
> +    else if ( (in32_ehdr.e_type >> 8) != ET_EXEC &&
> +             (in32_ehdr.e_type & 0xff) == ET_EXEC )

This looks wrong. The endianess is figured by e.ident[EI_DATA] not by
reading e_type to see if we can recognize the type in all endianess.

Since you didn't remove the test just before

if ( !IS_ELF(in32_ehdr) ||
        (in32_ehdr.e_ident[EI_DATA] != ELFDATA2LSB) )
{
        fprintf(stderr, "Input image must be a little-endian Elf image.\n");
        return 1;
}

so you can't be there with a valid MSB ELF image.

the only explanation I have for the patch, is that you have an ELF file
that report to be LSB but is in fact MSB ...
what's the point to allow broken ELF file ?

please explain why this patch is necessary, thanks,

-- 
Vincent Hanquez


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.