From nobody Mon Nov 25 19:36:49 2024 X-Original-To: dev-commits-src-main@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 4Xxwv636B3z5f5rx; Mon, 25 Nov 2024 19:36:50 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xxwv566m9z4ckW; Mon, 25 Nov 2024 19:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732563409; 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=JmEm8TghyRrRqUxQ4dxFP/8LoDu1hVMp9Apsgg/U7C0=; b=mRssysTz2cg5Bep43ryKZAR5h4BCQseJk21Ao2//BlTpHN03meDVTtDBqWNTwMAXrDbp2l o+jAMOQTDjguudVG7xZ2390XjOigiCMCjO+MBAfG1G3eoWlG08VfLJqp2Cf4WEw7QWWwzi m28g4arZralfv0ZYiwYkBHQlhaxOrTczXqtbKklrIR+Q+8hWVAvm12gUVT0kqsG+e+oTMP RQZORtbNoiIiOgM0Eri8yBxEhYEjGSIROPaFLywNM+ZNLQMO1j6Qn7UOFSHYyrg8cbRz2j f5IoGet3XA08uTH6GbkOXskGTtGSzZNdirmv3V8nJI/9DRGCRmnsmidt3lcPUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732563409; 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=JmEm8TghyRrRqUxQ4dxFP/8LoDu1hVMp9Apsgg/U7C0=; b=qGKmqsdBWiswu+Jo7qQPfSYqs6O1ncH7zFnjzlk9vVG3DJFPPtbWMFISCYeRNyYL90cMlg qV9QPxphMB7grDgWfQo4kquOhDIIGGFD0cuOu+jgANHWOuXSxfqo6yXTK5jc5tT8F0+uLa 0J9vQ2EFCZNM/8W9igGiEd7+WkCy5RY6zhcvxu/b06kCc3hyTqT43g0hPu6u1Epn7pcKY5 OtV0RfYs+MWM+lN3tksw/J+51AfENFSpUeL3hOviwEjPrz2Ya+RPaplXsmskCdxr94jQ3l mIRGMwJ1cTXRm4fqu0IfFt6qTWAdNtJ4eSKfou1pwRS/plfUeQmNLykXUOt3mQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732563409; a=rsa-sha256; cv=none; b=vxqoIffRaxAAcU//7qkvJ2NyabWZnS+Yw4keK6l0kMpP4ZCWo0FwyIJ16bsIn9YhI35KXa p17RJB1gpicMS3JxyoomgcMVd58rcjXCYg/RdxyoNViz41SY4HpcO+HazJ4AM0L1n0ECAZ raOjf2cb9vpRFag3Gql8hpKubIPPxi66WSR4hqlvGgSzfTyTB4+dq9ktkBdEvr6CCx0czQ jMTxuxJopZ9xHdoMfH9vUERW5gKnCVPqajxgqlm0Y7n7B/Js9LxyZjD3uckazFrwqyV/fB /TJlRJc+zgzREOiNt1aiDuc+kdVIFSpKGqTlKxaqc/Nn9hQG5KIFN20WO8tf1Q== 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 4Xxwv55N0Czt49; Mon, 25 Nov 2024 19:36:49 +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 4APJanvX042184; Mon, 25 Nov 2024 19:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4APJanwj042181; Mon, 25 Nov 2024 19:36:49 GMT (envelope-from git) Date: Mon, 25 Nov 2024 19:36:49 GMT Message-Id: <202411251936.4APJanwj042181@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: bde575b273ee - main - kern___realpathat(): honor uio_seg argument List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: bde575b273eeb17abe878e43dd018e8373741298 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bde575b273eeb17abe878e43dd018e8373741298 commit bde575b273eeb17abe878e43dd018e8373741298 Author: Konstantin Belousov AuthorDate: 2024-11-25 14:07:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-11-25 19:36:41 +0000 kern___realpathat(): honor uio_seg argument Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47739 --- sys/kern/vfs_cache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index f7178ee006ea..c55e103a1a37 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3290,7 +3290,15 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, &freebuf, &size); } if (error == 0) { - error = copyout(retbuf, buf, min(strlen(retbuf) + 1, size)); + size_t len; + + len = strlen(retbuf) + 1; + if (size < len) + error = ENAMETOOLONG; + else if (pathseg == UIO_USERSPACE) + error = copyout(retbuf, buf, len); + else + memcpy(buf, retbuf, len); free(freebuf, M_TEMP); } out: