chase: put limit on overall chase cycles

Let's add some protections in case we deal with inodes owned by an
untrusted person, with concurrent access: let's put a limit on how long
we traverse, and fail eventually so that live changes cannot send us in
circles indefinitely.

This reworks the current CHASE_MAX logic so that it not only applies to
symlinks transitions, but to any transitions.

This also bumps CHASE_MAX a bit, given that it's now bumped on every
single iteration of the loop.
This commit is contained in:
Lennart Poettering
2026-03-03 08:48:01 +01:00
parent 97fe03e12f
commit 004e60e0fc
2 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ typedef enum ChaseFlags {
bool unsafe_transition(const struct stat *a, const struct stat *b);
/* How many iterations to execute before returning -ELOOP */
#define CHASE_MAX 32
#define CHASE_MAX 128U
int chase(const char *path_with_prefix, const char *root, ChaseFlags flags, char **ret_path, int *ret_fd);