tree:
git://git.infradead.org/users/hch/misc.git maccess-fixups.3
head: ffc491b4d7cbc956087e89dbd171863c411f3868
commit: 5de7b23a3f5410a896ab792fd3e580d5f0e54258 [15/18] x86: use non-set_fs based maccess
routines
config: x86_64-randconfig-a005-20200513 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
git checkout 5de7b23a3f5410a896ab792fd3e580d5f0e54258
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
ld: kernel/trace/bpf_trace.o: in function `bpf_probe_read_kernel_str_common':
> kernel/trace/bpf_trace.c:252: undefined reference to
`strncpy_from_kernel_nofault'
> ld: kernel/trace/bpf_trace.c:252: undefined reference to
`strncpy_from_kernel_nofault'
ld: kernel/trace/bpf_trace.o: in function
`bpf_strncpy':
kernel/trace/bpf_trace.c:344: undefined reference to `strncpy_from_kernel_nofault'
vim +252 kernel/trace/bpf_trace.c
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 232
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 233 static __always_inline int
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 234 bpf_probe_read_kernel_str_common(void
*dst, u32 size, const void *unsafe_ptr,
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 235 const bool compat)
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 236 {
334a11cc65f45f1 Christoph Hellwig 2020-05-13 237 const void __user *user_ptr =
(__force const void __user *)unsafe_ptr;
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 238 int ret =
security_locked_down(LOCKDOWN_BPF_READ);
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 239
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 240 if (unlikely(ret < 0))
334a11cc65f45f1 Christoph Hellwig 2020-05-13 241 goto fail;
334a11cc65f45f1 Christoph Hellwig 2020-05-13 242
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 243 /*
334a11cc65f45f1 Christoph Hellwig 2020-05-13 244 * The strncpy_from_*_nofault() calls
will likely not fill the entire
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 245 * buffer, but that's okay in
this circumstance as we're probing
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 246 * arbitrary memory anyway similar to
bpf_probe_read_*() and might
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 247 * as well probe the stack. Thus,
memory is explicitly cleared
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 248 * only in error case, so that
improper users ignoring return
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 249 * code altogether don't copy
garbage; otherwise length of string
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 250 * is returned that can be used for
bpf_perf_event_output() et al.
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 251 */
334a11cc65f45f1 Christoph Hellwig 2020-05-13 @252 ret =
strncpy_from_kernel_nofault(dst, unsafe_ptr, size);
334a11cc65f45f1 Christoph Hellwig 2020-05-13 253 if (unlikely(ret < 0)) {
334a11cc65f45f1 Christoph Hellwig 2020-05-13 254 if (compat)
334a11cc65f45f1 Christoph Hellwig 2020-05-13 255 ret =
strncpy_from_user_nofault(dst, user_ptr, size);
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 256 if (unlikely(ret < 0))
334a11cc65f45f1 Christoph Hellwig 2020-05-13 257 goto fail;
334a11cc65f45f1 Christoph Hellwig 2020-05-13 258 }
334a11cc65f45f1 Christoph Hellwig 2020-05-13 259 return 0;
334a11cc65f45f1 Christoph Hellwig 2020-05-13 260 fail:
6ae08ae3dea2cfa Daniel Borkmann 2019-11-02 261 memset(dst, 0, size);
074f528eed408b4 Daniel Borkmann 2016-04-13 262 return ret;
2541517c32be253 Alexei Starovoitov 2015-03-25 263 }
2541517c32be253 Alexei Starovoitov 2015-03-25 264
:::::: The code at line 252 was first introduced by commit
:::::: 334a11cc65f45f12f7fb8929928e68f7fb63d26d maccess: remove strncpy_from_unsafe
:::::: TO: Christoph Hellwig <hch(a)lst.de>
:::::: CC: Christoph Hellwig <hch(a)lst.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org