lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211222100345.412013-1-jolsa@kernel.org>
Date:   Wed, 22 Dec 2021 11:03:45 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
        Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        Masami Hiramatsu <mhiramat@...nel.org>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH] kprobe: Remove kprobe_instance and its related functions

The last user od kprobe_instance got removed in [1],
now it just occupies space, removing it.

[1] ec6aba3d2be1 ("kprobes: Remove kprobe::fault_handler")

Cc: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
 kernel/kprobes.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 21eccc961bba..d20ae8232835 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -62,7 +62,6 @@ static bool kprobes_all_disarmed;
 
 /* This protects 'kprobe_table' and 'optimizing_list' */
 static DEFINE_MUTEX(kprobe_mutex);
-static DEFINE_PER_CPU(struct kprobe *, kprobe_instance);
 
 kprobe_opcode_t * __weak kprobe_lookup_name(const char *name,
 					unsigned int __unused)
@@ -353,17 +352,6 @@ struct kprobe_insn_cache kprobe_optinsn_slots = {
 #endif
 #endif
 
-/* We have preemption disabled.. so it is safe to use __ versions */
-static inline void set_kprobe_instance(struct kprobe *kp)
-{
-	__this_cpu_write(kprobe_instance, kp);
-}
-
-static inline void reset_kprobe_instance(void)
-{
-	__this_cpu_write(kprobe_instance, NULL);
-}
-
 /*
  * This routine is called either:
  *	- under the 'kprobe_mutex' - during kprobe_[un]register().
@@ -421,11 +409,8 @@ void opt_pre_handler(struct kprobe *p, struct pt_regs *regs)
 	struct kprobe *kp;
 
 	list_for_each_entry_rcu(kp, &p->list, list) {
-		if (kp->pre_handler && likely(!kprobe_disabled(kp))) {
-			set_kprobe_instance(kp);
+		if (kp->pre_handler && likely(!kprobe_disabled(kp)))
 			kp->pre_handler(kp, regs);
-		}
-		reset_kprobe_instance();
 	}
 }
 NOKPROBE_SYMBOL(opt_pre_handler);
@@ -1177,11 +1162,9 @@ static int aggr_pre_handler(struct kprobe *p, struct pt_regs *regs)
 
 	list_for_each_entry_rcu(kp, &p->list, list) {
 		if (kp->pre_handler && likely(!kprobe_disabled(kp))) {
-			set_kprobe_instance(kp);
 			if (kp->pre_handler(kp, regs))
 				return 1;
 		}
-		reset_kprobe_instance();
 	}
 	return 0;
 }
@@ -1193,11 +1176,8 @@ static void aggr_post_handler(struct kprobe *p, struct pt_regs *regs,
 	struct kprobe *kp;
 
 	list_for_each_entry_rcu(kp, &p->list, list) {
-		if (kp->post_handler && likely(!kprobe_disabled(kp))) {
-			set_kprobe_instance(kp);
+		if (kp->post_handler && likely(!kprobe_disabled(kp)))
 			kp->post_handler(kp, regs, flags);
-			reset_kprobe_instance();
-		}
 	}
 }
 NOKPROBE_SYMBOL(aggr_post_handler);
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ