Skip to contentSkip to conversation

kretprobes for parisc / cleanups

PATCH In review Sven Schnelle 2 participants 6 messages Apr 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover kretprobes for parisc / cleanups

Hi,

this patchset implements kretprobes for PA-RISC. While working on kretprobes i've also made some minor fixes.

Sven Schnelle (4):
parisc: remove kprobes.h from generic-y
parisc: Implement kretprobes
doc: update kprobes supported architecture list
parisc: remove unused flags parameter in __patch_text()

 .../features/debug/kprobes/arch-support.txt   |   2 +-
 Documentation/kprobes.txt                     |   1 +
 arch/parisc/Kconfig                           |   1 +
 arch/parisc/include/asm/Kbuild                |   1 -
 arch/parisc/kernel/kprobes.c                  | 110 +++++++++++++++++-
 arch/parisc/kernel/patch.c                    |   9 +-
 6 files changed, 116 insertions(+), 8 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 parisc: remove kprobes.h from generic-y

We're providing our own version now.

---
 arch/parisc/include/asm/Kbuild | 1 -
 1 file changed, 1 deletion(-)
arch/parisc/include/asm/Kbuild +0 -1
index 9bcd0c903dbb..630a179363c2 100644
@@ -10,7 +10,6 @@ generic-y += hw_irq.h
 generic-y += irq_regs.h
 generic-y += irq_work.h
 generic-y += kdebug.h
-generic-y += kprobes.h
 generic-y += kvm_para.h
 generic-y += local.h
 generic-y += local64.h
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 parisc: Implement kretprobes

In reply to Sven Schnelle

Implement kretprobes on parisc, parts stolen from powerpc.

---
 arch/parisc/Kconfig          |   1 +
 arch/parisc/kernel/kprobes.c | 110 ++++++++++++++++++++++++++++++++++-
 2 files changed, 110 insertions(+), 1 deletion(-)
arch/parisc/Kconfig +1 -0
index 7712688608f4..c8038165b81f 100644
@@ -56,6 +56,7 @@ config PARISC
 	select NEED_SG_DMA_LENGTH
 	select HAVE_ARCH_KGDB
 	select HAVE_KPROBES
+	select HAVE_KRETPROBES
 
 	help
 	  The PA-RISC microprocessor is designed by Hewlett-Packard and used
arch/parisc/kernel/kprobes.c +109 -1

120 lines not on this page · raw message

Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/4 doc: update kprobes supported architecture list

In reply to Sven Schnelle

Now that kprobes and kretprobes are implemented, update the list in Documentation to reflect that.

---
 Documentation/features/debug/kprobes/arch-support.txt | 2 +-
 Documentation/kprobes.txt                             | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Documentation/features/debug/kprobes/arch-support.txt +1 -1
index f4e45bd58fea..e68239b5d2f0 100644
@@ -21,7 +21,7 @@
     |       nds32: | TODO |
     |       nios2: | TODO |
     |    openrisc: | TODO |
-    |      parisc: | TODO |
+    |      parisc: |  ok  |
     |     powerpc: |  ok  |
     |       riscv: |  ok  |
     |        s390: |  ok  |
Documentation/kprobes.txt +1 -0
index 10f4499e677c..33041300d1ee 100644
@@ -321,6 +321,7 @@ architectures:
 - ppc
 - mips
 - s390
+- parisc
 
 Configuring Kprobes
 ===================
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/4 parisc: remove unused flags parameter in __patch_text()

In reply to Sven Schnelle

It's not used by patch_map()/patch_unmap(), so lets remove it.

---
 arch/parisc/kernel/patch.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
arch/parisc/kernel/patch.c +4 -5
index 4a3bff87b177..64b0867b09d7 100644
@@ -20,7 +20,7 @@ struct patch {
 	unsigned int insn;
 };
 
-static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
+static void __kprobes *patch_map(void *addr, int fixmap)
 {
 	unsigned int uintaddr = (uintptr_t) addr;
 	bool module = !core_kernel_text(uintaddr);
@@ -38,22 +38,21 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
 	return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK));
 }
 
-static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
+static void __kprobes patch_unmap(int fixmap)
 {
 	clear_fixmap(fixmap);
 }
 
 void __kprobes __patch_text(void *addr, unsigned int insn)
 {
-	unsigned long flags;
 	void *waddr = addr;
 	int size;
 
-	waddr = patch_map(addr, FIX_TEXT_POKE0, &flags);
+	waddr = patch_map(addr, FIX_TEXT_POKE0);
 	*(u32 *)waddr = insn;
 	size = sizeof(u32);
 	flush_kernel_vmap_range(waddr, size);
-	patch_unmap(FIX_TEXT_POKE0, &flags);
+	patch_unmap(FIX_TEXT_POKE0);
 	flush_icache_range((uintptr_t)(addr),
 			   (uintptr_t)(addr) + size);
 }
Signature · 1 line
2.20.1
maintainer
#5 lore raw
In reply to Sven Schnelle
Quoted 9 lines · Sven Schnelle

this patchset implements kretprobes for PA-RISC. While working on kretprobes i've also made some minor fixes.

Sven Schnelle (4):
parisc: remove kprobes.h from generic-y
parisc: Implement kretprobes
doc: update kprobes supported architecture list
parisc: remove unused flags parameter in __patch_text()

Quoted 7 lines
 .../features/debug/kprobes/arch-support.txt   |   2 +-
 Documentation/kprobes.txt                     |   1 +
 arch/parisc/Kconfig                           |   1 +
 arch/parisc/include/asm/Kbuild                |   1 -
 arch/parisc/kernel/kprobes.c                  | 110 +++++++++++++++++-
 arch/parisc/kernel/patch.c                    |   9 +-
 6 files changed, 116 insertions(+), 8 deletions(-)

Thanks!
Applied to my for-next branch.

Helge