From nobody Tue Jun 13 12:24:38 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QgSRV629xz4dBCl; Tue, 13 Jun 2023 12:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QgSRV5Zhfz3hrJ; Tue, 13 Jun 2023 12:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686659078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TxJKryDRhkOmUjtuwX4M08B+aLHKjhcz8W97PDC9xpI=; b=jQM54V9MsuR90hU0DTXFZlDKQHNbL3VpFd3CBKnInCqGem51nZz0CJdbk/l+oP2hVDbAQ6 DAixLBYh/UXaexc+eVCmy52Ibo99/1RvRvdwZM79SLyJOQFn8GA2rMzH2h/MtJBj/K4q4G p00Phw0qArjv6XgSe2J0bwpPIxVkaouZVVBcN0UBzh35ha2QPpQMW9StN8I78mMYXyXul5 vvPFwCXYSwwGr9XtYQGOlJr/25Fi/xlgFyIFYhLQUQY/W6W55t3yKDP7hEevxbbD90tAwd k/JHaANtK6o49jsvYPVInqKDbXSGHktG/L6gPwblNH5A1JIPyvqeV8iFyLp3pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686659078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TxJKryDRhkOmUjtuwX4M08B+aLHKjhcz8W97PDC9xpI=; b=iWnIAACXEWqvnlzmDbXSdS3ZOxjqiuft51ob7bxPrbbnLFgNykiwlH1PcUxUI0rtWb6gCD HDaGaB6DjKldaMyIp11lbS0aYRjb0cm4dPkXPToGO65dv6HGtBh8J4GM2jnM5bHS+KOdrS N1AWsduDCxfRTpxo9fr4mMu3OOoSc4Yhj5+xrmU/UAEiCyXIBAWSwYPtqDFEpGyZAJYLNV qKGyKfgCr0XEYWaDq4UxdtyhGIuWbElPH0KHr/IT8xAF+DoqH+v9DA0GJ/qBaH4Dum889G xFqAsBX2N4KhwWy4pbcGruL8RN1P0SyTrNZGXCTtXsfuIgCfry4Fct2hlONVUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686659078; a=rsa-sha256; cv=none; b=WaM+LpjX6CEDzooTD804bPwW5wXzmDqUl9WpK4XnGJdqBhvIK2Q3rQkcbFPBrUjhUaLUdv bS1c42JpvmhmxDPna/6rTVA9zo1SoC5uW5q+sgFYbOae8SIndY6NpanJvWTHb5hn5zYKoi kMvBCepKTozV5vL3Ui1w7ddFYdEDgvGvOnZ00s8Gp48Caz8OZ7lWwYk5w1UlyVEEoIeKud w5IDuiyl8Ct+RAVSPgEOJe17fQu2qPG/yneetluNWG8VfDalcM7JRzKSjCzy17x+scNA0e PjTVzJefyxRDKq714uyuHhFEi7MLfAIIfIDdC+1prtLxmN2zY8W5tjBvLuqYWQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QgSRV4N4LzMd4; Tue, 13 Jun 2023 12:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35DCOcic026183; Tue, 13 Jun 2023 12:24:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35DCOcJ9026182; Tue, 13 Jun 2023 12:24:38 GMT (envelope-from git) Date: Tue, 13 Jun 2023 12:24:38 GMT Message-Id: <202306131224.35DCOcJ9026182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: cea7c564c70a - main - namei: Reset the lookup to start from the real root for abs symlink target List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cea7c564c70aa660d833e9a571aaca4119c0b714 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=cea7c564c70aa660d833e9a571aaca4119c0b714 commit cea7c564c70aa660d833e9a571aaca4119c0b714 Author: Dmitry Chagin AuthorDate: 2023-06-13 12:24:25 +0000 Commit: Dmitry Chagin 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)