[ast-bpf:relo_core 2/11] tools/lib/bpf/relo_core.c:1213:5: warning: stack frame size (1272) exceeds limit (1024) in function 'bpf_core_apply_relo_insn'
From: kernel test robot
Date: Wed Sep 29 2021 - 02:21:49 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git relo_core
head: 35a0182c26565e1db43f99a764834bff8a2e4202
commit: 8623aae013d966a5c765b9e7436b0fc5ea425bc4 [2/11] bpf: Prepare relo_core.c for kernel duty.
config: hexagon-randconfig-r035-20210928 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git/commit/?id=8623aae013d966a5c765b9e7436b0fc5ea425bc4
git remote add ast-bpf https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git
git fetch --no-tags ast-bpf relo_core
git checkout 8623aae013d966a5c765b9e7436b0fc5ea425bc4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
tools/lib/bpf/relo_core.c:50:6: warning: no previous prototype for function 'libbpf_print' [-Wmissing-prototypes]
void libbpf_print(enum libbpf_print_level level,
^
tools/lib/bpf/relo_core.c:50:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void libbpf_print(enum libbpf_print_level level,
^
static
>> tools/lib/bpf/relo_core.c:1213:5: warning: stack frame size (1272) exceeds limit (1024) in function 'bpf_core_apply_relo_insn' [-Wframe-larger-than]
int bpf_core_apply_relo_insn(const char *prog_name, struct bpf_insn *insn,
^
2 warnings generated.
vim +/bpf_core_apply_relo_insn +1213 tools/lib/bpf/relo_core.c
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1162
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1163 /*
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1164 * CO-RE relocate single instruction.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1165 *
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1166 * The outline and important points of the algorithm:
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1167 * 1. For given local type, find corresponding candidate target types.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1168 * Candidate type is a type with the same "essential" name, ignoring
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1169 * everything after last triple underscore (___). E.g., `sample`,
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1170 * `sample___flavor_one`, `sample___flavor_another_one`, are all candidates
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1171 * for each other. Names with triple underscore are referred to as
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1172 * "flavors" and are useful, among other things, to allow to
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1173 * specify/support incompatible variations of the same kernel struct, which
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1174 * might differ between different kernel versions and/or build
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1175 * configurations.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1176 *
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1177 * N.B. Struct "flavors" could be generated by bpftool's BTF-to-C
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1178 * converter, when deduplicated BTF of a kernel still contains more than
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1179 * one different types with the same name. In that case, ___2, ___3, etc
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1180 * are appended starting from second name conflict. But start flavors are
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1181 * also useful to be defined "locally", in BPF program, to extract same
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1182 * data from incompatible changes between different kernel
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1183 * versions/configurations. For instance, to handle field renames between
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1184 * kernel versions, one can use two flavors of the struct name with the
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1185 * same common name and use conditional relocations to extract that field,
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1186 * depending on target kernel version.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1187 * 2. For each candidate type, try to match local specification to this
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1188 * candidate target type. Matching involves finding corresponding
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1189 * high-level spec accessors, meaning that all named fields should match,
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1190 * as well as all array accesses should be within the actual bounds. Also,
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1191 * types should be compatible (see bpf_core_fields_are_compat for details).
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1192 * 3. It is supported and expected that there might be multiple flavors
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1193 * matching the spec. As long as all the specs resolve to the same set of
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1194 * offsets across all candidates, there is no error. If there is any
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1195 * ambiguity, CO-RE relocation will fail. This is necessary to accomodate
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1196 * imprefection of BTF deduplication, which can cause slight duplication of
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1197 * the same BTF type, if some directly or indirectly referenced (by
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1198 * pointer) type gets resolved to different actual types in different
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1199 * object files. If such situation occurs, deduplicated BTF will end up
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1200 * with two (or more) structurally identical types, which differ only in
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1201 * types they refer to through pointer. This should be OK in most cases and
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1202 * is not an error.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1203 * 4. Candidate types search is performed by linearly scanning through all
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1204 * types in target BTF. It is anticipated that this is overall more
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1205 * efficient memory-wise and not significantly worse (if not better)
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1206 * CPU-wise compared to prebuilding a map from all local type names to
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1207 * a list of candidate type names. It's also sped up by caching resolved
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1208 * list of matching candidates per each local "root" type ID, that has at
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1209 * least one bpf_core_relo associated with it. This list is shared
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1210 * between multiple relocations for the same type ID and is updated as some
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1211 * of the candidates are pruned due to structural incompatibility.
b0588390dbcedcd Alexei Starovoitov 2021-07-20 1212 */
b0588390dbcedcd Alexei Starovoitov 2021-07-20 @1213 int bpf_core_apply_relo_insn(const char *prog_name, struct bpf_insn *insn,
:::::: The code at line 1213 was first introduced by commit
:::::: b0588390dbcedcd74fab6ffb8afe8d52380fd8b6 libbpf: Split CO-RE logic into relo_core.c.
:::::: TO: Alexei Starovoitov <ast@xxxxxxxxxx>
:::::: CC: Andrii Nakryiko <andrii@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip