From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Christophe Leroy" <christophe.leroy@csgroup.eu>,
"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Jessica Yu" <jeyu@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>
Subject: Re: [PATCH v5 2/2] powerpc/64: Add module check for ELF ABI version
Date: Mon, 07 Nov 2022 22:14:16 +1000 [thread overview]
Message-ID: <CO6202HG8VAN.1ROEE25G4KDK2@bobo> (raw)
In-Reply-To: <513e1973-a1d4-c698-1441-9c7d0f5205ed@csgroup.eu>
On Thu Nov 3, 2022 at 6:35 PM AEST, Christophe Leroy wrote:
>
>
> Le 31/10/2022 à 13:07, Nicholas Piggin a écrit :
> > Override the generic module ELF check to provide a check for the ELF ABI
> > version. This becomes important if we allow big-endian ELF ABI V2 builds
> > but it doesn't hurt to check now.
> >
> > Cc: Jessica Yu <jeyu@kernel.org>
> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> > [np: split patch, added changelog, adjust to Jessica's proposal]
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > arch/powerpc/kernel/module.c | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
> > index f6d6ae0a1692..d46bf9bfda26 100644
> > --- a/arch/powerpc/kernel/module.c
> > +++ b/arch/powerpc/kernel/module.c
> > @@ -19,6 +19,23 @@
> >
> > static LIST_HEAD(module_bug_list);
> >
> > +#ifdef CONFIG_PPC64
>
> Can it go in arch/powerpc/kernel/module_64.c instead ?
>
> > +bool module_elf_check_arch(Elf_Ehdr *hdr)
> > +{
> > + unsigned long abi_level = hdr->e_flags & 0x3;
> > +
> > + if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2)) {
> > + if (abi_level != 2)
> > + return false;
> > + } else {
> > + if (abi_level >= 2)
> > + return false;
> > + }
> > +
> > + return true;
>
> Can be simpler:
>
> if (IS_ENABLED(CONFIG_PPC64_ELF_ABI_V2))
> return abi_level == 2;
> else
> return abi_level < 2;
Yes I think both of those can be done. Good suggestions.
Thanks,
Nick
next prev parent reply other threads:[~2022-11-07 12:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 12:07 [PATCH v5 0/2] powerpc module arch checks Nicholas Piggin
2022-10-31 12:07 ` [PATCH v5 1/2] module: add module_elf_check_arch for module-specific checks Nicholas Piggin
2022-11-02 23:59 ` Luis Chamberlain
2022-10-31 12:07 ` [PATCH v5 2/2] powerpc/64: Add module check for ELF ABI version Nicholas Piggin
2022-11-03 8:35 ` Christophe Leroy
2022-11-07 12:14 ` Nicholas Piggin [this message]
2022-11-03 0:01 ` [PATCH v5 0/2] powerpc module arch checks Luis Chamberlain
2022-11-03 9:35 ` Michael Ellerman
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=CO6202HG8VAN.1ROEE25G4KDK2@bobo \
--to=npiggin@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mcgrof@kernel.org \
--cc=mpe@ellerman.id.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox