[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202505300432.nZC50gOu-lkp@intel.com>
Date: Mon, 2 Jun 2025 09:20:10 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Rong Tao <rtoax@...mail.com>, ast@...nel.org,
daniel@...earbox.net
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev, rtoax@...mail.com,
rongtao@...tc.cn, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Mykola Lysenko <mykolal@...com>,
Shuah Khan <skhan@...uxfoundation.org>,
Juntong Deng <juntong.deng@...look.com>,
Amery Hung <amery.hung@...edance.com>,
Dave Marchevsky <davemarchevsky@...com>,
Hou Tao <houtao1@...wei.com>,
"(open list:BPF (Safe Dynamic Programs and Tools))" <bpf@...r.kernel.org>,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH bpf-next 1/2] bpf: Add bpf_task_cwd_from_pid() kfunc
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@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.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
Powered by blists - more mailing lists