[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aHI75JXSDodh6iSx@kernel.org>
Date: Sat, 12 Jul 2025 13:41:40 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Daniel Gomez <da.gomez@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>, Borislav Petkov <bp@...en8.de>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Daniel Gomez <da.gomez@...sung.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Masami Hiramatsu <mhiramat@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Petr Pavlu <petr.pavlu@...e.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Yann Ylavic <ylavic.dev@...il.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-modules@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH v2 2/8] execmem: introduce execmem_alloc_rw()
On Fri, Jul 11, 2025 at 04:29:48PM +0200, Daniel Gomez wrote:
> On 09/07/2025 15.49, Mike Rapoport wrote:
> > From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
> >
> > Some callers of execmem_alloc() require the memory to be temporarily
> > writable even when it is allocated from ROX cache. These callers use
> > execemem_make_temp_rw() right after the call to execmem_alloc().
> >
> > Wrap this sequence in execmem_alloc_rw() API.
> >
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
>
> Reviewed-by: Daniel Gomez <da.gomez@...sung.com>
>
> > ---
> > diff --git a/mm/execmem.c b/mm/execmem.c
> > index 0712ebb4eb77..6b040fbc5f4f 100644
> > --- a/mm/execmem.c
> > +++ b/mm/execmem.c
>
> {...}
>
> > @@ -387,6 +397,21 @@ void *execmem_alloc(enum execmem_type type, size_t size)
> > return kasan_reset_tag(p);
> > }
> >
> > +void *execmem_alloc_rw(enum execmem_type type, size_t size)
> > +{
> > + void *p __free(execmem) = execmem_alloc(type, size);
> > + int err;
> > +
> > + if (!p)
> > + return NULL;
> > +
> > + err = execmem_force_rw(p, size);
> > + if (err)
> > + return NULL;
>
> You don't need to save the error here. That, allows err declaration to be
> dropped.
I prefer to keep err = ... It's more explicit and clear this way.
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists