[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240801132638.GA8759@redhat.com>
Date: Thu, 1 Aug 2024 15:26:38 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: andrii@...nel.org, mhiramat@...nel.org, peterz@...radead.org
Cc: jolsa@...nel.org, rostedt@...dmis.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: [PATCH v4 0/9] uprobes: misc cleanups/simplifications
(Andrii, I'll try to look at your new series on Weekend).
Changes:
- added the acks I got from Andrii, Masami, and Jiri
- new 4/9 patch from Jiri, fixes the unrelated bug in bpf_testmod
- adapt tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
to the API changes in 5/9 an 6/9
see the interdiff below.
Oleg.
---
include/linux/uprobes.h | 22 ++--
kernel/events/uprobes.c | 137 +++++++++------------
kernel/trace/bpf_trace.c | 25 ++--
kernel/trace/trace_uprobe.c | 31 ++---
.../selftests/bpf/bpf_testmod/bpf_testmod.c | 26 ++--
5 files changed, 103 insertions(+), 138 deletions(-)
-------------------------------------------------------------------------------
--- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
@@ -432,7 +432,7 @@ uprobe_ret_handler(struct uprobe_consumer *self, unsigned long func,
struct testmod_uprobe {
struct path path;
- loff_t offset;
+ struct uprobe *uprobe;
struct uprobe_consumer consumer;
};
@@ -446,25 +446,25 @@ static int testmod_register_uprobe(loff_t offset)
{
int err = -EBUSY;
- if (uprobe.offset)
+ if (uprobe.uprobe)
return -EBUSY;
mutex_lock(&testmod_uprobe_mutex);
- if (uprobe.offset)
+ if (uprobe.uprobe)
goto out;
err = kern_path("/proc/self/exe", LOOKUP_FOLLOW, &uprobe.path);
if (err)
goto out;
- err = uprobe_register_refctr(d_real_inode(uprobe.path.dentry),
- offset, 0, &uprobe.consumer);
- if (err)
+ uprobe.uprobe = uprobe_register(d_real_inode(uprobe.path.dentry),
+ offset, 0, &uprobe.consumer);
+ if (IS_ERR(uprobe.uprobe)) {
+ err = PTR_ERR(uprobe.uprobe);
path_put(&uprobe.path);
- else
- uprobe.offset = offset;
-
+ uprobe.uprobe = NULL;
+ }
out:
mutex_unlock(&testmod_uprobe_mutex);
return err;
@@ -474,10 +474,10 @@ static void testmod_unregister_uprobe(void)
{
mutex_lock(&testmod_uprobe_mutex);
- if (uprobe.offset) {
- uprobe_unregister(d_real_inode(uprobe.path.dentry),
- uprobe.offset, &uprobe.consumer);
- uprobe.offset = 0;
+ if (uprobe.uprobe) {
+ uprobe_unregister(uprobe.uprobe, &uprobe.consumer);
+ path_put(&uprobe.path);
+ uprobe.uprobe = NULL;
}
mutex_unlock(&testmod_uprobe_mutex);
Powered by blists - more mailing lists