From: Jiri Olsa <olsajiri@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: bpf@vger.kernel.org
Subject: Re: [bug report] bpf: Add pid filter support for uprobe_multi link
Date: Fri, 15 Sep 2023 11:37:02 +0200 [thread overview]
Message-ID: <ZQQlvlsl1U8K4ZZ7@krava> (raw)
In-Reply-To: <c5ffa7c0-6b06-40d5-aca2-63833b5cd9af@moroto.mountain>
On Fri, Sep 15, 2023 at 10:12:34AM +0300, Dan Carpenter wrote:
> Hello Jiri Olsa,
>
> The patch b733eeade420: "bpf: Add pid filter support for uprobe_multi
> link" from Aug 9, 2023 (linux-next), leads to the following Smatch
> static checker warning:
>
> kernel/trace/bpf_trace.c:3227 bpf_uprobe_multi_link_attach()
> warn: missing error code here? 'get_pid_task()' failed. 'err' = '0'
>
> kernel/trace/bpf_trace.c
> 3217 err = -EBADF;
> 3218 goto error_path_put;
> 3219 }
> 3220
> 3221 pid = attr->link_create.uprobe_multi.pid;
> 3222 if (pid) {
> 3223 rcu_read_lock();
> 3224 task = get_pid_task(find_vpid(pid), PIDTYPE_PID);
> 3225 rcu_read_unlock();
> 3226 if (!task)
> --> 3227 goto error_path_put;
>
> Should this have an error code?
yes, it should.. I'll send the fix below
thanks,
jirka
---
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index c1c1af63ced2..868008f56fec 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -3223,8 +3223,10 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
rcu_read_lock();
task = get_pid_task(find_vpid(pid), PIDTYPE_PID);
rcu_read_unlock();
- if (!task)
+ if (!task) {
+ err = -ESRCH;
goto error_path_put;
+ }
}
err = -ENOMEM;
prev parent reply other threads:[~2023-09-15 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 7:12 [bug report] bpf: Add pid filter support for uprobe_multi link Dan Carpenter
2023-09-15 9:37 ` Jiri Olsa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZQQlvlsl1U8K4ZZ7@krava \
--to=olsajiri@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox