Message ID | 20241114084345.1564165-6-song@kernel.org (mailing list archive) |
---|---|
State | RFC |
Delegated to: | BPF |
Headers | show |
Series | Fanotify fastpath handler | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for bpf-next, async |
netdev/apply | fail | Patch does not apply to bpf-next-0 |
bpf/vmtest-bpf-net-VM_Test-2 | success | Logs for Unittests |
bpf/vmtest-bpf-net-VM_Test-5 | success | Logs for aarch64-gcc / build-release |
bpf/vmtest-bpf-net-VM_Test-0 | success | Logs for Lint |
bpf/vmtest-bpf-net-VM_Test-1 | success | Logs for ShellCheck |
bpf/vmtest-bpf-net-VM_Test-3 | success | Logs for Validate matrix.py |
bpf/vmtest-bpf-net-VM_Test-13 | fail | Logs for x86_64-gcc / build / build for x86_64 with gcc |
bpf/vmtest-bpf-net-PR | fail | PR summary |
bpf/vmtest-bpf-net-VM_Test-9 | success | Logs for s390x-gcc / build-release |
bpf/vmtest-bpf-net-VM_Test-7 | success | Logs for aarch64-gcc / veristat |
bpf/vmtest-bpf-net-VM_Test-6 | success | Logs for aarch64-gcc / test |
bpf/vmtest-bpf-net-VM_Test-11 | success | Logs for s390x-gcc / veristat |
bpf/vmtest-bpf-net-VM_Test-4 | fail | Logs for aarch64-gcc / build / build for aarch64 with gcc |
bpf/vmtest-bpf-net-VM_Test-12 | success | Logs for set-matrix |
bpf/vmtest-bpf-net-VM_Test-10 | success | Logs for s390x-gcc / test |
bpf/vmtest-bpf-net-VM_Test-8 | fail | Logs for s390x-gcc / build / build for s390x with gcc |
bpf/vmtest-bpf-net-VM_Test-14 | success | Logs for x86_64-gcc / build-release |
bpf/vmtest-bpf-net-VM_Test-15 | success | Logs for x86_64-gcc / test |
bpf/vmtest-bpf-net-VM_Test-16 | success | Logs for x86_64-gcc / veristat |
bpf/vmtest-bpf-net-VM_Test-17 | fail | Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17 |
bpf/vmtest-bpf-net-VM_Test-18 | fail | Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17-O2 |
bpf/vmtest-bpf-net-VM_Test-19 | success | Logs for x86_64-llvm-17 / test |
bpf/vmtest-bpf-net-VM_Test-20 | success | Logs for x86_64-llvm-17 / veristat |
bpf/vmtest-bpf-net-VM_Test-21 | fail | Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18 |
bpf/vmtest-bpf-net-VM_Test-22 | fail | Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18-O2 |
bpf/vmtest-bpf-net-VM_Test-23 | success | Logs for x86_64-llvm-18 / test |
bpf/vmtest-bpf-net-VM_Test-24 | success | Logs for x86_64-llvm-18 / veristat |
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 1a43d06eab28..5e3bf2c188a8 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -3004,6 +3004,12 @@ __bpf_kfunc int bpf_copy_from_user_str(void *dst, u32 dst__sz, const void __user return ret + 1; } +__bpf_kfunc void bpf_dentry_release_dtor(struct dentry *dentry) +{ + dput(dentry); +} +CFI_NOSEAL(bpf_dentry_release_dtor); + __bpf_kfunc_end_defs(); BTF_KFUNCS_START(generic_btf_ids) @@ -3046,6 +3052,8 @@ static const struct btf_kfunc_id_set generic_kfunc_set = { BTF_ID_LIST(generic_dtor_ids) BTF_ID(struct, task_struct) BTF_ID(func, bpf_task_release_dtor) +BTF_ID(struct, dentry) +BTF_ID(func, bpf_dentry_release_dtor) #ifdef CONFIG_CGROUPS BTF_ID(struct, cgroup) BTF_ID(func, bpf_cgroup_release_dtor) @@ -3105,11 +3113,15 @@ static int __init kfunc_init(void) .btf_id = generic_dtor_ids[0], .kfunc_btf_id = generic_dtor_ids[1] }, -#ifdef CONFIG_CGROUPS { .btf_id = generic_dtor_ids[2], .kfunc_btf_id = generic_dtor_ids[3] }, +#ifdef CONFIG_CGROUPS + { + .btf_id = generic_dtor_ids[4], + .kfunc_btf_id = generic_dtor_ids[5] + }, #endif };
To save a dentry in a bpf map, proper logic is needed to free the dentry properly on map termination. Signed-off-by: Song Liu <song@kernel.org> --- kernel/bpf/helpers.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)