Skip to content

Commit b13cddf

Browse files
mattbobrowskiAlexei Starovoitov
authored andcommitted
bpf: add small subset of SECURITY_PATH hooks to BPF sleepable_lsm_hooks list
security_path_* based LSM hooks appear to be generally missing from the sleepable_lsm_hooks list. Initially add a small subset of them to the preexisting sleepable_lsm_hooks list so that sleepable BPF helpers like bpf_d_path() can be used from sleepable BPF LSM based programs. The security_path_* hooks added in this patch are similar to the security_inode_* counterparts that already exist in the sleepable_lsm_hooks list, and are called in roughly similar points and contexts. Presumably, making them OK to be also annotated as sleepable. Building a kernel with DEBUG_ATOMIC_SLEEP options enabled and running reasonable workloads stimulating activity that would be intercepted by such security hooks didn't show any splats. Notably, I haven't added all the security_path_* LSM hooks that are available as I don't need them at this point in time. Signed-off-by: Matt Bobrowski <[email protected]> Acked-by: KP Singh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent ec14325 commit b13cddf

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
@@ -304,6 +304,18 @@ BTF_ID(func, bpf_lsm_kernel_module_request)
304304
BTF_ID(func, bpf_lsm_kernel_read_file)
305305
BTF_ID(func, bpf_lsm_kernfs_init_security)
306306

307+
#ifdef CONFIG_SECURITY_PATH
308+
BTF_ID(func, bpf_lsm_path_unlink)
309+
BTF_ID(func, bpf_lsm_path_mkdir)
310+
BTF_ID(func, bpf_lsm_path_rmdir)
311+
BTF_ID(func, bpf_lsm_path_truncate)
312+
BTF_ID(func, bpf_lsm_path_symlink)
313+
BTF_ID(func, bpf_lsm_path_link)
314+
BTF_ID(func, bpf_lsm_path_rename)
315+
BTF_ID(func, bpf_lsm_path_chmod)
316+
BTF_ID(func, bpf_lsm_path_chown)
317+
#endif /* CONFIG_SECURITY_PATH */
318+
307319
#ifdef CONFIG_KEYS
308320
BTF_ID(func, bpf_lsm_key_free)
309321
#endif /* CONFIG_KEYS */

0 commit comments

Comments
 (0)