Skip to contentSkip to conversation

kprobes: trivial cleanups

PATCH New Masami Hiramatsu 2 participants 5 messages Feb 6, 2017

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

cover kprobes: trivial cleanups

Hi,

Here are two trivial cleanups. Both may make no actual meaningful changes, just clarify what is needed.
- [1/2] Remove unneeded dependency of CONFIG_HAVE_KRETPROBES on arm64
- [2/2] Use hlist_for_each_entry() for non-modify loop.

Thank you,

---

Masami Hiramatsu (2):
arm64: kprobes: Remove redundant dependency in Kconfig
kprobes: x86: Use hlist_for_each_entry() for first loop

 arch/arm64/Kconfig             |    2 +-
 arch/x86/kernel/kprobes/core.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
Masami Hiramatsu

#1 lore raw

PATCH 1/2 arm64: kprobes: Remove redundant dependency in Kconfig

Remove redundant dependency of HAVE_KRETPROBES to HAVE_KPROBES in arm64 Kconfig. Since HAVE_KPROBES always selected above line, we don't have to check it at HAVE_KRETPROBES.

CC Sandeepa Prabhu <[email protected]>
CC David A. Long <[email protected]>
CC Catalin Marinas <[email protected]>
---
 arch/arm64/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Kconfig +1 -1
index 1117421..f7dfd6d5 100644
@@ -96,7 +96,7 @@ config ARM64
 	select HAVE_RCU_TABLE_FREE
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KPROBES
-	select HAVE_KRETPROBES if HAVE_KPROBES
+	select HAVE_KRETPROBES
 	select IOMMU_DMA if IOMMU_SUPPORT
 	select IRQ_DOMAIN
 	select IRQ_FORCED_THREADING
#2 lore raw

[tip:perf/core] kprobes/arm64: Remove a redundant dependency from the Kconfig

kprobes/arm64: Remove a redundant dependency from the Kconfig
Commit-ID:  cd1ee3b1e30b4c6c0858e0c0b4ca1b4d86020ada
Gitweb:     http://git.kernel.org/tip/cd1ee3b1e30b4c6c0858e0c0b4ca1b4d86020ada
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 6 Feb 2017 18:54:33 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Feb 2017 11:07:06 +0100

kprobes/arm64: Remove a redundant dependency from the Kconfig

Remove the 'HAVE_KPROBES' dependency from the HAVE_KRETPROBES line, since HAVE_KPROBES is already selected unconditionally in the Kconfig line above this one.

Cc Ananth N Mavinakayanahalli <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David A. Long <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sandeepa Prabhu <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/arm64/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Kconfig +1 -1
index 1117421..f7dfd6d5 100644
@@ -96,7 +96,7 @@ config ARM64
 	select HAVE_RCU_TABLE_FREE
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KPROBES
-	select HAVE_KRETPROBES if HAVE_KPROBES
+	select HAVE_KRETPROBES
 	select IOMMU_DMA if IOMMU_SUPPORT
 	select IRQ_DOMAIN
 	select IRQ_FORCED_THREADING
#3 lore raw

PATCH 2/2 kprobes: x86: Use hlist_for_each_entry() for first loop

In reply to Masami Hiramatsu

Use hlist_for_each_entry() for first loop on kretprobe trampoline_handler because it doesn't change the hlist.

---
 arch/x86/kernel/kprobes/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +1 -1
index eb35093..520b8df 100644
@@ -745,7 +745,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 	 *	 will be the real return address, and all the rest will
 	 *	 point to kretprobe_trampoline.
 	 */
-	hlist_for_each_entry_safe(ri, tmp, head, hlist) {
+	hlist_for_each_entry(ri, head, hlist) {
 		if (ri->task != current)
 			/* another task is sharing our hash bucket */
 			continue;
#4 lore raw

[tip:perf/core] kprobes/x86: Use hlist_for_each_entry() instead of hlist_for_each_entry_safe()

kprobes/x86: Use hlist_for_each_entry() instead of hlist_for_each_entry_safe()
Commit-ID:  b6263178b8dbd9fe70d55f136c2a1da39309520e
Gitweb:     http://git.kernel.org/tip/b6263178b8dbd9fe70d55f136c2a1da39309520e
Author:     Masami Hiramatsu <[email protected]>
AuthorDate: Mon, 6 Feb 2017 18:55:43 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 6 Feb 2017 11:07:07 +0100

kprobes/x86: Use hlist_for_each_entry() instead of hlist_for_each_entry_safe()

Use hlist_for_each_entry() in the first loop in the kretprobe trampoline_handler() function, because it doesn't change the hlist.

---
 arch/x86/kernel/kprobes/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +1 -1
index eb35093..520b8df 100644
@@ -745,7 +745,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 	 *	 will be the real return address, and all the rest will
 	 *	 point to kretprobe_trampoline.
 	 */
-	hlist_for_each_entry_safe(ri, tmp, head, hlist) {
+	hlist_for_each_entry(ri, head, hlist) {
 		if (ri->task != current)
 			/* another task is sharing our hash bucket */
 			continue;