From nobody Wed Aug 28 14:49:59 2024 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 4Wv6lC3Wnlz52PgY; Wed, 28 Aug 2024 14:49:59 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wv6lC1KQpz4N0F; Wed, 28 Aug 2024 14:49:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724856599; 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=G+qVAncLdqvTsT6tYyi8FExSCz1sAw/o1IxxdGHwOpw=; b=yxRXEmeVPj3ZlqzJDEn2Pd46as58ElWI6ud12Pp+IGM4ilniEs6i3im1hf6+nhLL6s00U4 9mB33GFewsdCyjaOOnZAUBmiI03jXw1sYQCFSzruIRJUbTENUGhXqeQFz7KzrAaIf+/Rjn 3kgeRn5qvbpw7PjySZYjPPsUWWgNOdvJH0/Ks06AMPxvWL2r/i1tpxxRgvQoAWkeJo0K54 OWeyJYUQJa5Kn4P9F7NURZoTNP5DkbnT6BPz+1JTTY9af8+4k0Y3mrTye8pu34unESB78W fjB8vJAt01bugL8qtmuNh50GBOY0G54a4m0YUspDcuRlyv2OgjCsiywHFSt/vg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724856599; a=rsa-sha256; cv=none; b=O/WsqCsvOP6ZmBgZUu3l4BBD2z4Vwt47oE2/kniK1uz7PPaMRgWceRxWZ9kC3B7sZQdUmo Mda0NmwjPA0rwZFH+p6E+GpMxG6qZPl3YXnf7kskULM1cA34DATXxnGaVgsaudq2oqr2ws htfuLqV97nHsTy2sC91UK7v/b1PukrntCNWHzbm83qwB1PYeS8hFGF6ffMzNiLwjEMd5Pj i27vK1ypxtVIkwIoMZDZc+tf7hB36N48UThFP+Reu47rfRdlJRQvmfztT5iMJmtIQK7fyt olosCj9TSx9zNQP5/JCHmSjQmBCMrmQbA7L4HsVsqdqlN4/SaWjr5RUp69haeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724856599; 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=G+qVAncLdqvTsT6tYyi8FExSCz1sAw/o1IxxdGHwOpw=; b=jX1w3+aJRE5+3FH4X+kNzVcHVDP5COn2UNbs+9CEyzI+l8wVsQHhQbhkiOoC8tK30nUXHg a1kSKE4bStIUSwn7eBoJcZkVOxKhaSGRbBLV3+CfkaUueVPcU649s2qMFIIdJATwhhxtHI lmMpJJulbh7pFEOwavq9+5lNdYU128fikc7ml626h3abvAHN2XJFmB2/9w3ztz5YjjpuRx /HgupUBqZYsCViRNMYapuoz/sH00fRdmVLqzEtI37eao12Vm+AtqRx7/ZZvq1MKY43R8fw K+1UqKZgvty5s9VSDMLh3uVf7Su8y90UqKFhX5s62cunMjQc5fphNtL2OcuwNg== 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 4Wv6lC0x0yzdB6; Wed, 28 Aug 2024 14:49:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47SEnxdT000170; Wed, 28 Aug 2024 14:49:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47SEnxbG000165; Wed, 28 Aug 2024 14:49:59 GMT (envelope-from git) Date: Wed, 28 Aug 2024 14:49:59 GMT Message-Id: <202408281449.47SEnxbG000165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4e1f29b92dc5 - main - kern_copy_file_range(): handle rangelock recursion 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e1f29b92dc5fdc84d646eb3c16a4155b6ec688d Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4e1f29b92dc5fdc84d646eb3c16a4155b6ec688d commit 4e1f29b92dc5fdc84d646eb3c16a4155b6ec688d Author: Konstantin Belousov AuthorDate: 2024-08-27 21:34:16 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-28 14:34:40 +0000 kern_copy_file_range(): handle rangelock recursion PR: 281073 Reviewed by: markj Tested by: lwhsu Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D46465 --- sys/kern/vfs_syscalls.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 28ab3080c075..ab0e562e73aa 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -4978,11 +4978,13 @@ kern_copy_file_range(struct thread *td, int infd, off_t *inoffp, int outfd, * If infp and outfp refer to the same file, the byte ranges cannot * overlap. */ - if (invp == outvp && ((savinoff <= savoutoff && savinoff + len > - savoutoff) || (savinoff > savoutoff && savoutoff + len > - savinoff))) { - error = EINVAL; - goto out; + if (invp == outvp) { + if ((savinoff <= savoutoff && savinoff + len > savoutoff) || + (savinoff > savoutoff && savoutoff + len > savinoff)) { + error = EINVAL; + goto out; + } + rangelock_may_recurse(&invp->v_rl); } /* Range lock the byte ranges for both invp and outvp. */