cache: add a comment about a realpath bug

This commit is contained in:
Mateusz Guzik 2022-03-19 15:11:25 +00:00
parent eb574ba0b6
commit 6ff3e8a316

View file

@ -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)