Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix cgroup sockopt verifier test

Since the BPF_PROG_TYPE_CGROUP_SOCKOPT verifier test does not set an
attach type, bpf_prog_load_check_attach() disallows loading the program
and the test is always skipped:

#434/p perfevent for cgroup sockopt SKIP (unsupported program type 25)

Fix the issue by setting a valid attach type.

Fixes: 0456ea170cd6 ("bpf: Enable more helpers for BPF_PROG_TYPE_CGROUP_{DEVICE,SYSCTL,SOCKOPT}")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20200710150439.126627-1-jean-philippe@linaro.org

authored by

Jean-Philippe Brucker and committed by
Daniel Borkmann
55b24422 c8b1d743

+1
+1
tools/testing/selftests/bpf/verifier/event_output.c
··· 112 112 "perfevent for cgroup sockopt", 113 113 .insns = { __PERF_EVENT_INSNS__ }, 114 114 .prog_type = BPF_PROG_TYPE_CGROUP_SOCKOPT, 115 + .expected_attach_type = BPF_CGROUP_SETSOCKOPT, 115 116 .fixup_map_event_output = { 4 }, 116 117 .result = ACCEPT, 117 118 .retval = 1,