Skip to content

Make inode storage available to tracing prog

Song Liu bpf linux-fsdevel linux-security-module lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 0 repliesNew
  2. v24 patches 5 repliesSuperseded
  3. v14 patches 46 repliesSuperseded

Changes in v3 from the cover letter

1. Move bpf_inode_storage_free to i_callback(). (Martin)
2. Fix __bpf_inode_storage_get(). (Martin)

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf: lsm: Remove hook to bpf_task_storage_freesecurity/bpf/hooks.c+0 -10 replies
2/4bpf: Make bpf inode storage available to tracing programfs/inode.c include/linux/bpf.h include/linux/bpf_lsm.h +6 more+25 -680 replies
3/4bpf: Add recursion prevention logic for inode storagekernel/bpf/bpf_inode_storage.c kernel/trace/bpf_trace.c+134 -250 replies
4/4selftest/bpf: Test inode local storage recursion preventiontools/testing/selftests/bpf/DENYLIST.s390x tools/testing/selftests/bpf/prog_tests/inode_local_storage.c tools/testing/selftests/bpf/progs/inode_storage_recursion.c+163 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 bpf-next 0/4] Make inode storage available to tracing prog

bpf inode local storage can be useful beyond LSM programs. For example, bcc/libbpf-tools file* can use inode local storage to simplify the logic. This set makes inode local storage available to tracing program.

1/4 is missing change for bpf task local storage. 2/4 move inode local storage from security blob to inode.

Similar to task local storage in tracing program, it is necessary to add recursion prevention logic for inode local storage. Patch 3/4 adds such logic, and 4/4 add a test for the recursion prevention logic.

Changes v2 => v3:
1. Move bpf_inode_storage_free to i_callback(). (Martin)
2. Fix __bpf_inode_storage_get(). (Martin)

Changes v1 => v2:
1. Rebase.
2. Fix send-email mistake.

Song Liu (4):
bpf: lsm: Remove hook to bpf_task_storage_free
bpf: Make bpf inode storage available to tracing program
bpf: Add recursion prevention logic for inode storage selftest/bpf: Test inode local storage recursion prevention

 fs/inode.c                                    |   2 +
 include/linux/bpf.h                           |   9 +
 include/linux/bpf_lsm.h                       |  29 ---
 include/linux/fs.h                            |   4 +
 kernel/bpf/Makefile                           |   3 +-
 kernel/bpf/bpf_inode_storage.c                | 185 +++++++++++++-----
 kernel/bpf/bpf_lsm.c                          |   4 -
 kernel/trace/bpf_trace.c                      |   8 +
 security/bpf/hooks.c                          |   7 -
 tools/testing/selftests/bpf/DENYLIST.s390x    |   1 +
 .../bpf/prog_tests/inode_local_storage.c      |  72 +++++++
 .../bpf/progs/inode_storage_recursion.c       |  90 +++++++++
 12 files changed, 321 insertions(+), 93 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/inode_local_storage.c
 create mode 100644 tools/testing/selftests/bpf/progs/inode_storage_recursion.c

--
2.43.5