Skip to content

Rewrite x86/ftrace to use text_poke (and more)

Peter Zijlstra live-patching lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest16 patches 53 repliesIn review
  2. v36 patches 82 repliesSuperseded
  3. v13 patches 56 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16x86/alternatives: Teach text_poke_bp() to emulate instructionsarch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/jump_label.c +1 more+130 -460 replies
2/16x86/alternatives: Update int3_emulate_push() commentarch/x86/include/asm/text-patching.h+3 -00 replies
3/16x86/alternatives,jump_label: Provide better text_poke() batching interfacearch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/jump_label.c+96 -822 replies
4/16x86/alternatives: Add and use text_gen_insn() helperarch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/jump_label.c +1 more+50 -260 replies
5/16x86/ftrace: Use text_poke()arch/x86/include/asm/ftrace.h arch/x86/kernel/alternative.c arch/x86/kernel/ftrace.c +1 more+133 -5620 replies
6/16x86/mm: Remove set_kernel_text_r[ow]()arch/x86/include/asm/set_memory.h arch/x86/mm/init_32.c arch/x86/mm/init_64.c+0 -660 replies
7/16x86/alternative: Add text_opcode_size()arch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c+32 -230 replies
8/16x86/ftrace: Use text_gen_insn()arch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/ftrace.c+31 -520 replies
9/16x86/alternative: Remove text_poke_loc::lenarch/x86/kernel/alternative.c+7 -52 replies
10/16x86/alternative: Shrink text_poke_locarch/x86/kernel/alternative.c+14 -93 replies
11/16x86/kprobes: Convert to text-patching.harch/x86/include/asm/kprobes.h arch/x86/include/asm/text-patching.h arch/x86/kernel/kprobes/core.c +1 more+37 -411 reply
12/16x86/kprobes: Fix orderingarch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/kprobes/core.c +1 more+15 -112 replies
13/16arm/ftrace: Use __patch_text_real()arch/arm/kernel/ftrace.c+8 -85 replies
14/16module: Remove set_all_modules_text_*()arch/nds32/kernel/ftrace.c include/linux/module.h kernel/module.c+0 -590 replies
15/16module: Move where we mark modules RO,Xkernel/module.c+4 -435 replies
16/16ftrace: Merge ftrace_module_{init,enable}()include/linux/ftrace.h kernel/module.c kernel/trace/ftrace.c+49 -801 reply

Reviews trailers per patch

4 of 16 patches have a Reviewed-by or Acked-by.

PatchMasami HiramatsuDaniel Bristot de Oliveira
1/16R-b R-b
2/16
3/16R-b R-b
4/16
5/16
6/16
7/16
8/16
9/16
10/16
11/16A-b
12/16A-b
13/16
14/16
15/16
16/16

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

Read the v4 thread

Cover letter [PATCH v4 00/16] Rewrite x86/ftrace to use text_poke (and more)

Ftrace was one of the last W^X violators (and KLP it seems). These here patches move it over to the generic text_poke() interface and thereby get rid of this oddity.

The first 6 or so patches are more or less the same as in v3, except it has the bugs fixed that Steve found:

- boot time function tracing works
- module loading with function tracing works

Then there's 10 new patches, that go all over the place, mostly inspired by staring at code touched by the first 6. That is, there's further ftrace and kprobes cleanups, as well fixes for various issues.

In the end, it will have removed the horrible set_all_modules_text_*() interface and reduced the ftrace module loading to a single callback (again).

The ARM patch is compiled only, I would be much obliged if someone could test that.