Skip to content

Rewrite x86/ftrace to use text_poke (and more)

Peter Zijlstra bpf linux-arm-kernel linux-tegra lkml 1 version Applied

Status from this message: The following commit has been merged into the core/kprobes branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 patches 50 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/17x86/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/17x86/alternatives: Update int3_emulate_push() commentarch/x86/include/asm/text-patching.h+3 -00 replies
3/17x86/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 -820 replies
4/17x86/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 -262 replies
5/17x86/ftrace: Use text_poke()arch/x86/include/asm/ftrace.h arch/x86/kernel/alternative.c arch/x86/kernel/ftrace.c +1 more+133 -56212 replies
6/17x86/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/17x86/alternative: Add text_opcode_size()arch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c+32 -230 replies
8/17x86/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/17x86/alternative: Remove text_poke_loc::lenarch/x86/kernel/alternative.c+7 -50 replies
10/17x86/alternative: Shrink text_poke_locarch/x86/kernel/alternative.c+14 -90 replies
11/17x86/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 -410 replies
12/17x86/kprobes: Fix orderingarch/x86/include/asm/text-patching.h arch/x86/kernel/alternative.c arch/x86/kernel/kprobes/core.c +1 more+15 -1110 replies
13/17arm/ftrace: Use __patch_text_real()arch/arm/kernel/ftrace.c+8 -84 replies
13/17arm/ftrace: Use __patch_text()arch/arm/kernel/Makefile arch/arm/kernel/ftrace.c+4 -108 replies
14/17module: Remove set_all_modules_text_*()arch/nds32/kernel/ftrace.c include/linux/module.h kernel/module.c+0 -590 replies
15/17ftrace: Rework event_create_dir()drivers/infiniband/hw/hfi1/trace_tid.h drivers/infiniband/hw/hfi1/trace_tx.h drivers/lightnvm/pblk-trace.h +18 more+213 -2491 reply
16/17x86/kprobe: Add comments to arch_{,un}optimize_kprobes()arch/x86/kernel/kprobes/opt.c+12 -20 replies
17/17x86/alternative: Use INT3_INSN_SIZEarch/x86/kernel/alternative.c+6 -60 replies

Reviews trailers per patch

6 of 18 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMasami HiramatsuDaniel Bristot de OliveiraAlexei StarovoitovWill DeaconSteven Rostedt (VMware)Paul E. McKenneyMathieu DesnoyersDmitry Osipenko
SeriesA-b T-b T-b
1/17R-b R-b
2/17
3/17R-b R-b
4/17
5/17R-b A-b
6/17
7/17
8/17
9/17
10/17
11/17A-b
12/17A-b A-b R-b
13/17T-b T-b T-b
13/17T-b T-b T-b
14/17
15/17R-b
16/17
17/17

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v1 thread

Cover letter [PATCH -v5 00/17] Rewrite x86/ftrace to use text_poke (and more)

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

The first 14 patches are the same as in the -v4 posting. The last 3 patches are new.

Will, patch 13, arm/ftrace, is unchanged. This is because this way it preserves behaviour, but if you can provide me a tested-by for the simpler variant I can drop that in.

Patch 15 reworks ftrace's event_create_dir(), which ran module code before the module was finished loading (before we even applied jump_labels and all that).

Patch 16 and 17 address minor review feedback.

Ingo, Alexei wants patch #1 for some BPF stuff, can he get that in a topic branch?