Skip to content

s390: Consistent usage of text_mutex

Heiko Carstens linux-s390 lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 14 repliesIn review
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Use text mutex for all callers of s390_kernel_write(), and add lockdep checking. [Based on a review comment from Ilya Leoshkevich, and also Sashiko feedback]

- Note: this takes now the mutex also at places where it is technically not necessary (e.g. ftrace init nop patching). However this is not much of a difference to before, where the spinlock in s390_kernel_write() was always taken instead

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10s390/jump_label: Serialize text patching with text_mutexarch/s390/kernel/jump_label.c+2 -01 reply
2/10s390/ftrace: Serialize text patching with text_mutexarch/s390/kernel/ftrace.c+11 -01 reply
3/10s390/bpf: Serialize text patching with text_mutexarch/s390/net/bpf_jit_comp.c+17 -41 reply
4/10s390/runtime-const: Serialize text patching with text_mutexarch/s390/include/asm/runtime-const.h+2 -04 replies
5/10s390/module: Serialize text patching with text_mutexarch/s390/kernel/module.c+1 -01 reply
6/10s390/stackprotector: Serialize text patching with text_mutexarch/s390/kernel/stackprotector.c+4 -01 reply
7/10s390/nospec-branch: Serialize text patching with text_mutexarch/s390/kernel/nospec-branch.c+2 -01 reply
8/10s390/alternative: Serialize text patching with text_mutexarch/s390/kernel/alternative.c+4 -01 reply
9/10s390/uaccess: Move s390_kernel_write() to asm/text-patching.harch/s390/include/asm/runtime-const.h arch/s390/include/asm/text-patching.h arch/s390/include/asm/uaccess.h +6 more+18 -131 reply
10/10s390/maccess: Remove spinlock from __s390_kernel_write()arch/s390/include/asm/text-patching.h arch/s390/kernel/kprobes.c arch/s390/mm/maccess.c+11 -82 replies

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by.

PatchIlya Leoshkevich
1/10R-b
2/10R-b
3/10R-b
4/10R-b
5/10R-b
6/10R-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/10] s390: Consistent usage of text_mutex

v2:
- Use text mutex for all callers of s390_kernel_write(), and add lockdep checking. [Based on a review comment from Ilya Leoshkevich, and also Sashiko feedback]

- Note: this takes now the mutex also at places where it is technically not necessary (e.g. ftrace init nop patching). However this is not much of a difference to before, where the spinlock in s390_kernel_write() was always taken instead

v1:
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 (10):
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/runtime-const: Serialize text patching with text_mutex s390/module: Serialize text patching with text_mutex s390/stackprotector: Serialize text patching with text_mutex s390/nospec-branch: Serialize text patching with text_mutex s390/alternative: Serialize text patching with text_mutex s390/uaccess: Move s390_kernel_write() to asm/text-patching.h s390/maccess: Remove spinlock from __s390_kernel_write()

 arch/s390/include/asm/runtime-const.h |  4 +++-
 arch/s390/include/asm/text-patching.h | 14 ++++++++++++++
 arch/s390/include/asm/uaccess.h       |  9 ---------
 arch/s390/kernel/alternative.c        |  6 +++++-
 arch/s390/kernel/ftrace.c             | 11 +++++++++++
 arch/s390/kernel/jump_label.c         |  3 ++-
 arch/s390/kernel/kprobes.c            |  4 +++-
 arch/s390/kernel/module.c             |  2 ++
 arch/s390/kernel/nospec-branch.c      |  4 ++++
 arch/s390/kernel/stackprotector.c     |  6 +++++-
 arch/s390/mm/maccess.c                |  9 ++++-----
 arch/s390/net/bpf_jit_comp.c          | 21 +++++++++++++++++----
 12 files changed, 70 insertions(+), 23 deletions(-)
Signature · 1 line
2.53.0