linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests
@ 2025-07-07  7:17 Saket Kumar Bhaskar
  2025-07-07 12:31 ` Daniel Borkmann
  2025-07-07 15:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Saket Kumar Bhaskar @ 2025-07-07  7:17 UTC (permalink / raw)
  To: bpf, linux-kselftest, linux-kernel
  Cc: hbathini, sachinpb, andrii, eddyz87, mykolal, ast, daniel,
	martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf,
	haoluo, jolsa, shuah

BPF selftest fails to build with below error:

  CLNG-BPF [test_progs] lsm_cgroup.bpf.o
progs/lsm_cgroup.c:105:21: error: variable has incomplete type 'struct sockaddr_ll'
  105 |         struct sockaddr_ll sa = {};
      |                            ^
progs/lsm_cgroup.c:105:9: note: forward declaration of 'struct sockaddr_ll'
  105 |         struct sockaddr_ll sa = {};
      |                ^
1 error generated.

lsm_cgroup selftest requires sockaddr_ll structure which is not there
in vmlinux.h when the kernel is built with CONFIG_PACKET=m.

Enabling CONFIG_PACKET=y ensures that sockaddr_ll is available in vmlinux,
allowing it to be captured in the generated vmlinux.h for bpf selftests.

Reported-by: Sachin P Bappalige <sachinpb@linux.ibm.com>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
---
 tools/testing/selftests/bpf/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config
index f74e1ea0ad3b..7247833fe623 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -105,6 +105,7 @@ CONFIG_IP_NF_IPTABLES=y
 CONFIG_IP6_NF_IPTABLES=y
 CONFIG_IP6_NF_FILTER=y
 CONFIG_NF_NAT=y
+CONFIG_PACKET=y
 CONFIG_RC_CORE=y
 CONFIG_SECURITY=y
 CONFIG_SECURITYFS=y
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests
  2025-07-07  7:17 [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests Saket Kumar Bhaskar
@ 2025-07-07 12:31 ` Daniel Borkmann
  2025-07-07 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2025-07-07 12:31 UTC (permalink / raw)
  To: Saket Kumar Bhaskar, bpf, linux-kselftest, linux-kernel
  Cc: hbathini, sachinpb, andrii, eddyz87, mykolal, ast, martin.lau,
	song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
	shuah

On 7/7/25 9:17 AM, Saket Kumar Bhaskar wrote:
> BPF selftest fails to build with below error:
> 
>    CLNG-BPF [test_progs] lsm_cgroup.bpf.o
> progs/lsm_cgroup.c:105:21: error: variable has incomplete type 'struct sockaddr_ll'
>    105 |         struct sockaddr_ll sa = {};
>        |                            ^
> progs/lsm_cgroup.c:105:9: note: forward declaration of 'struct sockaddr_ll'
>    105 |         struct sockaddr_ll sa = {};
>        |                ^
> 1 error generated.
> 
> lsm_cgroup selftest requires sockaddr_ll structure which is not there
> in vmlinux.h when the kernel is built with CONFIG_PACKET=m.
> 
> Enabling CONFIG_PACKET=y ensures that sockaddr_ll is available in vmlinux,
> allowing it to be captured in the generated vmlinux.h for bpf selftests.
> 
> Reported-by: Sachin P Bappalige <sachinpb@linux.ibm.com>
> Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests
  2025-07-07  7:17 [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests Saket Kumar Bhaskar
  2025-07-07 12:31 ` Daniel Borkmann
@ 2025-07-07 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-07 15:40 UTC (permalink / raw)
  To: Saket Kumar Bhaskar
  Cc: bpf, linux-kselftest, linux-kernel, hbathini, sachinpb, andrii,
	eddyz87, mykolal, ast, daniel, martin.lau, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon,  7 Jul 2025 12:47:35 +0530 you wrote:
> BPF selftest fails to build with below error:
> 
>   CLNG-BPF [test_progs] lsm_cgroup.bpf.o
> progs/lsm_cgroup.c:105:21: error: variable has incomplete type 'struct sockaddr_ll'
>   105 |         struct sockaddr_ll sa = {};
>       |                            ^
> progs/lsm_cgroup.c:105:9: note: forward declaration of 'struct sockaddr_ll'
>   105 |         struct sockaddr_ll sa = {};
>       |                ^
> 1 error generated.
> 
> [...]

Here is the summary with links:
  - selftests/bpf: Set CONFIG_PACKET=y for selftests
    https://git.kernel.org/bpf/bpf-next/c/0f626c98fd10

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-07 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07  7:17 [PATCH] selftests/bpf: Set CONFIG_PACKET=y for selftests Saket Kumar Bhaskar
2025-07-07 12:31 ` Daniel Borkmann
2025-07-07 15:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).