Skip to content

Commit 0de267d

Browse files
liu-song-6Alexei Starovoitov
authored andcommitted
Documentation/bpf: Add documentation for filesystem kfuncs
Add a brief introduction for file system kfuncs: bpf_get_file_xattr() bpf_get_fsverity_digest() The documentation highlights the strategy to avoid recursions of these kfuncs. Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 67814c0 commit 0de267d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Documentation/bpf/fs_kfuncs.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
.. _fs_kfuncs-header-label:
4+
5+
=====================
6+
BPF filesystem kfuncs
7+
=====================
8+
9+
BPF LSM programs need to access filesystem data from LSM hooks. The following
10+
BPF kfuncs can be used to get these data.
11+
12+
* ``bpf_get_file_xattr()``
13+
14+
* ``bpf_get_fsverity_digest()``
15+
16+
To avoid recursions, these kfuncs follow the following rules:
17+
18+
1. These kfuncs are only permitted from BPF LSM function.
19+
2. These kfuncs should not call into other LSM hooks, i.e. security_*(). For
20+
example, ``bpf_get_file_xattr()`` does not use ``vfs_getxattr()``, because
21+
the latter calls LSM hook ``security_inode_getxattr``.

Documentation/bpf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ that goes into great technical depth about the BPF Architecture.
2121
helpers
2222
kfuncs
2323
cpumasks
24+
fs_kfuncs
2425
programs
2526
maps
2627
bpf_prog_run

0 commit comments

Comments
 (0)