From owner-dev-commits-src-all@freebsd.org Mon May 31 00:44:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C107263B287; Mon, 31 May 2021 00:44:26 +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 4Ftc4V4qfQz4nhS; Mon, 31 May 2021 00:44:26 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 83FC726AEE; Mon, 31 May 2021 00:44:26 +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 14V0iQPL052547; Mon, 31 May 2021 00:44:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14V0iQGT052546; Mon, 31 May 2021 00:44:26 GMT (envelope-from git) Date: Mon, 31 May 2021 00:44:26 GMT Message-Id: <202105310044.14V0iQGT052546@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 57d877348b2c - stable/13 - Fix handling of embedded symbolic links (and history lesson). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57d877348b2cb53a502a1bd305f973105f064a58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 00:44:26 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=57d877348b2cb53a502a1bd305f973105f064a58 commit 57d877348b2cb53a502a1bd305f973105f064a58 Author: Kirk McKusick AuthorDate: 2021-05-17 00:02:42 +0000 Commit: Kirk McKusick CommitDate: 2021-05-31 00:40:44 +0000 Fix handling of embedded symbolic links (and history lesson). Sponsored by: Netflix (cherry picked from commit 9a2fac6ba65fbd14d37ccedbc2aec27a190128ea) --- sys/kern/vfs_subr.c | 3 ++- sys/sys/mount.h | 2 +- sys/ufs/ffs/ffs_inode.c | 4 +--- sys/ufs/ufs/ufs_vnops.c | 4 +--- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ee570f216b40..ba02d0600a6e 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4403,7 +4403,8 @@ DB_SHOW_COMMAND(mount, db_show_mount) mp->mnt_lazyvnodelistsize); db_printf(" mnt_writeopcount = %d (with %d in the struct)\n", vfs_mount_fetch_counter(mp, MNT_COUNT_WRITEOPCOUNT), mp->mnt_writeopcount); - db_printf(" mnt_maxsymlinklen = %d\n", mp->mnt_maxsymlinklen); + db_printf(" mnt_maxsymlinklen = %jd\n", + (uintmax_t)mp->mnt_maxsymlinklen); db_printf(" mnt_iosize_max = %d\n", mp->mnt_iosize_max); db_printf(" mnt_hashseed = %u\n", mp->mnt_hashseed); db_printf(" mnt_lockref = %d (with %d in the struct)\n", diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 8b5712d19215..ae12c9fc8197 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -222,7 +222,7 @@ struct mount { int mnt_writeopcount; /* (i) write syscalls pending */ struct vfsoptlist *mnt_opt; /* current mount options */ struct vfsoptlist *mnt_optnew; /* new options passed to fs */ - int mnt_maxsymlinklen; /* max size of short symlink */ + uint64_t mnt_maxsymlinklen; /* max size of short symlink */ struct statfs mnt_stat; /* cache of filesystem stats */ struct ucred *mnt_cred; /* credentials of mounter */ void * mnt_data; /* private data */ diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 3df7bf8e8596..7bb532e7d26c 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -329,9 +329,7 @@ ffs_truncate(vp, length, flags, cred) } if ((flags & IO_NORMAL) == 0) return (0); - if (vp->v_type == VLNK && - (ip->i_size < vp->v_mount->mnt_maxsymlinklen || - datablocks == 0)) { + if (vp->v_type == VLNK && ip->i_size < vp->v_mount->mnt_maxsymlinklen) { #ifdef INVARIANTS if (length != 0) panic("ffs_truncate: partial truncate of symlink"); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 301c583291d1..70bf1a1d9036 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2458,10 +2458,8 @@ ufs_readlink(ap) doff_t isize; isize = ip->i_size; - if ((isize < vp->v_mount->mnt_maxsymlinklen) || - DIP(ip, i_blocks) == 0) { /* XXX - for old fastlink support */ + if (isize < vp->v_mount->mnt_maxsymlinklen) return (uiomove(SHORTLINK(ip), isize, ap->a_uio)); - } return (VOP_READ(vp, ap->a_uio, 0, ap->a_cred)); }