On 12/29/20 6:14 AM, John Fastabend wrote:
Song Liu wrote:
On Wed, Dec 23, 2020 at 5:14 PM Jiang Wang <jiang.wang@xxxxxxxxxxxxx> wrote:
When CONFIG_BPF_LSM is not configured, running bpf selftesting will show
BPF_F_BPRM_SECUREEXEC undefined error for bprm_opts.c.
The problem is that bprm_opts.c includes vmliunx.h. The vmlinux.h is
generated by "bpftool btf dump file ./vmlinux format c". On the other
hand, BPF_F_BPRM_SECUREEXEC is defined in include/uapi/linux/bpf.h
and used only in bpf_lsm.c. When CONFIG_BPF_LSM is not set, bpf_lsm
will not be compiled, so vmlinux.h will not include definition of
BPF_F_BPRM_SECUREEXEC.
Ideally, we want to compile bpf selftest regardless of the configuration
setting, so change the include file from vmlinux.h to bpf.h.
Signed-off-by: Jiang Wang <jiang.wang@xxxxxxxxxxxxx>
Thanks for the fix!
Acked-by: Song Liu <songliubraving@xxxxxx>
[...]
LGTM
Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>
I think it's okay'ish as a workaround, but in case that selftest needs to be
extended to the point where we need kernel internal structures from vmlinux.h
again, then we need to come up with a different solution. Overall, I'd like to
remind that BPF selftests need to be run with the full/needed config options set
to not miss out on coverage on some of the BPF subsystems. Anyway, applied, thx!