Skip to content

bpf path iterator #9134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: bpf path iterator
version: 5
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f66b4aa
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a633dab
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 85cd83f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f5527f0
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802
version: 5

This helper walks an input path to its parent. Logic are added to handle
walking across mount tree.

This will be used by landlock, and BPF LSM.

Suggested-by: Neil Brown <[email protected]>
Signed-off-by: Song Liu <[email protected]>
Use path_walk_parent() to walk a path up to its parent.

No functional changes intended.

Signed-off-by: Song Liu <[email protected]>
Introduce a path iterator, which walks a struct path toward the root.
This path iterator is based on path_walk_parent. A fixed zero'ed root
is passed to path_walk_parent(). Therefore, unless the user terminates
it earlier, the iterator will terminate at the real root.

Signed-off-by: Song Liu <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bd07bd1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972802
version: 5

Add tests for bpf path iterator, including test cases similar to real
workload (call bpf_path_d_path and bpf_get_dentry_xattr), and test cases
where the verifier rejects invalid use of the iterator.

Signed-off-by: Song Liu <[email protected]>
Add an end-to-end test with path_iter on security hook file_open.

A test file is created in folder /tmp/test_progs_path_iter/folder. On
file_open, walk file->f_path up to its parent and grand parent, and test
bpf_get_dentry_xattr and bpf_path_d_path on the folders.

Signed-off-by: Song Liu <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=972802 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant