[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v9 10/27] xsplice: Add helper elf routines
On Wed, Apr 27, 2016 at 01:27:05AM -0600, Jan Beulich wrote: > >>> On 27.04.16 at 03:59, <konrad.wilk@xxxxxxxxxx> wrote: > >> > +static int xsplice_header_check(const struct xsplice_elf *elf) > >> > +{ > >> > + const Elf_Ehdr *hdr = elf->hdr; > >> > + > >> > + if ( sizeof(*elf->hdr) > elf->len ) > >> > + { > >> > + dprintk(XENLOG_ERR, XSPLICE "%s: Section header is bigger than > > payload!\n", > >> > + elf->name); > >> > + return -EINVAL; > >> > + } > >> > + > >> > + if ( !IS_ELF(*hdr) ) > >> > + { > >> > + dprintk(XENLOG_ERR, XSPLICE "%s: Not an ELF payload!\n", > >> > elf->name); > >> > + return -EINVAL; > >> > + } > >> > + > >> > + if ( hdr->e_ident[EI_CLASS] != ELFCLASS64 || > >> > + hdr->e_ident[EI_DATA] != ELFDATA2LSB || > >> > + hdr->e_ident[EI_OSABI] != ELFOSABI_SYSV || > >> > >> What about EI_VERSION and EI_ABIVERSION, btw? > > > > As I did some prototype on ARM32 I realized that the EI_CLASS is wrong > > in common code (as ELFCLASS32 is what ARM32 has). And the EI_ABIVERSION > > too. > > EI_CLASS I can easily see (and in fact EI_DATA would need to > move there too, now that you menton this aspect), but why > EI_ABIVERSION? Afaik there are no versions other than 0 > defined for ELFOSABI_NONE (which btw we wrongly call > ELFOSABI_SYSV). That imo is either EI_OSABI and EI_ABIVERSION > need to move, or both should be in common code. I keep on getting messed up with the e_flags which for ARM32 has 0x500000: Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: ARM Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 4528 (bytes into file) Flags: 0x5000000, Version5 EABI Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 33 Section header string table index: 30 while same test-case under x86: ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x24 Start of program headers: 0 (bytes into file) Start of section headers: 6680 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 47 Section header string table index: 44 Moved EI_ABIVERSION back in the common code. Moved EI_CLASS and EI_DATA in platform specific. > > Jan > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |