From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=104.30.16.97 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796449852; b=hZQqHssWQtATtpeFFZFjqS9otdsFUfUoOXTmFlb8dQJqBusOwj4uhelovO++g6AkX/iJ 0h5kAMDF0RmWJBgWSGA0kiSpEMto4d9N9Ch13XQ9oqPBy6qfO3bvogIwPZUtudVslTG6M u4MXkQd9zOcgXXbgwPjGuRYJkK772UDj31uV/agyyl8ISyj3bHWcqwdzYUTC+cqdI2GTK lJ9fymhtEPJApXzvnoidYDvtfHH2See7SkCv04lX2rV6rHvVHOMHjW8X1gjmJPwPiqO2M YuXkYFU/wZPb8IWcbA3rdZ4DTkj7PMZoCSuetT8y2OugsNlFrE5auPaE81l1ZX8pOIA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796449852; h=DMARC-Filter:DKIM2-Signature:Message-Instance:DKIM-Signature: DKIM-Signature:Feedback-ID:From:Message-ID:Date:Subject:To:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=csCIQ3MXr3o9FDbwWb23cSgMPmQNJg/tXKNoT/qtr00=; b=cldCgxcecs6cmSO5yoCubNJ6hJmcylP8KoiqEk6qvY5D93aUxPxQl0EzBcLNTJ2HyI/E TplHqQYEIUMmKY0oPt4F8NhSuMdTldyuxZurAOFRxnNSVNIU33ANAjBFftWQ/LK4EDxZS Iq36X7m/LA4AbeSIwQIvyWG1Y7x2o+TkTS48c3PBlEwpnaNnms+oK7p1BQiv/Gb4FtWl4 6bUk4A6qEBZaPHO1WZnM9zQxxZZOTkvtDucG2Z1YqYlBQAspm0II0i4kdMX6/+xYgjApR 92fqvFxgD6bKNeJtJA+kwVb4M2YzDMlnQ5HWlwjgnJQ0Jk3fBTHUfQmwQrn+P2nvyiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=talkjune.com; spf=pass smtp.mailfrom=cf-bounce.talkjune.com; dkim=pass header.d=talkjune.com header.i=@talkjune.com header.a=rsa-sha256 header.s=cf-bounce header.b=h1aXeO3i; dkim=pass header.d=cloudflare-smtp.net header.i=@cloudflare-smtp.net header.a=rsa-sha256 header.s=cf2024-1 header.b=bFsumlbd; arc=none smtp.remote-ip=104.30.16.97 Received: from bg-jh.cloudflare-smtp.net (bg-jh.cloudflare-smtp.net [104.30.16.97]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 504C0606A337 for ; Sat, 5 Dec 2026 05:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 504C0606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=talkjune.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cf-bounce.talkjune.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=talkjune.com header.i=@talkjune.com header.a=rsa-sha256 header.s=cf-bounce header.b=h1aXeO3i; dkim=pass (2048-bit key) header.d=cloudflare-smtp.net header.i=@cloudflare-smtp.net header.a=rsa-sha256 header.s=cf2024-1 header.b=bFsumlbd DKIM2-Signature: i=1; m=1; t=1796449851; d=talkjune.com; mf=PGIxYXVqeW1k NW9jZTJ6bTd3eHp5ZGVyeGp6ZmJzbnBtc3B6b3pmNWVlbDRneXJmeHdieGFAY2YtYm91bmNl LnRhbGtqdW5lLmNvbT4=; rt=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s= cf-bounce:rsa-sha256:M4cHQpmLcLjQA9/+Q5jD3Op0Iv+mOywZHWjfCat/KokVKwWysLVi Fo9GY4LwEyZq9tcwi1RRWde+q046NMyv9YHMAIKcyZbXx66VKTul6Cj0OiLzZrkzotoxYXng +D663QugZW8PeK2CTapRiTU3waFSkwKuNPXYqqWZQDKyXy55TzbPp/JlK1r8C0slA6FgAmwi UtIMWepp7gBp7hqsaWY/FuAVinHrstySDk4aO2NGTI7rFikm67J2Z9ORu/bJBycp1iIGZauJ eXKxPETtYXkAPhRzOGft73dubsevMBoC/Mi+9/aJXGP2nke5k7y42rr/oAWAWTn4ilzajKfd Lg==; Message-Instance: m=1; h=sha256:mS7v0v7BIId+Y6pyJKMijMC/Ck1zgCpyIqcycQ5S eW4=:9w0UGOTwiXXct3hcKTNea0LjsiOxYY97ZpJ9Om+40a0=; DKIM-Signature: v=1; a=rsa-sha256; s=cf-bounce; d=talkjune.com; c=relaxed/relaxed; h=In-Reply-To:References:To:Subject:Date:From:Feedback-ID:from:reply-to:cc :resent-date:resent-from:resent-to:resent-cc:list-id:list-help :list-unsubscribe:list-unsubscribe-post:list-subscribe:list-post :list-owner:list-archive:otp-token:otp-token; t=1796449851; x=1797054651; bh= csCIQ3MXr3o9FDbwWb23cSgMPmQNJg/tXKNoT/qtr00=; b=h1aXeO3iKF7O+7GJjDM6MK5vkj4 x/JF8rLLu2SixhU3kX3pyXF1t7/EHrPq+zKAG3qJ+sjxSE6AkVb89QGuqraGmIc9coylqbKkrFx JNMEPE8VpPUFvOTLaPb5jAFM6bMLK530UmdcL8IqIg2aBvViC4iVgRRgM0MBuuOZZ//W3A7SDij 1WG5lbOOhAQLrnRo9U2ZB16oXVkgUwZxgtyTL0uE+rwLyrrfuVbVoOoKt5c+ghltq0RIHSUOPUd B/l2cJcY1DyOSfQNpYdwMaxUP/R7vGbk7uSzupS3x48iBx1WwIH3vil0njwCjoHVpMxVb/5sTzA 8w9gzUiB9XXXToQ==; DKIM-Signature: v=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-smtp.net; c=relaxed/relaxed; h=In-Reply-To:References:To:Subject:Date:From:Feedback-ID:from:reply-to:cc :resent-date:resent-from:resent-to:resent-cc:list-id:list-help :list-unsubscribe:list-unsubscribe-post:list-subscribe:list-post :list-owner:list-archive:otp-token:otp-token; t=1796449851; x=1797054651; bh= csCIQ3MXr3o9FDbwWb23cSgMPmQNJg/tXKNoT/qtr00=; b=bFsumlbdq14nepkLGp9V1QXDUsn nCA38JQuNfmiWyTD/joC/xZF/wdDrnriYsz43X87cLi4n8ijQSX380xo2lemoE1wQBxQRn+ItdO hzj7srVhZb3Lf6cpOFsw4rls7BNexgN5IDMtrZYsl7F7s+lye0JRCpYVbdsGR7E3JAkv8y/7eRl sTU2QeCvbwaJkPN0X71ntf/gotHg5zSrQTzBukrTaKkUGnISHt/9lqSy15LSAyI68PWDqHMUpwc yveNO3qXeWn2KnjFwk9HzqerVZOFkq3xj29RfPEjtCaeGb0+MQxm+v5XKA3zuPltsECyFslrHGO WBF2+ZvwrTDq/wA==; Feedback-ID: talkjune.com:5:5:Cloudflare From: "Mar Dominguez" Message-ID: Date: Sat, 05 Dec 2026 05:50:46 +0000 Subject: [PATCH 1/3] coda: bound the symlink target in venus_readlink() To: "Jan Harkes" , coda@cs.cmu.edu, codalist@coda.cs.cmu.edu, "Christian Brauner" , "Alexander Viro" , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <4tunabGBgBhPxJPJjae4oObi5JWoQRidatkh@talkjune.com> In-Reply-To: <4tunabGBgBhPxJPJjae4oObi5JWoQRidatkh@talkjune.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable venus_readlink() copies the link target from the reply Venus wrote at the offset Venus put in coda_readlink.data, for coda_readlink.count bytes. Neither is checked against the size of the reply. count is only clamped from above, to the PAGE_SIZE - 1 the folio can hold, so a negative count turns into a huge memcpy() length, and data is used as an arbitrary 64-bit offset from the reply buffer, so the folio receives whatever kernel memory that offset points at. readlink() then returns it to any user who can read the symlink. Reject a reply that is shorter than struct coda_readlink_out, has a negative count, or whose target does not lie within the reply. Found and written with an LLM coding assistant. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Mar Dominguez --- fs/coda/upcall.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 3438119b5..8cf688a04 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c @@ -361,15 +361,25 @@ int venus_readlink(struct super_block *sb, struct Cod= aFid *fid, =20 error =3D coda_upcall(coda_vcp(sb), insize, &outsize, inp); if (!error) { + size_t replen =3D outsize; + size_t offset =3D (unsigned long)outp->coda_readlink.data; + retlen =3D outp->coda_readlink.count; + /* The link target must lie within the reply Venus wrote. */ + if (replen < sizeof(struct coda_readlink_out) || retlen < 0 || + offset > replen || retlen > replen - offset) { + error =3D -EINVAL; + goto exit; + } if (retlen >=3D *length) retlen =3D *length - 1; *length =3D retlen; - result =3D (char *)outp + (long)outp->coda_readlink.data; + result =3D (char *)outp + offset; memcpy(buffer, result, retlen); *(buffer + retlen) =3D '\0'; } =20 +exit: kvfree(inp); return error; } --=20 2.53.0