grub-devel
[Top][All Lists]
Advanced

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

Re: consolidate ELF header checks


From: Marco Gerards
Subject: Re: consolidate ELF header checks
Date: Fri, 04 Feb 2005 22:25:03 +0000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Guillem Jover <address@hidden> writes:

Hi,

> I've spoken with Marco about creating a new elf helper loader module
> so other loaders can share common functions. Maybe later we can add
> a.out or coff helper modules... Or maybe even move most of the
> functionality from dl to the elf module.
>
> This patch merges common ELF header checks. Please test this on PPC
> as I've only tested on x86.

I've done that.  I could load linux using this patch after a small
change.

> +  if (size < sizeof (Elf_Ehdr))
> +    return grub_error (GRUB_ERR_BAD_OS, "ELF size");

Please use a more descriptive error message.

> +    return grub_error (GRUB_ERR_BAD_OS, "Generic ELF magic");

Same here.

> -  /* Make sure that every section is within the core.  */
> -  if (size < e->e_shoff + e->e_shentsize * e->e_shnum)
> -    return 0;
> +      || e->e_machine != EM_386)
> +    return grub_error (GRUB_ERR_BAD_OS, "Arch ELF magic");

And here.

> diff -Naupr -x CVS grub2-cvs/loader/powerpc/ieee1275/linux.c 
> grub2.dl/loader/powerpc/ieee1275/linux.c
> --- grub2-cvs/loader/powerpc/ieee1275/linux.c 2005-02-01 04:34:13.000000000 
> +0100
> +++ grub2.dl/loader/powerpc/ieee1275/linux.c  2005-02-01 04:03:26.000000000 
> +0100


> +  if (grub_dl_check_header (ehdr, sizeof(ehdr)))

The first ehdr should be &ehdr.

As far as I am concerned there are no other issues with this patch.
If someone else has problems with this patch, please tell me.
Otherwise I will commit it soon, if Guillem can fix these issues... :)

Thanks,
Marco





reply via email to

[Prev in Thread] Current Thread [Next in Thread]