Skip to content

Commit 128262a

Browse files
NAME-ASHWANIYADAVdylandreimerink
authored andcommitted
Link LSM example to its kernel documentation source
The mprotect_audit example on the BPF_PROG_TYPE_LSM page is taken from the kernel's Documentation/bpf/prog_lsm.rst but had no link back to it. Add a co-located source link, as suggested in #141, so readers can find the full version with the includes, type definitions, and loader code needed to compile and run it. Also introduce the example with a short description of what it does, so it is no longer confused with the socket_create illustration in the Usage section above (the other point raised in #141). Signed-off-by: Ashwani Yadav <22ashwaniyadav@gmail.com>
1 parent 20bf063 commit 128262a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

docs/linux/program-type/BPF_PROG_TYPE_LSM.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The primary use case is to implement security software. For example, the `socket
2424

2525
The list of all LSM hooks can be found in [`lsm_hook_defs.h`](https://github.com/torvalds/linux/blob/457391b0380335d5e9a5babdec90ac53928b23b4/include/linux/lsm_hook_defs.h), additional documentation for these hooks lives in [`lsm_hooks.h`](https://github.com/torvalds/linux/blob/457391b0380335d5e9a5babdec90ac53928b23b4/include/linux/lsm_hooks.h)
2626

27+
The following example, which denies `mprotect` calls on a process's heap memory, comes from the kernel's [LSM BPF documentation](https://docs.kernel.org/bpf/prog_lsm.html); the original document also walks through the includes, type definitions, and user space code needed to compile and run it:
28+
2729
```c
2830
// Copyright (C) 2020 Google LLC.
2931
SEC("lsm/file_mprotect")

0 commit comments

Comments
 (0)