public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK
@ 2022-12-17  6:21 Hou Tao
  2022-12-17 16:25 ` Yonghong Song
  2022-12-19 21:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Hou Tao @ 2022-12-17  6:21 UTC (permalink / raw)
  To: bpf
  Cc: Martin KaFai Lau, Andrii Nakryiko, Song Liu, Hao Luo,
	Yonghong Song, Alexei Starovoitov, Daniel Borkmann, KP Singh,
	Stanislav Fomichev, Jiri Olsa, John Fastabend, houtao1

From: Hou Tao <houtao1@huawei.com>

There are warnings reported from resolve_btfids when building vmlinux
with CONFIG_SECURITY_NETWORK disabled:

  WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_free_security
  WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_alloc_security

So only define BTF IDs for these LSM hooks when CONFIG_SECURITY_NETWORK
is enabled.

Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 kernel/bpf/bpf_lsm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/bpf_lsm.c b/kernel/bpf/bpf_lsm.c
index 9ea42a45da47..a4a41ee3e80b 100644
--- a/kernel/bpf/bpf_lsm.c
+++ b/kernel/bpf/bpf_lsm.c
@@ -351,8 +351,10 @@ BTF_ID(func, bpf_lsm_bpf_prog_alloc_security)
 BTF_ID(func, bpf_lsm_bpf_prog_free_security)
 BTF_ID(func, bpf_lsm_file_alloc_security)
 BTF_ID(func, bpf_lsm_file_free_security)
+#ifdef CONFIG_SECURITY_NETWORK
 BTF_ID(func, bpf_lsm_sk_alloc_security)
 BTF_ID(func, bpf_lsm_sk_free_security)
+#endif /* CONFIG_SECURITY_NETWORK */
 BTF_ID(func, bpf_lsm_task_free)
 BTF_SET_END(untrusted_lsm_hooks)
 
-- 
2.29.2


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

* Re: [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK
  2022-12-17  6:21 [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK Hou Tao
@ 2022-12-17 16:25 ` Yonghong Song
  2022-12-19 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2022-12-17 16:25 UTC (permalink / raw)
  To: Hou Tao, bpf
  Cc: Martin KaFai Lau, Andrii Nakryiko, Song Liu, Hao Luo,
	Yonghong Song, Alexei Starovoitov, Daniel Borkmann, KP Singh,
	Stanislav Fomichev, Jiri Olsa, John Fastabend, houtao1



On 12/16/22 10:21 PM, Hou Tao wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> There are warnings reported from resolve_btfids when building vmlinux
> with CONFIG_SECURITY_NETWORK disabled:
> 
>    WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_free_security
>    WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_alloc_security
> 
> So only define BTF IDs for these LSM hooks when CONFIG_SECURITY_NETWORK
> is enabled.
> 
> Signed-off-by: Hou Tao <houtao1@huawei.com>

LGTM. I think this patch should go to bpf tree.

Acked-by: Yonghong Song <yhs@fb.com>

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

* Re: [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK
  2022-12-17  6:21 [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK Hou Tao
  2022-12-17 16:25 ` Yonghong Song
@ 2022-12-19 21:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-19 21:10 UTC (permalink / raw)
  To: Hou Tao
  Cc: bpf, martin.lau, andrii, song, haoluo, yhs, ast, daniel, kpsingh,
	sdf, jolsa, john.fastabend, houtao1

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Sat, 17 Dec 2022 14:21:44 +0800 you wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> There are warnings reported from resolve_btfids when building vmlinux
> with CONFIG_SECURITY_NETWORK disabled:
> 
>   WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_free_security
>   WARN: resolve_btfids: unresolved symbol bpf_lsm_sk_alloc_security
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK
    https://git.kernel.org/bpf/bpf/c/cc074822465d

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:[~2022-12-19 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-17  6:21 [PATCH bpf-next] bpf: Define sock security related BTF IDs under CONFIG_SECURITY_NETWORK Hou Tao
2022-12-17 16:25 ` Yonghong Song
2022-12-19 21:10 ` 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