lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 bpf-next 4/5] bpf: load and verify kernel module BTFs
Hi Andrii,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url: https://github.com/0day-ci/linux/commits/Andrii-Nakryiko/Integrate-kernel-module-BTF-support/20201110-095309
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: mips-randconfig-r002-20201110 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4d81c8adb6ed9840257f6cb6b93f60856d422a15)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/dcd763b7808fdc01ebf70bbe07ba92388df4d20d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrii-Nakryiko/Integrate-kernel-module-BTF-support/20201110-095309
git checkout dcd763b7808fdc01ebf70bbe07ba92388df4d20d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> kernel/bpf/btf.c:4481:20: warning: unused function 'btf_parse_module'
static struct btf char const void unsigned int data_size)
^
fatal error: error in backend: Nested variants found in inline asm string: ' .set push
.set mips64r2
.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/atomic.h", .line = 154, $); 0x00 ) != -1)) : $))) ) && ( 0 ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif
1: ll $1, $2 # atomic_fetch_sub
subu $0, $1, $3
sc $0, $2
beqz $0, 1b
.set pop
move $0, $1
'
clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 12.0.0 (git://gitmirror/llvm_project 874b0a0b9db93f5d3350ffe6b5efda2d908415d0)
Target: mipsel-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/cross/clang-874b0a0b9d/bin
clang-12: note: diagnostic msg:
Makefile arch drivers include kernel mm scripts source usr

vim +/btf_parse_module +4481 kernel/bpf/btf.c

4480
> 4481 static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size)
4482 {
4483 struct btf_verifier_env *env = NULL;
4484 struct bpf_verifier_log *log;
4485 struct btf *btf = NULL, *base_btf;
4486 int err;
4487
4488 base_btf = bpf_get_btf_vmlinux();
4489 if (IS_ERR(base_btf))
4490 return base_btf;
4491 if (!base_btf)
4492 return ERR_PTR(-EINVAL);
4493
4494 env = kzalloc(sizeof(*env), GFP_KERNEL | __GFP_NOWARN);
4495 if (!env)
4496 return ERR_PTR(-ENOMEM);
4497
4498 log = &env->log;
4499 log->level = BPF_LOG_KERNEL;
4500
4501 btf = kzalloc(sizeof(*btf), GFP_KERNEL | __GFP_NOWARN);
4502 if (!btf) {
4503 err = -ENOMEM;
4504 goto errout;
4505 }
4506 env->btf = btf;
4507
4508 btf->base_btf = base_btf;
4509 btf->start_id = base_btf->nr_types;
4510 btf->start_str_off = base_btf->hdr.str_len;
4511 btf->kernel_btf = true;
4512 snprintf(btf->name, sizeof(btf->name), "%s", module_name);
4513
4514 btf->data = kvmalloc(data_size, GFP_KERNEL | __GFP_NOWARN);
4515 if (!btf->data) {
4516 err = -ENOMEM;
4517 goto errout;
4518 }
4519 memcpy(btf->data, data, data_size);
4520 btf->data_size = data_size;
4521
4522 err = btf_parse_hdr(env);
4523 if (err)
4524 goto errout;
4525
4526 btf->nohdr_data = btf->data + btf->hdr.hdr_len;
4527
4528 err = btf_parse_str_sec(env);
4529 if (err)
4530 goto errout;
4531
4532 err = btf_check_all_metas(env);
4533 if (err)
4534 goto errout;
4535
4536 btf_verifier_env_free(env);
4537 refcount_set(&btf->refcnt, 1);
4538 return btf;
4539
4540 errout:
4541 btf_verifier_env_free(env);
4542 if (btf) {
4543 kvfree(btf->data);
4544 kvfree(btf->types);
4545 kfree(btf);
4546 }
4547 return ERR_PTR(err);
4548 }
4549

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-11-11 08:13    [W:1.146 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site