[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <099b8e0b-2c64-482f-8c22-32afc5b21beb@suse.com>
Date: Tue, 28 Jan 2025 11:31:36 +0100
From: Petr Pavlu <petr.pavlu@...e.com>
To: Mike Rapoport <rppt@...nel.org>
Cc: x86@...nel.org, Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Borislav Petkov <bp@...en8.de>, Brendan Higgins <brendan.higgins@...ux.dev>,
Daniel Gomez <da.gomez@...sung.com>, Daniel Thompson <danielt@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>, David Gow <davidgow@...gle.com>,
Douglas Anderson <dianders@...omium.org>, Ingo Molnar <mingo@...hat.com>,
Jason Wessel <jason.wessel@...driver.com>, Jiri Kosina <jikos@...nel.org>,
Joe Lawrence <joe.lawrence@...hat.com>,
Johannes Berg <johannes@...solutions.net>,
Josh Poimboeuf <jpoimboe@...nel.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Luis Chamberlain <mcgrof@...nel.org>, Mark Rutland <mark.rutland@....com>,
Masami Hiramatsu <mhiramat@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
"H. Peter Anvin" <hpa@...or.com>, Peter Zijlstra <peterz@...radead.org>,
Petr Mladek <pmladek@...e.com>, Rae Moar <rmoar@...gle.com>,
Richard Weinberger <richard@....at>, Sami Tolvanen
<samitolvanen@...gle.com>, Shuah Khan <shuah@...nel.org>,
Song Liu <song@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>, kgdb-bugreport@...ts.sourceforge.net,
kunit-dev@...glegroups.com, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org,
linux-modules@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-um@...ts.infradead.org, live-patching@...r.kernel.org
Subject: Re: [PATCH v3 6/9] module: switch to execmem API for remapping as RW
and restoring ROX
On 1/28/25 11:00, Mike Rapoport wrote:
> On Mon, Jan 27, 2025 at 01:50:31PM +0100, Petr Pavlu wrote:
>> On 1/26/25 08:47, Mike Rapoport wrote:
>>> From: "Mike Rapoport (Microsoft)" <rppt@...nel.org>
>>>
>>> Instead of using writable copy for module text sections, temporarily remap
>>> the memory allocated from execmem's ROX cache as writable and restore its
>>> ROX permissions after the module is formed.
>>>
>>> This will allow removing nasty games with writable copy in alternatives
>>> patching on x86.
>>>
>>> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
>>
>> [...]
>>
>>> +static void module_memory_restore_rox(struct module *mod)
>>> +{
>>> + for_class_mod_mem_type(type, text) {
>>> + struct module_memory *mem = &mod->mem[type];
>>> +
>>> + if (mem->is_rox)
>>> + execmem_restore_rox(mem->base, mem->size);
>>> + }
>>> +}
>>> +
>>
>> Can the execmem_restore_rox() call here fail? I realize that there isn't
>> much that the module loader can do if that happens, but should it be
>> perhaps logged as a warning?
>
> It won't fail at this point. set_memory APIs may fail if they need to split
> a large page and could not allocate a new page table, but here all the
> splits were already done at module_memory_alloc() time.
Ok, thanks for the explanation.
Acked-by: Petr Pavlu <petr.pavlu@...e.com>
-- Petr
Powered by blists - more mailing lists