From: Charles Mirabile <cmirabil@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Charles Mirabile <cmirabil@redhat.com>,
linux-riscv@lists.infradead.org, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Charlie Jenkins <charlie@rivosinc.com>,
stable@vger.kernel.org
Subject: [PATCH v1] riscv: disable runtime constant support for XIP kernels
Date: Fri, 20 Mar 2026 11:58:41 -0400 [thread overview]
Message-ID: <20260320155843.1848180-1-cmirabil@redhat.com> (raw)
Runtime constant support is predicated on patching the kernel binary at
runtime, which is fundamentally impossible for an XIP kernel whose text
section is backed not by RAM but by memory mapped read-only storage.
If CONFIG_XIP_KERNEL is enabled, do not define riscv implementations of
the relevant runtime constant macros so that the fallbacks which do not
perform runtime constant optimization are used.
Fixes: a44fb5722199 ("riscv: Add runtime constant support")
Cc: stable@vger.kernel.org
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
---
arch/riscv/include/asm/runtime-const.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/riscv/include/asm/runtime-const.h b/arch/riscv/include/asm/runtime-const.h
index d766e2b9e6df1..05110bb7554e9 100644
--- a/arch/riscv/include/asm/runtime-const.h
+++ b/arch/riscv/include/asm/runtime-const.h
@@ -11,6 +11,9 @@
#include <linux/uaccess.h>
+/* patching of the kernel text is fundamentally impossible on XIP kernels */
+#ifndef CONFIG_XIP_KERNEL
+
#ifdef CONFIG_32BIT
#define runtime_const_ptr(sym) \
({ \
@@ -265,4 +268,5 @@ static inline void runtime_const_fixup(void (*fn)(void *, unsigned long),
}
}
+#endif /* !CONFIG_XIP_KERNEL */
#endif /* _ASM_RISCV_RUNTIME_CONST_H */
base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
--
2.53.0
reply other threads:[~2026-03-20 15:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260320155843.1848180-1-cmirabil@redhat.com \
--to=cmirabil@redhat.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=charlie@rivosinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=stable@vger.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
all inboxes | Powered by JetHome®