[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200417145136.ls3tafthtql6prhn@treble>
Date: Fri, 17 Apr 2020 09:51:36 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Jessica Yu <jeyu@...nel.org>, x86@...nel.org
Subject: Re: [PATCH v2 7/9] x86/module: Use text_poke() for late relocations
On Fri, Apr 17, 2020 at 04:29:44PM +0200, Peter Zijlstra wrote:
> On Fri, Apr 17, 2020 at 09:04:32AM -0500, Josh Poimboeuf wrote:
> > +int apply_relocate_add(Elf64_Shdr *sechdrs,
> > + const char *strtab,
> > + unsigned int symindex,
> > + unsigned int relsec,
> > + struct module *me)
> > +{
> > + int ret;
> > + bool early = me->state == MODULE_STATE_UNFORMED;
> > + void *(*write)(void *, const void *, size_t) = memcpy;
> > +
> > + if (!early) {
> > + write = text_poke;
> > + mutex_lock(&text_mutex);
> > + }
> > +
> > + ret = __apply_relocate_add(sechdrs, strtab, symindex, relsec, me,
> > + write);
> > +
> > + if (!early) {
> > + mutex_unlock(&text_mutex);
> > + text_poke_sync();
>
> I'm thinking text_poke_sync() wants to be inside text_mutex. Although
> given that nothing should be running that text, it really doesn't
> matter.
Yeah, makes sense.
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 2a997afa04c6..23c95a53d20e 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -237,8 +237,8 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
write);
if (!early) {
- mutex_unlock(&text_mutex);
text_poke_sync();
+ mutex_unlock(&text_mutex);
}
return ret;
Powered by blists - more mailing lists