anakryiko / retsnoop

Investigate kernel error call stacks
BSD 2-Clause "Simplified" License
186 stars 32 forks source link

Fix compiler error on riscv64 by regenerating vmlinux.h #74

Closed kxxt closed 1 month ago

kxxt commented 1 month ago

Fixes https://archriscv.felixc.at/.status/log.htm?url=logs/retsnoop/retsnoop-0.10-1.log

calib_feat.bpf.c:86:74: error: no member named 'cookie' in 'struct bpf_attr::(unnamed at riscv/vmlinux.h:3603:2)'
   86 |         has_rawtp_cookie = bpf_core_field_exists(union bpf_attr, raw_tracepoint.cookie);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
.output/include/bpf/bpf_core_read.h:188:49: note: expanded from macro 'bpf_core_field_exists'
  188 |         __builtin_preserve_field_info(___bpf_field_ref(field), BPF_FIELD_EXISTS)
      |                                       ~~~~~~~~~~~~~~~~~^~~~~~
.output/include/bpf/bpf_core_read.h:173:52: note: expanded from macro '___bpf_field_ref'
  173 |         ___bpf_apply(___bpf_field_ref, ___bpf_narg(args))(args)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
.output/include/bpf/bpf_core_read.h:167:62: note: expanded from macro '___bpf_field_ref2'
  167 | #define ___bpf_field_ref2(type, field)  (___bpf_typeof(type)->field)
      |                                          ~~~~~~~~~~~~~~~~~~~~~^~~~~
1 error generated.

It should also fix this bug for aarch64 and other architectures as it appears only x86 vmlinux.h is regenerated recently and has cookie field.

kxxt commented 1 month ago

BTW the headers are generated based on linux v6.10.7

anakryiko commented 1 month ago

Note, I mitigated this particular problem with https://github.com/anakryiko/retsnoop/commit/05dd7381823331f9eb652008b6a2b723f5dffcaa, but having updated vmlinux.h is great, thanks!