tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-5.4
head: de62e075613ad8d1b4979186b1962e3ae58156f2
commit: 669072417f9719ddb1075d10a7764ddd0f9e885c [230/290] bpf: Enforce 'return 0'
in BTF-enabled raw_tp programs
config: um-randconfig-r015-20200517 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
git checkout 669072417f9719ddb1075d10a7764ddd0f9e885c
# save the attached .config to linux build tree
make ARCH=um
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/kernel.h:11:0,
from kernel/bpf/verifier.c:7:
include/asm-generic/pgtable.h: In function
'pud_none_or_trans_huge_or_dev_or_clear_bad':
include/asm-generic/pgtable.h:920:52: error: implicit declaration of function
'pud_devmap'; did you mean 'pud_val'?
[-Werror=implicit-function-declaration]
if (pud_none(pudval) || pud_trans_huge(pudval) || pud_devmap(pudval))
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) :
__trace_if_value(cond))
^~~~
include/asm-generic/pgtable.h:920:2: note: in expansion of macro 'if'
if (pud_none(pudval) || pud_trans_huge(pudval) || pud_devmap(pudval))
^~
In file included from include/linux/bvec.h:13:0,
from include/linux/skbuff.h:17,
from include/linux/filter.h:13,
from include/linux/bpf_verifier.h:8,
from kernel/bpf/verifier.c:12:
include/linux/mm.h: At top level:
include/linux/mm.h:572:19: error: static declaration of 'pud_devmap' follows
non-static declaration
static inline int pud_devmap(pud_t pud)
^~~~~~~~~~
In file included from include/linux/kernel.h:11:0,
from kernel/bpf/verifier.c:7:
include/asm-generic/pgtable.h:920:52: note: previous implicit declaration of
'pud_devmap' was here
if (pud_none(pudval) || pud_trans_huge(pudval) || pud_devmap(pudval))
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) :
__trace_if_value(cond))
^~~~
include/asm-generic/pgtable.h:920:2: note: in expansion of macro 'if'
if (pud_none(pudval) || pud_trans_huge(pudval) || pud_devmap(pudval))
^~
In file included from include/linux/kernel.h:11:0,
from kernel/bpf/verifier.c:7:
kernel/bpf/verifier.c: In function 'check_return_code':
kernel/bpf/verifier.c:6365:22: error: 'struct bpf_prog_aux' has no member named
'attach_btf_id'
if (!env->prog->aux->attach_btf_id)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) :
__trace_if_value(cond))
^~~~
> kernel/bpf/verifier.c:6365:3: note: in expansion of macro
'if'
if (!env->prog->aux->attach_btf_id)
^~
kernel/bpf/verifier.c:6365:22: error: 'struct bpf_prog_aux' has no member named
'attach_btf_id'
if (!env->prog->aux->attach_btf_id)
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) :
__trace_if_value(cond))
^~~~
> kernel/bpf/verifier.c:6365:3: note: in expansion of macro
'if'
if (!env->prog->aux->attach_btf_id)
^~
kernel/bpf/verifier.c:6365:22: error: 'struct bpf_prog_aux' has no member named
'attach_btf_id'
if (!env->prog->aux->attach_btf_id)
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ? ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~~~~~~~~~~~
> kernel/bpf/verifier.c:6365:3: note: in expansion of macro
'if'
if (!env->prog->aux->attach_btf_id)
^~
cc1: some warnings being treated as errors
vim +/if +6365 kernel/bpf/verifier.c
6339
6340 static int check_return_code(struct bpf_verifier_env *env)
6341 {
6342 struct tnum enforce_attach_type_range = tnum_unknown;
6343 struct bpf_reg_state *reg;
6344 struct tnum range = tnum_range(0, 1);
6345
6346 switch (env->prog->type) {
6347 case BPF_PROG_TYPE_CGROUP_SOCK_ADDR:
6348 if (env->prog->expected_attach_type == BPF_CGROUP_UDP4_RECVMSG ||
6349 env->prog->expected_attach_type == BPF_CGROUP_UDP6_RECVMSG)
6350 range = tnum_range(1, 1);
6351 break;
6352 case BPF_PROG_TYPE_CGROUP_SKB:
6353 if (env->prog->expected_attach_type == BPF_CGROUP_INET_EGRESS) {
6354 range = tnum_range(0, 3);
6355 enforce_attach_type_range = tnum_range(2, 3);
6356 }
6357 break;
6358 case BPF_PROG_TYPE_CGROUP_SOCK:
6359 case BPF_PROG_TYPE_SOCK_OPS:
6360 case BPF_PROG_TYPE_CGROUP_DEVICE:
6361 case BPF_PROG_TYPE_CGROUP_SYSCTL:
6362 case BPF_PROG_TYPE_CGROUP_SOCKOPT:
6363 break;
6364 case BPF_PROG_TYPE_RAW_TRACEPOINT:
6365 if (!env->prog->aux->attach_btf_id)
6366 return 0;
6367 range = tnum_const(0);
6368 break;
6369 default:
6370 return 0;
6371 }
6372
6373 reg = cur_regs(env) + BPF_REG_0;
6374 if (reg->type != SCALAR_VALUE) {
6375 verbose(env, "At program exit the register R0 is not a known value
(%s)\n",
6376 reg_type_str[reg->type]);
6377 return -EINVAL;
6378 }
6379
6380 if (!tnum_in(range, reg->var_off)) {
6381 char tn_buf[48];
6382
6383 verbose(env, "At program exit the register R0 ");
6384 if (!tnum_is_unknown(reg->var_off)) {
6385 tnum_strn(tn_buf, sizeof(tn_buf), reg->var_off);
6386 verbose(env, "has value %s", tn_buf);
6387 } else {
6388 verbose(env, "has unknown scalar value");
6389 }
6390 tnum_strn(tn_buf, sizeof(tn_buf), range);
6391 verbose(env, " should have been in %s\n", tn_buf);
6392 return -EINVAL;
6393 }
6394
6395 if (!tnum_is_unknown(enforce_attach_type_range) &&
6396 tnum_in(enforce_attach_type_range, reg->var_off))
6397 env->prog->enforce_expected_attach_type = 1;
6398 return 0;
6399 }
6400
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org