From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: kernel test robot <lkp@intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
martin.lau@kernel.org, oe-kbuild-all@lists.linux.dev,
cyphar@cyphar.com, brauner@kernel.org, lennart@poettering.net,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next 1/3] bpf: support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands
Date: Thu, 18 May 2023 17:19:10 -0700 [thread overview]
Message-ID: <CAEf4BzYW_OXeF=5L1XU5025-VbWN3M-wOSszXqMD6c5E9bEO9w@mail.gmail.com> (raw)
In-Reply-To: <202305190724.nnh1ZV2F-lkp@intel.com>
On Thu, May 18, 2023 at 4:59 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Andrii,
>
> 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/Andrii-Nakryiko/bpf-support-O_PATH-FDs-in-BPF_OBJ_PIN-and-BPF_OBJ_GET-commands/20230519-060110
> base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> patch link: https://lore.kernel.org/r/20230518215444.1418789-2-andrii%40kernel.org
> patch subject: [PATCH v2 bpf-next 1/3] bpf: support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands
> config: m68k-allyesconfig
> compiler: m68k-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/74f08e59c3fccac04b3c080831615209e11be4fb
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Andrii-Nakryiko/bpf-support-O_PATH-FDs-in-BPF_OBJ_PIN-and-BPF_OBJ_GET-commands/20230519-060110
> git checkout 74f08e59c3fccac04b3c080831615209e11be4fb
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash kernel/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202305190724.nnh1ZV2F-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> kernel/bpf/syscall.c: In function 'bpf_obj_get':
> >> kernel/bpf/syscall.c:2720:13: warning: variable 'path_fd' set but not used [-Wunused-but-set-variable]
> 2720 | int path_fd;
> | ^~~~~~~
>
>
> vim +/path_fd +2720 kernel/bpf/syscall.c
>
> 2717
> 2718 static int bpf_obj_get(const union bpf_attr *attr)
> 2719 {
> > 2720 int path_fd;
> 2721
> 2722 if (CHECK_ATTR(BPF_OBJ) || attr->bpf_fd != 0 ||
> 2723 attr->file_flags & ~(BPF_OBJ_FLAG_MASK | BPF_F_PATH_FD))
> 2724 return -EINVAL;
> 2725
> 2726 /* path_fd has to be accompanied by BPF_F_PATH_FD flag */
> 2727 if (!(attr->file_flags & BPF_F_PATH_FD) && attr->path_fd)
> 2728 return -EINVAL;
> 2729
> 2730 path_fd = attr->file_flags & BPF_F_PATH_FD ? attr->path_fd : AT_FDCWD;
> 2731 return bpf_obj_get_user(attr->path_fd, u64_to_user_ptr(attr->pathname),
argh.... s/attr->path_fd/path_fd/ here, but it's curious how tests
didn't catch this because we always provide absolute path in
attr->pathname, and from openat() man page:
If pathname is absolute, then dirfd is ignored.
So whatever garbage FD is passed in (in this case 0), the kernel won't
complain. Interesting. I'll send v3 with a fix.
> 2732 attr->file_flags);
> 2733 }
> 2734
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2023-05-19 0:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 21:54 [PATCH v2 bpf-next 0/3] Add O_PATH-based BPF_OBJ_PIN and BPF_OBJ_GET support Andrii Nakryiko
2023-05-18 21:54 ` [PATCH v2 bpf-next 1/3] bpf: support O_PATH FDs in BPF_OBJ_PIN and BPF_OBJ_GET commands Andrii Nakryiko
2023-05-18 23:58 ` kernel test robot
2023-05-19 0:19 ` Andrii Nakryiko [this message]
2023-05-19 0:53 ` Alexei Starovoitov
2023-05-19 2:42 ` Andrii Nakryiko
2023-05-19 9:49 ` Christian Brauner
2023-05-19 12:37 ` Christian Brauner
2023-05-19 16:01 ` Andrii Nakryiko
2023-05-20 13:39 ` Christian Brauner
2023-05-18 21:54 ` [PATCH v2 bpf-next 2/3] libbpf: add opts-based bpf_obj_pin() API and add support for path_fd Andrii Nakryiko
2023-05-18 21:54 ` [PATCH v2 bpf-next 3/3] selftests/bpf: add path_fd-based BPF_OBJ_PIN and BPF_OBJ_GET tests Andrii Nakryiko
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='CAEf4BzYW_OXeF=5L1XU5025-VbWN3M-wOSszXqMD6c5E9bEO9w@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=cyphar@cyphar.com \
--cc=daniel@iogearbox.net \
--cc=lennart@poettering.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=martin.lau@kernel.org \
--cc=oe-kbuild-all@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).