From: Petr Pavlu <petr.pavlu@suse.com>
To: rppt@kernel.org, akpm@linux-foundation.org
Cc: "Marek Maślanka" <mmaslanka@google.com>,
mcgrof@kernel.org, regressions@lists.linux.dev,
linux-modules@vger.kernel.org, linux-mm@kvack.org,
live-patching@vger.kernel.org, joe.lawrence@redhat.com,
jpoimboe@kernel.org, pmladek@suse.com
Subject: Re: ROX allocations broke livepatch for modules since 6.13-rc1
Date: Mon, 6 Jan 2025 20:45:01 +0100 [thread overview]
Message-ID: <0530eee7-f329-4786-bea3-c9c66d5f0bed@suse.com> (raw)
In-Reply-To: <c37395e2-1ab5-4175-9920-5144cf60e25e@suse.com>
On 1/5/25 15:51, Petr Pavlu wrote:
> On 12/30/24 01:09, Marek Maślanka wrote:
>> Hi Mike and others,
>>
>> I discovered that the patch "[v7,4/8] module: prepare to handle ROX allocations
>> for text" has disrupted livepatch functionality. Specifically, this occurs when
>> livepatch is prepared to patch a kernel module and when the livepatch module
>> contains a "special" relocation section named
>> ".klp.rela.<MODULE_NAME>.<SECTION_NAME>" to access local symbols.
>
> Thank you for the report. It is possible for me to reproduce the issue
> on my system. An annoying part is to create the
> .klp.rela.<objname>.<secname> data, for which I eventually used one
> floating variant of klp-convert [1]. To hit the problem, <objname> must
> point to an object that is different from vmlinux. Such relocations are
> processed by the livepatch code later than regular module relocations,
> as you pointed out after mod->rw_copy is already reset.
>
> I think the bug should be addressed in principle by Mike's recently
> posted rework of the feature [2] but unfortunately, its current version
> makes my system also unbootable [3].
A simpler fix could be:
diff --git a/include/linux/module.h b/include/linux/module.h
index 94acbacdcdf1..b3a643435357 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -773,7 +773,8 @@ void *__module_writable_address(struct module *mod, void *loc);
static inline void *module_writable_address(struct module *mod, void *loc)
{
- if (!IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) || !mod)
+ if (!IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) || !mod ||
+ mod->state != MODULE_STATE_UNFORMED)
return loc;
return __module_writable_address(mod, loc);
}
Hm, is it expected that Mike's rework to drop rw_copy will make it into
6.13 or should I properly post this minimal fix for review?
--
Thanks,
Petr
next prev parent reply other threads:[~2025-01-06 19:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 0:09 Marek Maślanka
2025-01-05 14:51 ` Petr Pavlu
2025-01-06 19:45 ` Petr Pavlu [this message]
2025-01-07 15:34 ` [PATCH] module: Fix writing of livepatch relocations in ROX text Petr Pavlu
2025-01-09 8:06 ` Petr Mladek
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=0530eee7-f329-4786-bea3-c9c66d5f0bed@suse.com \
--to=petr.pavlu@suse.com \
--cc=akpm@linux-foundation.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-modules@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mmaslanka@google.com \
--cc=pmladek@suse.com \
--cc=regressions@lists.linux.dev \
--cc=rppt@kernel.org \
/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