From 80456adb740cb26512cfb1049ddf3329ca4f22d6 Mon Sep 17 00:00:00 2001 From: Luis Gerhorst <luis.gerhorst@fau.de> Date: Wed, 15 Dec 2021 11:11:55 +0100 Subject: [PATCH] du: Don't use file descriptor stack --- src/task_find.bpf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/task_find.bpf.c b/src/task_find.bpf.c index 73d3cd2..e1f395a 100644 --- a/src/task_find.bpf.c +++ b/src/task_find.bpf.c @@ -44,7 +44,7 @@ static long iter_dir(uint32_t d_type, size_t namelen, bool match) { err = -1; goto end; } - int parent_dfd = dfd[depth]; + int parent_dfd = dfd[0]; /* void *name_user = u_iterdents64_buf + depth * PATHLEN; */ void *name_user = u_iterdents64_buf; @@ -89,8 +89,9 @@ static long iter_dir(uint32_t d_type, size_t namelen, bool match) { void *child_name_user = name_user; curr_depth = child_depth; - dfd[curr_depth] = child_dfd; + dfd[0] = child_dfd; err = bpf_task_iterdents64(child_dfd, pdpf, child_name_user, PATHLEN); + dfd[0] = parent_dfd; if (err) { bpf_printk("Error: iterdents64(%d, %d) = %d", child_dfd, pdpf, err); goto reset_depth; -- GitLab