From nobody Mon Dec 02 01:46:19 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 4Y1mph1rPTz5fKpT; Mon, 02 Dec 2024 01:46:20 +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 4Y1mpg6mtNz4jJs; Mon, 2 Dec 2024 01:46:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733103979; 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=/ytIFupsY+VpKCIUmuQeEDuRBmelMyGPR0yW+bUB88c=; b=rI8evTpID8QCV1BteuIa+RumAwjbYcpoIQ2tp7kKAEIy9/R4BA5piCGRjsDgbBEWuqrNnf KpHD3Ud7jZK9FTXyDQRyDK9ODc6qya0hAIDwmQv54i2tdLhp4lS3+MvCZfhqYpRfgXA/oR WDukrJDGQxH7TyxtIqDIlcK6XQwwvp0n0fz/Sj0p/7xYxp7f3xuVG11DXbkygT1uOtTmno 744kU+66s+lzzHZKKB/edhEwHuTb6wZiDjg+ALfbVWop+qCf5tPyDpSEqp6tPK8r+jBuQD YtiJLvdyRQcpLES8k0v48R52GzcRB/JHPE+d5R9WsOz2CgoQdmFmidKlimgyZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733103979; 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=/ytIFupsY+VpKCIUmuQeEDuRBmelMyGPR0yW+bUB88c=; b=BvV9mJjlMlEFweHr4dWK52pQc+sWc7dSpcZ8a7wG/5AnRNqhtSnsJKkyqwcdTv80Qcln5f aaAWTTFdev7zszzyC9ZXCPBWba+9OQmM8oDJyQlRz6ICkBaEsZLNfFXil0repf9kg/4yUq m5440MDLy13qN28/mMREhkpcWQECEo1kN0fcEgY1XeLSWTRzFWB0gqWCALaclBG+HOcABc Pg61H1Ukpl/upNq6GMdkqis1EXOfrP+3pQo/IA8Ug4D8UaxkYmGUfqIlHtxZq0/9ItfIL4 Gg02lNT+uwyUzxKE37L0hYrMwuOgz5RV3nm7Jh1Z39XwLuqWxUYRMH1XTg2ZXg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733103979; a=rsa-sha256; cv=none; b=xUFIezzushHZ/zs/4Fnq3Pp+EJsGJJRjMYhp8inoiFjM5UF2t/IXzqb30S5WtH6yZjQo0n zhq4zY0YLRxQF885m2fuTTVWjoUtpS55H0Wr1tcw2efUY5YBQgYTSFPtIqjmdpTBti6Ijz +z8OxOUm15C/QVmv8r+VMGRv1aAVygeqjuItCxK85LBJMYl3tpOg9AxfxUH+Rtw9a5TUo5 8YO2m9eTfpPlr6zsGfD25hyDwc9sGHpajgLLTgOKsm/QKyJdjfp6KY+pyibeouqbqS9Axm Pjtbrz1sh522AEUrNX6PSh8SY85cuM0bIC5EZCFOgTWbbr2C6lekwHRMKAysAQ== 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 4Y1mpg6693zHt7; Mon, 2 Dec 2024 01:46:19 +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 4B21kJaA026618; Mon, 2 Dec 2024 01:46:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B21kJUG026615; Mon, 2 Dec 2024 01:46:19 GMT (envelope-from git) Date: Mon, 2 Dec 2024 01:46:19 GMT Message-Id: <202412020146.4B21kJUG026615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 96b72aa66bc9 - stable/14 - kern___realpathat(): honor uio_seg argument 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 96b72aa66bc920b2c2d741ccad425a6dec0ccc2b Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=96b72aa66bc920b2c2d741ccad425a6dec0ccc2b commit 96b72aa66bc920b2c2d741ccad425a6dec0ccc2b Author: Konstantin Belousov AuthorDate: 2024-11-25 14:07:15 +0000 Commit: Konstantin Belousov CommitDate: 2024-12-02 01:44:56 +0000 kern___realpathat(): honor uio_seg argument (cherry picked from commit bde575b273eeb17abe878e43dd018e8373741298) --- 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 aa6141cb0230..ab28540be8a8 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3203,7 +3203,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: