s390: Consistent usage of text_mutex
Heiko Carstens
maintainercover s390: Consistent usage of text_mutex
Other architectures serialize kernel text patching with text_mutex. s390 does not: __s390_kernel_write() relies on a private spinlock, and callers partially depend on implicit exclusion (e.g. no kprobe can be set on a jump label).
Make s390 consistent with other architectures:
- Patches 1-3 add text_mutex to the jump_label, ftrace and bpf text patching paths
- Patch 4 removes the redundant spinlock from __s390_kernel_write(). CPU serialization, previously done implicitly, is now explicit via sync_core()
Thanks,
Heiko
Heiko Carstens (4):
s390/jump_label: Serialize text patching with text_mutex s390/ftrace: Serialize text patching with text_mutex s390/bpf: Serialize text patching with text_mutex s390/maccess: Remove spinlock from __s390_kernel_write()
arch/s390/kernel/ftrace.c | 9 +++++++++ arch/s390/kernel/jump_label.c | 3 +++ arch/s390/mm/maccess.c | 9 ++++----- arch/s390/net/bpf_jit_comp.c | 21 +++++++++++++++++---- 4 files changed, 33 insertions(+), 9 deletions(-)
Signature · 1 line
2.53.0
Heiko Carstens
maintainerPATCH 1/4 s390/jump_label: Serialize text patching with text_mutex
Acquire text_mutex around the verify-then-patch sequence in jump_label_transform(). This way s390 uses text_mutex like other architectures and does not need to rely on other implicit semantics (e.g. no kprobe can be set on a jump label).
This is a prereq for removing the spinlock in __s390_kernel_write().
--- arch/s390/kernel/jump_label.c | 3 +++ 1 file changed, 3 insertions(+)
arch/s390/kernel/jump_label.c +3 -0
@@ -5,6 +5,7 @@* Copyright IBM Corp. 2011 * Author(s): Jan Glauber <[email protected]> */ +#include <linux/memory.h> #include <linux/uaccess.h> #include <linux/jump_label.h> #include <linux/module.h>
@@ -57,9 +58,11 @@ static void jump_label_transform(struct jump_entry *entry,jump_label_make_branch (entry, &old);jump_label_make_nop (entry, &new); } +mutex_lock (&text_mutex);if (memcmp (code, &old,sizeof (old)))jump_label_bug (entry, &old, &new);s390_kernel_write (code, &new,sizeof (new)); +mutex_unlock (&text_mutex); } void arch_jump_label_transform(struct jump_entry *entry,
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/4] s390/jump_label: Serialize text patching with text_mutex
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
Acquire
text_mutexaround the verify-then-patch sequence injump_label_transform(). This way s390 usestext_mutexlike other architectures and does not need to rely on other implicit semantics (e.g. no kprobe can be set on a jump label).This is a prereq for removing the spinlock in
__s390_kernel_write().Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Heiko Carstens
maintainerPATCH 2/4 s390/ftrace: Serialize text patching with text_mutex
In reply to Heiko CarstensAdd ftrace_arch_code_modify_prepare() and extend ftrace_arch_code_modify_post_process() to acquire and release text_mutex around the ftrace code modification pass. This way s390 uses text_mutex like e.g. x86 and riscv.
This is a prereq for removing the spinlock in __s390_kernel_write().
--- arch/s390/kernel/ftrace.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/s390/kernel/ftrace.c +9 -0
@@ -8,6 +8,7 @@*/ #include <linux/hardirq.h> +#include <linux/memory.h> #include <linux/uaccess.h> #include <linux/ftrace.h> #include <linux/kernel.h>
@@ -247,13 +248,21 @@ int ftrace_update_ftrace_func(ftrace_func_t func)return 0 ; } +void ftrace_arch_code_modify_prepare (void ) + __acquires(&text_mutex) +{ +mutex_lock (&text_mutex); +} +void arch_ftrace_update_code (int command) {ftrace_modify_all_code (command); }void ftrace_arch_code_modify_post_process (void ) + __releases(&text_mutex) { +mutex_unlock (&text_mutex);/* * Flush any pre-fetched instructions on all * CPUs to make the new code visible.
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 2/4] s390/ftrace: Serialize text patching with text_mutex
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
Add
ftrace_arch_code_modify_prepare()and extendftrace_arch_code_modify_post_process()to acquire and releasetext_mutexaround the ftrace code modification pass. This way s390 usestext_mutexlike e.g. x86 and riscv.This is a prereq for removing the spinlock in
__s390_kernel_write().Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Heiko Carstens
maintainerPATCH 3/4 s390/bpf: Serialize text patching with text_mutex
In reply to Heiko CarstensAcquire text_mutex in bpf_arch_text_poke(). This way s390 uses text_mutex like most other architectures.
This is a prereq for removing the spinlock in __s390_kernel_write().
--- arch/s390/net/bpf_jit_comp.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
arch/s390/net/bpf_jit_comp.c +17 -4
@@ -22,6 +22,7 @@#include <linux/init.h> #include <linux/bpf.h> #include <linux/cfi.h> +#include <linux/memory.h> #include <linux/mm.h> #include <linux/kernel.h> #include <asm/cacheflush.h>
@@ -2446,9 +2447,9 @@ bool bpf_jit_supports_far_kfunc_call(void)return true; } -int bpf_arch_text_poke (void *ip,enum bpf_text_poke_type old_t, -enum bpf_text_poke_type new_t,void *old_addr, -void *new_addr) +static int __bpf_arch_text_poke (void *ip,enum bpf_text_poke_type old_t, +enum bpf_text_poke_type new_t,void *old_addr, +void *new_addr) {struct bpf_plt expected_plt, current_plt, new_plt, *plt;struct {
@@ -2458,6 +2459,8 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,char *ret;int err; +guard (mutex)(&text_mutex); +/* Verify the branch to be patched. */ err =copy_from_kernel_nofault (&insn, ip,sizeof (insn));if (err <0 )
@@ -2491,10 +2494,20 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,/* Adjust the mask of the branch. */ insn.opc =0xc004 | (new_addr ?0xf0 :0 );s390_kernel_write ((char *)ip +1 , (char *)&insn.opc +1 ,1 ); +return 0 ; +} +int bpf_arch_text_poke (void *ip,enum bpf_text_poke_type old_t, +enum bpf_text_poke_type new_t,void *old_addr, +void *new_addr) +{ +int err; + + err =__bpf_arch_text_poke (ip, old_t, new_t, old_addr, new_addr); +if (err) +return err;/* Make the new code visible to the other CPUs. */ text_poke_sync_lock (); -return 0 ; }
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 3/4] s390/bpf: Serialize text patching with text_mutex
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
Acquire
text_mutexinbpf_arch_text_poke(). This way s390 usestext_mutexlike most other architectures.This is a prereq for removing the spinlock in
__s390_kernel_write().Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Heiko Carstens
maintainerPATCH 4/4 s390/maccess: Remove spinlock from __s390_kernel_write()
In reply to Heiko CarstensThe spinlock in __s390_kernel_write() was introduced to serialize the read-modify-write sequence against concurrent callers. Now that all relevant runtime callers of s390_kernel_write() hold the text_mutex, the spinlock is not required anymore.
Replace it with preempt_disable() / preempt_enable() and sync_core(). Previously, CPU serialization was implicitly done by other instructions. Make this explicit with sync_core() instead of relying on that.
Preemption is disabled so that sync_core() issues the CPU serialization instruction on the same CPU that executed the stores. This completes all previous stores and makes them visible to other CPUs.
Other CPUs need to perform CPU serialization, e.g. with text_poke_sync(), to discard already prefetched instructions.
--- arch/s390/mm/maccess.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/s390/mm/maccess.c +4 -5
@@ -6,6 +6,7 @@* */ +#include <linux/text-patching.h> #include <linux/uaccess.h> #include <linux/kernel.h> #include <linux/types.h>
@@ -60,22 +61,20 @@ static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz* bytes from destination at an eight byte boundary, modifies the bytes * requested and writes the result back in a loop. */ -static DEFINE_SPINLOCK (s390_kernel_write_lock); - notrace void *__s390_kernel_write(void *dst, const void *src, size_t size) {void *tmp = dst; -unsigned long flags;long copied; -spin_lock_irqsave (&s390_kernel_write_lock, flags); +preempt_disable ();while (size) { copied =s390_kernel_write_odd (tmp, src, size); tmp += copied; src += copied; size -= copied; } -spin_unlock_irqrestore (&s390_kernel_write_lock, flags); +sync_core (); +preempt_enable ();return dst; }
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write()
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] s390/maccess: RMW race in __s390_kernel_write() via apply_relocate_add() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/maccess: RMW race in __s390_kernel_write() via apply_relocate_add() --
commit d0c62af80b12a6f9e8f6c9ffe62431d5b78a99bf
Author: Heiko Carstens <[email protected]>
s390/maccess: Remove spinlock from __s390_kernel_write()
This commit removes s390_kernel_write_lock from __s390_kernel_write() under the assumption that all runtime callers hold text_mutex, and replaces the spinlock with preempt_disable(), sync_core(), and preempt_enable().
Quoted 4 lines
arch/s390/mm/maccess.c +0
-0
[ ... ]
Quoted 13 lines
arch/s390/mm/maccess.c +0
-4@@ -60,22 +61,20 @@ static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz* bytes from destination at an eight byte boundary, modifies the bytes * requested and writes the result back in a loop. */ -static DEFINE_SPINLOCK (s390_kernel_write_lock); - notrace void *__s390_kernel_write(void *dst, const void *src, size_t size) {void *tmp = dst; -unsigned long flags;long copied; -spin_lock_irqsave (&s390_kernel_write_lock, flags);
arch/s390/mm/maccess.c static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz · line 77
Quoted 10 lines
arch/s390/mm/maccess.c +3
-1+preempt_disable ();while (size) { copied =s390_kernel_write_odd (tmp, src, size); tmp += copied; src += copied; size -= copied; } -spin_unlock_irqrestore (&s390_kernel_write_lock, flags); +sync_core (); +preempt_enable ();
[Severity: High]
Can removing s390_kernel_write_lock cause a read-modify-write race in s390_kernel_write_odd() when apply_relocate_add() is called by livepatching?
In arch/s390/kernel/module.c:apply_relocate_add(), s390_kernel_write() is used whenever the module is already formed, without taking text_mutex:
int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec,
struct module *me)
{
bool early = me->state == MODULE_STATE_UNFORMED;
void *(*write)(void *, const void *, size_t) = memcpy;
if (!early)
write = s390_kernel_write;
return __apply_relocate_add(sechdrs, strtab, symindex, relsec, me,
write);
}At runtime, livepatching reaches this path via:
klp_enable_patch() / klp_module_coming()
-> klp_init_object_loaded()
-> klp_apply_object_relocs()
-> klp_write_object_relocs()
-> klp_write_section_relocs()
-> apply_relocate_add()Commit 5b384f933590 ("x86/module: Use text_mutex in apply_relocate_add()") removed mutex_lock(&text_mutex) from klp_init_object_loaded() in kernel/livepatch/core.c and added text_mutex only to x86, relying on s390_kernel_write_lock to serialize s390's apply_relocate_add().
Because s390_kernel_write_odd() performs a non-atomic 8-byte read-modify-write cycle on (dst & ~7UL) using mvc, ex, and sturg, could a concurrent caller holding text_mutex (such as ftrace, jump_label, kprobes, or bpf_arch_text_poke) modifying an instruction in the same 8-byte doubleword of the livepatch module have its write clobbered?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Ilya Leoshkevich
maintainerRe: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write()
In reply to Heiko CarstensQuoted 4 lines · Heiko Carstens
The spinlock in
__s390_kernel_write()was introduced to serialize the read-modify-write sequence against concurrent callers. Now that all relevant runtime callers ofs390_kernel_write()hold thetext_mutex, the spinlock is not required anymore.
Do we want to enforce this with __must_hold?
Quoted 45 lines
Replace it with
preempt_disable()/preempt_enable()andsync_core(). Previously, CPU serialization was implicitly done by other instructions. Make this explicit withsync_core()instead of relying on that.Preemption is disabled so that
sync_core()issues the CPU serialization instruction on the same CPU that executed the stores. This completes all previous stores and makes them visible to other CPUs.Other CPUs need to perform CPU serialization, e.g. with
text_poke_sync(), to discard already prefetched instructions.Signed-off-by Heiko Carstens <[email protected]>--- arch/s390/mm/maccess.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)arch/s390/mm/maccess.c +2
-4@@ -6,6 +6,7 @@* */ +#include <linux/text-patching.h> #include <linux/uaccess.h> #include <linux/kernel.h> #include <linux/types.h> @@ -60,22 +61,20 @@ static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz* bytes from destination at an eight byte boundary, modifies the bytes * requested and writes the result back in a loop. */ -static DEFINE_SPINLOCK (s390_kernel_write_lock); - notrace void *__s390_kernel_write(void *dst, const void *src, size_t size) {void *tmp = dst; -unsigned long flags;long copied; -spin_lock_irqsave (&s390_kernel_write_lock, flags); +preempt_disable ();while (size) { copied =s390_kernel_write_odd (tmp, src, size);
arch/s390/mm/maccess.c static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz · line 80
Quoted 10 lines
arch/s390/mm/maccess.c +2
-1tmp += copied; src += copied; size -= copied; } -spin_unlock_irqrestore (&s390_kernel_write_lock, flags); +sync_core (); +preempt_enable ();return dst; }
I've been looking at sync_core() and started thinking about the safety of this interface w.r.t. CPUs concurrently executing the code being patched, since locking protects only against concurrent readers and writers, but not executors.
If there is only one active CPU, for example, during ftrace initialization, then everything is fine.
If there are other active CPUs and we make modifications within a single aligned u64, then sync_core() is required, because even though text_poke_sync() nominally takes care of this, it may sync our core last. However, I wonder, what would it take to make it always sync the current core first?
Finally, and most importantly, if there are other active CPUs and we patch multiple u64s, then we are broken, since the other CPUs may see partial instructions. I'm not sure if it's worth bothering with, but maybe consider adding a WARN_ONCE() to guard against this?
Heiko Carstens
maintainerRe: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write()
Quoted 7 lines · Ilya Leoshkevich
Quoted 4 lines · Heiko Carstens
The spinlock in
__s390_kernel_write()was introduced to serialize the read-modify-write sequence against concurrent callers. Now that all relevant runtime callers ofs390_kernel_write()hold thetext_mutex, the spinlock is not required anymore.Do we want to enforce this with
__must_hold?
Initially I thought that wouldn't be necessary, since "I know what I'm doing" :) But Sashiko already complained that this might not be safe. So I'm going to had the mutex to all callers of s390_kernel_write(), and add __must_hold too, like you propose.
Quoted 11 lines
arch/s390/mm/maccess.c static notrace long s390_kernel_write_odd(void *dst, const void *src, size_t siz · line 80
Quoted 5 lines
arch/s390/mm/maccess.c +2
-1-spin_unlock_irqrestore (&s390_kernel_write_lock, flags); +sync_core (); +preempt_enable ();return dst; }I've been looking at
sync_core()and started thinking about the safety of this interface w.r.t. CPUs concurrently executing the code being patched, since locking protects only against concurrent readers and writers, but not executors.
Quoted 8 lines
If there is only one active CPU, for example, during ftrace initialization, then everything is fine.
If there are other active CPUs and we make modifications within a single aligned u64, then
sync_core()is required, because even thoughtext_poke_sync()nominally takes care of this, it may sync our core last. However, I wonder, what would it take to make it always sync the current core first?
Maybe I don't understand your point, but I added the preempt_disable() / preempt_enable() pair exactly for this reason: make sure that the writer syncs first - only calling text_poke_sync() afterward does not guarantee anything due to preemption (well, that's not true since there are many implicit synchronizations before the next CPU runs, but the point of this was to make everything explicit, and not "hope" that things work).
Quoted 4 lines
Finally, and most importantly, if there are other active CPUs and we patch multiple u64s, then we are broken, since the other CPUs may see partial instructions. I'm not sure if it's worth bothering with, but maybe consider adding a
WARN_ONCE()to guard against this?
Initial alternatives patching might indeed patch multiple instructions in a row, and that's a valid use case, since the code is guaranteed to be not executed anywhere...
So a WARN_ONCE() would at least find one false positive :)
I don't think we should go this route (when is it valid to patch more than one instruction, when not). As of now no code is doing that.
kernel test robot
build botRe: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write()
In reply to Heiko Carstenskernel test robot noticed the following build errors:
Hi Heiko,
kernel test robot noticed the following build errors:
[auto build test ERROR on s390/features]
[also build test ERROR on trace/for-next bpf-next/master bpf/master linus/master v7.3 next-20261026] [cannot apply to bpf-next/net]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Heiko-Carstens/s390-jump_label-Serialize-text-patching-with-text_mutex/20261026-130326 base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features patch link: https://lore.kernel.org/r/20261026120329.1792436-5-hca%40linux.ibm.com patch subject: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write() config: s390-allnoconfig (https://download.01.org/0day-ci/archive/20261027/[email protected]/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 186e70f4e6a1521991d2340d3d49b23b1beff11f) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261027/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/s390/mm/maccess.c:9:
>> include/linux/text-patching.h:10:9: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, __size_t)' (aka 'void *(void *, const void *, unsigned long)'); ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
10 | return memcpy(dst, src, len);
| ^
include/linux/text-patching.h:10:9: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
99 | set->sig[1] | set->sig[0]) == 0;
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
101 | return (set->sig[1] | set->sig[0]) == 0;
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^ In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
vim +10 include/linux/text-patching.h
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 6)
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 7) #ifndef text_poke_copy
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 8) static inline void *text_poke_copy(void *dst, const void *src, size_t len)
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 9) {
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 @10) return memcpy(dst, src, len);
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 11) }
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 12) #define text_poke_copy text_poke_copy
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 13) #endif
0c3beacf681ec8 Mike Rapoport (Microsoft 2024-10-23 14) --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write()
In reply to Heiko Carstenskernel test robot noticed the following build errors:
Hi Heiko,
kernel test robot noticed the following build errors:
[auto build test ERROR on s390/features]
[also build test ERROR on trace/for-next bpf-next/master bpf/master linus/master v7.3 next-20261026] [cannot apply to bpf-next/net]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Heiko-Carstens/s390-jump_label-Serialize-text-patching-with-text_mutex/20261026-130326 base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features patch link: https://lore.kernel.org/r/20261026120329.1792436-5-hca%40linux.ibm.com patch subject: [PATCH 4/4] s390/maccess: Remove spinlock from __s390_kernel_write() config: s390-defconfig (https://download.01.org/0day-ci/archive/20261027/[email protected]/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261027/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/s390/mm/maccess.c:9:
>> include/linux/text-patching.h:10:9: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
10 | return memcpy(dst, src, len);
| ^
include/linux/text-patching.h:10:9: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
99 | set->sig[1] | set->sig[0]) == 0;
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
101 | return (set->sig[1] | set->sig[0]) == 0;
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
In file included from include/linux/node.h:18:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:20:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:36:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:7:
include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
22 | unsigned long sig[_NSIG_WORDS];
| ^ In file included from arch/s390/mm/maccess.c:15:
In file included from include/linux/cpu.h:17:
vim +10 include/linux/text-patching.h
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 6)
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 7) #ifndef text_poke_copy
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 8) static inline void *text_poke_copy(void *dst, const void *src, size_t len)
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 9) {
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 @10) return memcpy(dst, src, len);
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 11) }
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 12) #define text_poke_copy text_poke_copy
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 13) #endif
0c3beacf681ec89 Mike Rapoport (Microsoft 2024-10-23 14) --
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki