[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202211221056.OqCdm5vT-lkp@intel.com>
Date: Tue, 22 Nov 2022 10:43:19 +0800
From: kernel test robot <lkp@...el.com>
To: Roberto Sassu <roberto.sassu@...weicloud.com>, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, martin.lau@...ux.dev,
song@...nel.org, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com,
jolsa@...nel.org, revest@...omium.org, jackmanb@...omium.org,
paul@...l-moore.com, jmorris@...ei.org, serge@...lyn.com
Cc: oe-kbuild-all@...ts.linux.dev, bpf@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PoC][PATCH] bpf: Call return value check function in the JITed
code
Hi Roberto,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on ]
url: https://github.com/intel-lab-lkp/linux/commits/UPDATE-20221116-234919/Roberto-Sassu/security-Ensure-LSMs-return-expected-values/20221116-020057
base: the 4th patch of https://lore.kernel.org/r/20221115175652.3836811-5-roberto.sassu%40huaweicloud.com
patch link: https://lore.kernel.org/r/20221116154712.4115929-1-roberto.sassu%40huaweicloud.com
patch subject: [PoC][PATCH] bpf: Call return value check function in the JITed code
config: arm64-randconfig-r021-20221121
compiler: aarch64-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/8d9a4cbc633baa0bb3f9945b999f4cd0ab5cc6bb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review UPDATE-20221116-234919/Roberto-Sassu/security-Ensure-LSMs-return-expected-values/20221116-020057
git checkout 8d9a4cbc633baa0bb3f9945b999f4cd0ab5cc6bb
# 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=arm64 SHELL=/bin/bash arch/arm64/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
arch/arm64/net/bpf_jit_comp.c: In function 'arch_prepare_bpf_trampoline':
arch/arm64/net/bpf_jit_comp.c:1998:63: warning: passing argument 5 of 'prepare_trampoline' makes pointer from integer without a cast [-Wint-conversion]
1998 | ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nargs, flags);
| ^~~~~
| |
| int
arch/arm64/net/bpf_jit_comp.c:1767:37: note: expected 'void *' but argument is of type 'int'
1767 | void *ret_check_call, int nargs, u32 flags)
| ~~~~~~^~~~~~~~~~~~~~
>> arch/arm64/net/bpf_jit_comp.c:1998:15: error: too few arguments to function 'prepare_trampoline'
1998 | ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nargs, flags);
| ^~~~~~~~~~~~~~~~~~
arch/arm64/net/bpf_jit_comp.c:1765:12: note: declared here
1765 | static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
| ^~~~~~~~~~~~~~~~~~
vim +/prepare_trampoline +1998 arch/arm64/net/bpf_jit_comp.c
efc9909fdce00a8 Xu Kuohai 2022-07-11 1962
efc9909fdce00a8 Xu Kuohai 2022-07-11 1963 int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
efc9909fdce00a8 Xu Kuohai 2022-07-11 1964 void *image_end, const struct btf_func_model *m,
efc9909fdce00a8 Xu Kuohai 2022-07-11 1965 u32 flags, struct bpf_tramp_links *tlinks,
8d9a4cbc633baa0 Roberto Sassu 2022-11-16 1966 void *orig_call, void *ret_check_call)
efc9909fdce00a8 Xu Kuohai 2022-07-11 1967 {
eb707dde264af5e Yonghong Song 2022-08-31 1968 int i, ret;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1969 int nargs = m->nr_args;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1970 int max_insns = ((long)image_end - (long)image) / AARCH64_INSN_SIZE;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1971 struct jit_ctx ctx = {
efc9909fdce00a8 Xu Kuohai 2022-07-11 1972 .image = NULL,
efc9909fdce00a8 Xu Kuohai 2022-07-11 1973 .idx = 0,
efc9909fdce00a8 Xu Kuohai 2022-07-11 1974 };
efc9909fdce00a8 Xu Kuohai 2022-07-11 1975
efc9909fdce00a8 Xu Kuohai 2022-07-11 1976 /* the first 8 arguments are passed by registers */
efc9909fdce00a8 Xu Kuohai 2022-07-11 1977 if (nargs > 8)
efc9909fdce00a8 Xu Kuohai 2022-07-11 1978 return -ENOTSUPP;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1979
eb707dde264af5e Yonghong Song 2022-08-31 1980 /* don't support struct argument */
eb707dde264af5e Yonghong Song 2022-08-31 1981 for (i = 0; i < MAX_BPF_FUNC_ARGS; i++) {
eb707dde264af5e Yonghong Song 2022-08-31 1982 if (m->arg_flags[i] & BTF_FMODEL_STRUCT_ARG)
eb707dde264af5e Yonghong Song 2022-08-31 1983 return -ENOTSUPP;
eb707dde264af5e Yonghong Song 2022-08-31 1984 }
eb707dde264af5e Yonghong Song 2022-08-31 1985
8d9a4cbc633baa0 Roberto Sassu 2022-11-16 1986 ret = prepare_trampoline(&ctx, im, tlinks, orig_call, ret_check_call,
8d9a4cbc633baa0 Roberto Sassu 2022-11-16 1987 nargs, flags);
efc9909fdce00a8 Xu Kuohai 2022-07-11 1988 if (ret < 0)
efc9909fdce00a8 Xu Kuohai 2022-07-11 1989 return ret;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1990
efc9909fdce00a8 Xu Kuohai 2022-07-11 1991 if (ret > max_insns)
efc9909fdce00a8 Xu Kuohai 2022-07-11 1992 return -EFBIG;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1993
efc9909fdce00a8 Xu Kuohai 2022-07-11 1994 ctx.image = image;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1995 ctx.idx = 0;
efc9909fdce00a8 Xu Kuohai 2022-07-11 1996
efc9909fdce00a8 Xu Kuohai 2022-07-11 1997 jit_fill_hole(image, (unsigned int)(image_end - image));
efc9909fdce00a8 Xu Kuohai 2022-07-11 @1998 ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nargs, flags);
efc9909fdce00a8 Xu Kuohai 2022-07-11 1999
efc9909fdce00a8 Xu Kuohai 2022-07-11 2000 if (ret > 0 && validate_code(&ctx) < 0)
efc9909fdce00a8 Xu Kuohai 2022-07-11 2001 ret = -EINVAL;
efc9909fdce00a8 Xu Kuohai 2022-07-11 2002
efc9909fdce00a8 Xu Kuohai 2022-07-11 2003 if (ret > 0)
efc9909fdce00a8 Xu Kuohai 2022-07-11 2004 ret *= AARCH64_INSN_SIZE;
efc9909fdce00a8 Xu Kuohai 2022-07-11 2005
efc9909fdce00a8 Xu Kuohai 2022-07-11 2006 return ret;
efc9909fdce00a8 Xu Kuohai 2022-07-11 2007 }
efc9909fdce00a8 Xu Kuohai 2022-07-11 2008
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (156673 bytes)
Powered by blists - more mailing lists