[PATCH v2 04/10] s390/runtime-const: Serialize text patching with text_mutex

From: Heiko Carstens

Date: Tue Oct 27 2026 - 10:37:32 EST


Acquire text_mutex inside runtime_const_fixup() around the patching
loop.

Serialization is not required for runtime_const_fixup(), however this is
part of larger series where at the end s390_kernel_write() requires that
callers hold text_mutex.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/runtime-const.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/s390/include/asm/runtime-const.h b/arch/s390/include/asm/runtime-const.h
index 7b71156031ec..0e2402717e8b 100644
--- a/arch/s390/include/asm/runtime-const.h
+++ b/arch/s390/include/asm/runtime-const.h
@@ -3,6 +3,7 @@
#define _ASM_S390_RUNTIME_CONST_H

#include <linux/uaccess.h>
+#include <linux/memory.h>

#define runtime_const_ptr(sym) \
({ \
@@ -88,6 +89,7 @@ static inline void __runtime_fixup_mask(void *where, unsigned long val)
static inline void runtime_const_fixup(void (*fn)(void *, unsigned long),
unsigned long val, s32 *start, s32 *end)
{
+ guard(mutex)(&text_mutex);
while (start < end) {
fn(*start + (void *)start, val);
start++;
--
2.53.0