git: cea7c564c70a - main - namei: Reset the lookup to start from the real root for abs symlink target
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Jun 2023 12:24:38 UTC
The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=cea7c564c70aa660d833e9a571aaca4119c0b714 commit cea7c564c70aa660d833e9a571aaca4119c0b714 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-06-13 12:24:25 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-06-13 12:24:25 +0000 namei: Reset the lookup to start from the real root for abs symlink target Since fd745e1d Linux ABI specifies alternative root directory to reroot lookups. First, an attempt is made to lookup the file in /ABI/original-path. If that fails, the lookup is done in /original-path. In case of lookup symbolic link with leading / in target namei() fails due to reroot reloads original file name. To avoid this handle restart in a special maner, without origin path name reloading. Reported by: Goran Mekić, Vincent Milum Jr Tested by: Goran Mekić Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40479 --- sys/kern/vfs_lookup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 20919fb38b4d..dd6282a45d97 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -721,6 +721,14 @@ restart: */ cnp->cn_nameptr = cnp->cn_pnbuf; if (*(cnp->cn_nameptr) == '/') { + /* + * Reset the lookup to start from the real root without + * origin path name reloading. + */ + if (__predict_false(ndp->ni_rootdir != pwd->pwd_rdir)) { + cnp->cn_flags |= ISRESTARTED; + ndp->ni_rootdir = pwd->pwd_rdir; + } vrele(dp); error = namei_handle_root(ndp, &dp); if (error != 0)