Skip to content

Commit 7803138

Browse files
mythiborkmann
authored andcommitted
bpf: Drop disabled LSM hooks from the sleepable set
Some networking and keys LSM hooks are conditionally enabled and when building the new sleepable BPF LSM hooks with those LSM hooks disabled, the following build error occurs: BTFIDS vmlinux FAILED unresolved symbol bpf_lsm_socket_socketpair To fix the error, conditionally add the relevant networking/keys LSM hooks to the sleepable set. Fixes: 423f161 ("bpf: Augment the set of sleepable LSM hooks") Signed-off-by: Mikko Ylinen <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent b9557ca commit 7803138

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/bpf/bpf_lsm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ BTF_ID(func, bpf_lsm_file_ioctl)
149149
BTF_ID(func, bpf_lsm_file_lock)
150150
BTF_ID(func, bpf_lsm_file_open)
151151
BTF_ID(func, bpf_lsm_file_receive)
152+
153+
#ifdef CONFIG_SECURITY_NETWORK
152154
BTF_ID(func, bpf_lsm_inet_conn_established)
155+
#endif /* CONFIG_SECURITY_NETWORK */
156+
153157
BTF_ID(func, bpf_lsm_inode_create)
154158
BTF_ID(func, bpf_lsm_inode_free_security)
155159
BTF_ID(func, bpf_lsm_inode_getattr)
@@ -166,7 +170,11 @@ BTF_ID(func, bpf_lsm_inode_symlink)
166170
BTF_ID(func, bpf_lsm_inode_unlink)
167171
BTF_ID(func, bpf_lsm_kernel_module_request)
168172
BTF_ID(func, bpf_lsm_kernfs_init_security)
173+
174+
#ifdef CONFIG_KEYS
169175
BTF_ID(func, bpf_lsm_key_free)
176+
#endif /* CONFIG_KEYS */
177+
170178
BTF_ID(func, bpf_lsm_mmap_file)
171179
BTF_ID(func, bpf_lsm_netlink_send)
172180
BTF_ID(func, bpf_lsm_path_notify)
@@ -181,6 +189,8 @@ BTF_ID(func, bpf_lsm_sb_show_options)
181189
BTF_ID(func, bpf_lsm_sb_statfs)
182190
BTF_ID(func, bpf_lsm_sb_umount)
183191
BTF_ID(func, bpf_lsm_settime)
192+
193+
#ifdef CONFIG_SECURITY_NETWORK
184194
BTF_ID(func, bpf_lsm_socket_accept)
185195
BTF_ID(func, bpf_lsm_socket_bind)
186196
BTF_ID(func, bpf_lsm_socket_connect)
@@ -195,6 +205,8 @@ BTF_ID(func, bpf_lsm_socket_recvmsg)
195205
BTF_ID(func, bpf_lsm_socket_sendmsg)
196206
BTF_ID(func, bpf_lsm_socket_shutdown)
197207
BTF_ID(func, bpf_lsm_socket_socketpair)
208+
#endif /* CONFIG_SECURITY_NETWORK */
209+
198210
BTF_ID(func, bpf_lsm_syslog)
199211
BTF_ID(func, bpf_lsm_task_alloc)
200212
BTF_ID(func, bpf_lsm_task_getsecid)

0 commit comments

Comments
 (0)