Re: [PATCH vfs-7.5.bpf v2 1/3] bpf: Add bpf_path_getattr()
From: Anastasios Papagiannis
Date: Wed Nov 18 2026 - 07:40:55 EST
> So we need mechanisms in bpf to guard against things like that
> architecturally. Ideally it would not just be a filter like in the past.
I have been working on an approach that models dependencies between
LSM hooks and kfuncs and checks for cycles in the verifier.
In my prototype, kfuncs that need this check should be marked with
KF_CHECK_DEPS. When a program calls one of them, the verifier invokes
bpf_lsm_check_kfunc_dependency() to check whether calling it from the
attached hook could close a dependency cycle thus it may result in a
deadlock. The prototype rejects the program if it finds a cycle or if
the necessary dependency information is missing.
I have tried to model the bpf_path_getattr() dependency manually based
on your comment by using the approach that I described. But the difficult
part is to cover all relevant hooks and kfuncs. So I am looking into
whether there is a way to generate or validate some of those dependencies
automatically. I will continue working on this and try to send an RFC if
I can find a reasonable way to handle the dependencies.
This approach could benefit BPF more generally. However, based on my
analysis, it looks like bpf_path_getattr() would not be usable from
the hooks I need (assuming that it will be available for all underlying
file systems). For this reason, I will drop this series for now and look
for another way to obtain the information I need for overlayfs without
introducing such a broad API.
Thanks,
Anastasios