Skip to content

kprobes/x86: Another way to make insn buffer RO and cleanup

Masami Hiramatsu lkml 1 version In review

Get series with b4
b4 am 150304456422.17009.11803713159528262211.stgit@devbox

Versions newest first

  1. v3 Latest2 patches 2 repliesIn review

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kprobes/x86: Make insn buffer always ROX and use text_pokearch/x86/kernel/kprobes/common.h arch/x86/kernel/kprobes/core.c arch/x86/kernel/kprobes/opt.c +1 more+81 -530 replies
2/2kprobes/x86: Remove addressof operatorsarch/x86/include/asm/kprobes.h arch/x86/kernel/kprobes/opt.c+6 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH -tip v3 0/2] kprobes/x86: Another way to make insn buffer RO and cleanup

Hi,

This series modifies how to handle RO insn buffer and cleans up addressof operators.

The 1st patch changes the RO insn buffer handling: instead of using set_memory_ro/rw to modify the buffer, it prepares new instructions in another buffer and write it with text_poke() as suggested by Ingo Molnar (Thanks!). Since the text_poke() is safely modifying code by mapping alias pages, it can write RO pages.
This also override alloc_insn_page() so that it returns ROX page directly.

The 2nd one is not changed. It is a cleanup patch to remove addressof operators ("&") since
it is meaningless anymore.

V3 has just a following update:
- [1/2] Not to just add set_memory_ro(), introduce new patch to change the way to handle RO pages.

Thanks,

---

Masami Hiramatsu (2):
kprobes/x86: Make insn buffer always ROX and use text_poke kprobes/x86: Remove addressof operators

 arch/x86/include/asm/kprobes.h   |    4 +-
 arch/x86/kernel/kprobes/common.h |    6 ++-
 arch/x86/kernel/kprobes/core.c   |   61 +++++++++++++++++++++------------
 arch/x86/kernel/kprobes/opt.c    |   71 +++++++++++++++++++++-----------------
 kernel/kprobes.c                 |    2 +
 5 files changed, 86 insertions(+), 58 deletions(-)

--
Masami Hiramatsu <[email protected]>