From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Rong Tao <rtoax@foxmail.com>,
ast@kernel.org, daniel@iogearbox.net
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, rtoax@foxmail.com,
rongtao@cestc.cn, Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Juntong Deng <juntong.deng@outlook.com>,
Amery Hung <amery.hung@bytedance.com>,
Dave Marchevsky <davemarchevsky@fb.com>,
Hou Tao <houtao1@huawei.com>,
"(open list:BPF (Safe Dynamic Programs and Tools))"
<bpf@vger.kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
Date: Mon, 2 Jun 2025 09:20:10 +0300 [thread overview]
Message-ID: <202505300432.nZC50gOu-lkp@intel.com> (raw)
In-Reply-To: <tencent_97F8B56B340F51DB604B482FEBF012460505@qq.com>
Hi Rong,
kernel test robot noticed the following build warnings:
url: https://github.com/intel-lab-lkp/linux/commits/Rong-Tao/selftests-bpf-Add-selftests-for-bpf_task_cwd_from_pid/20250529-113933
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/tencent_97F8B56B340F51DB604B482FEBF012460505%40qq.com
patch subject: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
config: x86_64-randconfig-161-20250529 (https://download.01.org/0day-ci/archive/20250530/202505300432.nZC50gOu-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202505300432.nZC50gOu-lkp@intel.com/
smatch warnings:
kernel/bpf/helpers.c:2687 bpf_task_cwd_from_pid() warn: inconsistent returns 'rcu_read'.
vim +/rcu_read +2687 kernel/bpf/helpers.c
b24383bde5a454 Rong Tao 2025-05-29 2657 __bpf_kfunc int bpf_task_cwd_from_pid(s32 pid, char *buf, u32 buf_len)
b24383bde5a454 Rong Tao 2025-05-29 2658 {
b24383bde5a454 Rong Tao 2025-05-29 2659 struct path pwd;
b24383bde5a454 Rong Tao 2025-05-29 2660 char kpath[256], *path;
b24383bde5a454 Rong Tao 2025-05-29 2661 struct task_struct *task;
b24383bde5a454 Rong Tao 2025-05-29 2662
b24383bde5a454 Rong Tao 2025-05-29 2663 if (!buf || buf_len == 0)
b24383bde5a454 Rong Tao 2025-05-29 2664 return -EINVAL;
b24383bde5a454 Rong Tao 2025-05-29 2665
b24383bde5a454 Rong Tao 2025-05-29 2666 rcu_read_lock();
b24383bde5a454 Rong Tao 2025-05-29 2667 task = pid_task(find_vpid(pid), PIDTYPE_PID);
b24383bde5a454 Rong Tao 2025-05-29 2668 if (!task) {
b24383bde5a454 Rong Tao 2025-05-29 2669 rcu_read_unlock();
b24383bde5a454 Rong Tao 2025-05-29 2670 return -ESRCH;
b24383bde5a454 Rong Tao 2025-05-29 2671 }
b24383bde5a454 Rong Tao 2025-05-29 2672 task_lock(task);
b24383bde5a454 Rong Tao 2025-05-29 2673 if (!task->fs) {
b24383bde5a454 Rong Tao 2025-05-29 2674 task_unlock(task);
b24383bde5a454 Rong Tao 2025-05-29 2675 return -ENOENT;
rcu_read_unlock();
b24383bde5a454 Rong Tao 2025-05-29 2676 }
b24383bde5a454 Rong Tao 2025-05-29 2677 get_fs_pwd(task->fs, &pwd);
b24383bde5a454 Rong Tao 2025-05-29 2678 task_unlock(task);
b24383bde5a454 Rong Tao 2025-05-29 2679 rcu_read_unlock();
b24383bde5a454 Rong Tao 2025-05-29 2680
b24383bde5a454 Rong Tao 2025-05-29 2681 path = d_path(&pwd, kpath, sizeof(kpath));
b24383bde5a454 Rong Tao 2025-05-29 2682 path_put(&pwd);
b24383bde5a454 Rong Tao 2025-05-29 2683 if (IS_ERR(path))
b24383bde5a454 Rong Tao 2025-05-29 2684 return PTR_ERR(path);
b24383bde5a454 Rong Tao 2025-05-29 2685
b24383bde5a454 Rong Tao 2025-05-29 2686 strncpy(buf, path, buf_len);
b24383bde5a454 Rong Tao 2025-05-29 @2687 return 0;
b24383bde5a454 Rong Tao 2025-05-29 2688 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
Date: Fri, 30 May 2025 04:30:59 +0800 [thread overview]
Message-ID: <202505300432.nZC50gOu-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <tencent_97F8B56B340F51DB604B482FEBF012460505@qq.com>
References: <tencent_97F8B56B340F51DB604B482FEBF012460505@qq.com>
TO: Rong Tao <rtoax@foxmail.com>
TO: ast@kernel.org
TO: daniel@iogearbox.net
CC: rtoax@foxmail.com
CC: rongtao@cestc.cn
CC: Andrii Nakryiko <andrii@kernel.org>
CC: Martin KaFai Lau <martin.lau@linux.dev>
CC: Eduard Zingerman <eddyz87@gmail.com>
CC: Song Liu <song@kernel.org>
CC: Yonghong Song <yonghong.song@linux.dev>
CC: John Fastabend <john.fastabend@gmail.com>
CC: KP Singh <kpsingh@kernel.org>
CC: Stanislav Fomichev <sdf@fomichev.me>
CC: Hao Luo <haoluo@google.com>
CC: Jiri Olsa <jolsa@kernel.org>
CC: Mykola Lysenko <mykolal@fb.com>
CC: Shuah Khan <skhan@linuxfoundation.org>
CC: Juntong Deng <juntong.deng@outlook.com>
CC: Amery Hung <amery.hung@bytedance.com>
CC: Dave Marchevsky <davemarchevsky@fb.com>
CC: Hou Tao <houtao1@huawei.com>
CC: "(open list:BPF \(Safe Dynamic Programs and Tools\))" <bpf@vger.kernel.org> (open list:BPF (Safe Dynamic Programs and Tools))
CC: linux-kernel@vger.kernel.org
CC: linux-kselftest@vger.kernel.org
Hi Rong,
kernel test robot noticed the following build warnings:
[auto build test WARNING on bpf-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Rong-Tao/selftests-bpf-Add-selftests-for-bpf_task_cwd_from_pid/20250529-113933
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/tencent_97F8B56B340F51DB604B482FEBF012460505%40qq.com
patch subject: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago
config: x86_64-randconfig-161-20250529 (https://download.01.org/0day-ci/archive/20250530/202505300432.nZC50gOu-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202505300432.nZC50gOu-lkp@intel.com/
smatch warnings:
kernel/bpf/helpers.c:2687 bpf_task_cwd_from_pid() warn: inconsistent returns 'rcu_read'.
vim +/rcu_read +2687 kernel/bpf/helpers.c
675c3596ff32c0 Juntong Deng 2024-10-14 2649
b24383bde5a454 Rong Tao 2025-05-29 2650 /**
b24383bde5a454 Rong Tao 2025-05-29 2651 * bpf_task_cwd_from_pid - Get a task's absolute pathname of the current
b24383bde5a454 Rong Tao 2025-05-29 2652 * working directory from its pid.
b24383bde5a454 Rong Tao 2025-05-29 2653 * @pid: The pid of the task being looked up.
b24383bde5a454 Rong Tao 2025-05-29 2654 * @buf: The array pointed to by buf.
b24383bde5a454 Rong Tao 2025-05-29 2655 * @buf_len: buf length.
b24383bde5a454 Rong Tao 2025-05-29 2656 */
b24383bde5a454 Rong Tao 2025-05-29 2657 __bpf_kfunc int bpf_task_cwd_from_pid(s32 pid, char *buf, u32 buf_len)
b24383bde5a454 Rong Tao 2025-05-29 2658 {
b24383bde5a454 Rong Tao 2025-05-29 2659 struct path pwd;
b24383bde5a454 Rong Tao 2025-05-29 2660 char kpath[256], *path;
b24383bde5a454 Rong Tao 2025-05-29 2661 struct task_struct *task;
b24383bde5a454 Rong Tao 2025-05-29 2662
b24383bde5a454 Rong Tao 2025-05-29 2663 if (!buf || buf_len == 0)
b24383bde5a454 Rong Tao 2025-05-29 2664 return -EINVAL;
b24383bde5a454 Rong Tao 2025-05-29 2665
b24383bde5a454 Rong Tao 2025-05-29 2666 rcu_read_lock();
b24383bde5a454 Rong Tao 2025-05-29 2667 task = pid_task(find_vpid(pid), PIDTYPE_PID);
b24383bde5a454 Rong Tao 2025-05-29 2668 if (!task) {
b24383bde5a454 Rong Tao 2025-05-29 2669 rcu_read_unlock();
b24383bde5a454 Rong Tao 2025-05-29 2670 return -ESRCH;
b24383bde5a454 Rong Tao 2025-05-29 2671 }
b24383bde5a454 Rong Tao 2025-05-29 2672 task_lock(task);
b24383bde5a454 Rong Tao 2025-05-29 2673 if (!task->fs) {
b24383bde5a454 Rong Tao 2025-05-29 2674 task_unlock(task);
b24383bde5a454 Rong Tao 2025-05-29 2675 return -ENOENT;
b24383bde5a454 Rong Tao 2025-05-29 2676 }
b24383bde5a454 Rong Tao 2025-05-29 2677 get_fs_pwd(task->fs, &pwd);
b24383bde5a454 Rong Tao 2025-05-29 2678 task_unlock(task);
b24383bde5a454 Rong Tao 2025-05-29 2679 rcu_read_unlock();
b24383bde5a454 Rong Tao 2025-05-29 2680
b24383bde5a454 Rong Tao 2025-05-29 2681 path = d_path(&pwd, kpath, sizeof(kpath));
b24383bde5a454 Rong Tao 2025-05-29 2682 path_put(&pwd);
b24383bde5a454 Rong Tao 2025-05-29 2683 if (IS_ERR(path))
b24383bde5a454 Rong Tao 2025-05-29 2684 return PTR_ERR(path);
b24383bde5a454 Rong Tao 2025-05-29 2685
b24383bde5a454 Rong Tao 2025-05-29 2686 strncpy(buf, path, buf_len);
b24383bde5a454 Rong Tao 2025-05-29 @2687 return 0;
b24383bde5a454 Rong Tao 2025-05-29 2688 }
b24383bde5a454 Rong Tao 2025-05-29 2689
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next parent reply other threads:[~2025-06-02 6:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 20:30 kernel test robot [this message]
2025-06-02 6:20 ` [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc Dan Carpenter
[not found] <cover.1748488784.git.rtoax@foxmail.com>
2025-05-29 3:32 ` Rong Tao
2025-05-29 5:44 ` Alexei Starovoitov
2025-05-30 1:28 ` Rong Tao
2025-05-30 1:55 ` Yonghong Song
2025-05-30 6:34 ` Rong Tao
2025-05-29 3:32 ` [PATCH bpf-next 2/2] selftests/bpf: Add selftests for bpf_task_cwd_from_pid() Rong Tao
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=202505300432.nZC50gOu-lkp@intel.com \
--to=dan.carpenter@linaro.org \
--cc=amery.hung@bytedance.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davemarchevsky@fb.com \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=houtao1@huawei.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=juntong.deng@outlook.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lkp@intel.com \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=rongtao@cestc.cn \
--cc=rtoax@foxmail.com \
--cc=sdf@fomichev.me \
--cc=skhan@linuxfoundation.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.