[PATCH v3 3/3] bpf: Describe cgroup_iter's fdinfo path for paths which don't fit
From: Chris Down
Date: Sun Nov 29 2026 - 22:48:35 EST
bpf_iter_cgroup_show_fdinfo() says that if cgroup_path_ns() fails, buf
is an empty string and nothing is printed. That isn't the case for a
path which doesn't fit in PATH_MAX: cgroup_path_ns() now returns -E2BIG
with "..." followed by the end of the path in buf.
The end of the path is still useful to show, so let's update the comment
to say so rather than change what is printed.
(Also since we're here, let's make the comment BPF style to avoid the
wrath of Sashiko.)
Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
---
kernel/bpf/cgroup_iter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/cgroup_iter.c b/kernel/bpf/cgroup_iter.c
index fd51fe3d92cc..0d9c93d68325 100644
--- a/kernel/bpf/cgroup_iter.c
+++ b/kernel/bpf/cgroup_iter.c
@@ -250,8 +250,10 @@ static void bpf_iter_cgroup_show_fdinfo(const struct bpf_iter_aux_info *aux,
goto show_order;
}
- /* If cgroup_path_ns() fails, buf will be an empty string, cgroup_path
- * will print nothing.
+ /*
+ * If cgroup_path_ns() fails, buf will be an empty string, cgroup_path
+ * will print nothing. The exception is a path which doesn't fit, where
+ * buf holds "..." followed by as much of the end of the path as fits.
*
* Path is in the calling process's cgroup namespace.
*/
--
2.56.1