diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 13c84791583..147d3075dfa 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3119,6 +3119,17 @@ vn_getcwd(char *buf, char **retbuf, size_t *buflen) return (error); } +/* + * Canonicalize a path by walking it forward and back. + * + * BUGS: + * - Nothing guarantees the integrity of the entire chain. Consider the case + * where the path "foo/bar/baz/qux" is passed, but "bar" is moved out of + * "foo" into "quux" during the backwards walk. The result will be + * "quux/bar/baz/qux", which could not have been obtained by an incremental + * walk in userspace. Moreover, the path we return is inaccessible if the + * calling thread lacks permission to traverse "quux". + */ static int kern___realpathat(struct thread *td, int fd, const char *path, char *buf, size_t size, int flags, enum uio_seg pathseg)