From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH v2] Suport for bi-endianess in elf file
Date: Sat, 25 Jul 2015 17:01:03 +0300 [thread overview]
Message-ID: <20150725170103.34fd9ed8@opensuse.site> (raw)
In-Reply-To: <20150724214822.391a7814@opensuse.site>
В Fri, 24 Jul 2015 21:48:22 +0300
Andrei Borzenkov <arvidjaar@gmail.com> пишет:
> В Thu, 23 Jul 2015 11:10:36 -0300
> Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com> пишет:
>
> > Updated version with the suggestions from Andrei Borzenkov.
> >
> > * grub-core/kern/elf.c: check and switch endianess with grub_{be,le}_to
> > cpu functions.
> > * grub-core/kern/elfXX.c: Likewise.
> >
>
> Could you add a bit more verbose description that it currently applies
> to ppc only when committing.
>
> > Also-by: Tomohiro B Berry <tbberry@us.ibm.com>
> > ---
> > grub-core/kern/elf.c | 51 ++++++++++++++++++++++++++++++---
> > grub-core/kern/elfXX.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 123 insertions(+), 4 deletions(-)
> >
> > diff --git a/grub-core/kern/elf.c b/grub-core/kern/elf.c
> > index 5f99c43..1be9c1c 100644
> > --- a/grub-core/kern/elf.c
> > +++ b/grub-core/kern/elf.c
> > @@ -28,6 +28,11 @@
> >
> > GRUB_MOD_LICENSE ("GPLv3+");
> >
> > +#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
> > +void grub_elf32_check_endianess (grub_elf_t elf);
> > +void grub_elf64_check_endianess (grub_elf_t elf);
> > +#endif /* defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275) */
> > +
> > /* Check if EHDR is a valid ELF header. */
> > static grub_err_t
> > grub_elf_check_header (grub_elf_t elf)
> > @@ -38,8 +43,19 @@ grub_elf_check_header (grub_elf_t elf)
> > || e->e_ident[EI_MAG1] != ELFMAG1
> > || e->e_ident[EI_MAG2] != ELFMAG2
> > || e->e_ident[EI_MAG3] != ELFMAG3
> > - || e->e_ident[EI_VERSION] != EV_CURRENT
> > - || e->e_version != EV_CURRENT)
> > + || e->e_ident[EI_VERSION] != EV_CURRENT)
> > + return grub_error (GRUB_ERR_BAD_OS, N_("invalid arch-independent ELF magic"));
> > +
> > +#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
> > + if (grub_elf_is_elf32 (elf))
> > + grub_elf32_check_endianess (elf);
> > + else if (grub_elf_is_elf64 (elf))
> > + grub_elf64_check_endianess (elf);
> > + else
> > + return grub_error (GRUB_ERR_BAD_OS, N_("Uknown ELF class"));
>
> Other places are using "invalid arch-dependent ELF magic" in this case,
> it is better to reuse translation string. Otherwise fine for me.
>
BTW this duplicates check in grub-core/loader/powerpc/ieee1275/linux.c
which probably can then be removed then.
next prev parent reply other threads:[~2015-07-25 14:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 14:10 [PATCH v2] Suport for bi-endianess in elf file Paulo Flabiano Smorigo
2015-07-24 18:48 ` Andrei Borzenkov
2015-07-25 14:01 ` Andrei Borzenkov [this message]
2015-07-24 19:00 ` Vladimir 'phcoder' Serbinenko
2015-07-24 19:09 ` Andrei Borzenkov
2015-07-24 20:15 ` Andrei Borzenkov
2015-07-27 1:34 ` Paulo Flabiano Smorigo
2015-10-26 21:14 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150725170103.34fd9ed8@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=pfsmorigo@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.