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=1796513635; b=RaTqQ8PaxxymyfkK7w/rF+RZhpjpl7VC+GN8iGLMhE6IX5RWbvavwA2OrydFRlP8oBRg y2LrpARAtPIIrbE4Z4pk8LA+XCfhHk0KbWJBntGq6qbyknzUpZoU4pA7OyVgmTl4VfH4l D41WNjBW5nZxGtu505EBn66sLatkz9W1ipIBYUy5oNLmqJ24awgX5VOis5JFIVsEiqOby BSqfdavRpMTdBuoJDLHFGHbp10n9Qqux1ht9aQbWoVgCrDpY4ISnclgxWISsFQNsJYOuv /kxLSiFB81Z2ulqgBnBdoo+o+Zz9taZEUHeYPk1t+wsruhhO0MjtpFfYblFyYWiGR2Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796513635; h=DMARC-Filter:DKIM2-Signature:Message-Instance:DKIM-Signature: DKIM-Signature:Feedback-ID:From:Message-ID:Date:Subject:To: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=Tw4ug2E97KmjkvI8nT8HgwSxe1AMixYChI1kIdasF5w=; b=lCMuUAiLsokvKn/ERoGawRUQtIhxso47baNPdb03j8/kkNu806570khPTTw79LoIOq4h qtRUZGR86m7iaY0MCmP3fifktJI9VBdNdFjxG75YDh61fCA3qw1ooFJtxJi0hFpA0lYtW 7pZF/bI/i+N4rM0gg7ErGJwpN5FPVqGiCJQolYgIMIBaVd1GJvcN+YF33aQAla7lWAQps 76WFUF3o2MRGA/HPEEdkLTK+2HPc2cLT0zW1tlQHKOBqrx1Apgi2QTPTAQ1PhQJUW58/n fB0WYYSoHVS7S/DuTnjl5uGWczwWPssjYv77PPTQs/d/PjWGd+fk3S0f59cQVUhyDVw== 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=fT4dAd1n; dkim=pass header.d=cloudflare-smtp.net header.i=@cloudflare-smtp.net header.a=rsa-sha256 header.s=cf2024-1 header.b=Lnq1AAyi; 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 860BD606A322 for ; Sat, 5 Dec 2026 23:33:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 860BD606A322 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=fT4dAd1n; 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=Lnq1AAyi DKIM2-Signature: i=1; m=1; t=1796513634; d=talkjune.com; mf=PGIxYXVqeW1o dmE2dHd1NDJ3N3BhcXN3d2RjeHk2Y3NhMml5MnppdG9pczQ3azRvM3F5bmFAY2YtYm91bmNl LnRhbGtqdW5lLmNvbT4=; rt=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s= cf-bounce:rsa-sha256:f54uDEBTfOlFTODcphtK3Z7pKuZzLIBuZNesuPb0jd6upIUeDZuP dlGfpylP2DvZzL5ptNZ7t53po2ntUse6V/ZPoM21uvF8b5nN1C/n+h1QdA+dPRqiX0h3uZOc w/s8H+Rb5FRlHRVgJ5ejoHR2Mp5kTGsTx1hmMsP8ajLPm5NLieIdIGeELy7J30s2S01YfxVg aoVy8RMyJJk26779O5o8TxLoxZL7MgFgSfkBEVb0zPT00i+BBF2U5XEVD1j5ButolrQwH5FR yoYm8wS0/CKY9g4FZlg/Ty/5OS2SHUQjvkrkMHNbP3K3xOoZeBnJ/E8Zy5m81FB0+Oo2fhhi 4g==; Message-Instance: m=1; h=sha256:8ESyOrje/6dgu4jfgtLMvX/cYeJyXcsoZFBRg0VM /Pc=:k+hcrG0mKQlZqVgwhiaFnUZW74sIZLBzhTiofbl5cks=; DKIM-Signature: v=1; a=rsa-sha256; s=cf-bounce; d=talkjune.com; c=relaxed/relaxed; h=References:In-Reply-To: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=1796513634; x=1797118434; bh= Tw4ug2E97KmjkvI8nT8HgwSxe1AMixYChI1kIdasF5w=; b=fT4dAd1nJYfOFdWYjjPgkKuaRFu 7hV8Z5YOeQ8OpPG8SxnNtxmVTHtvhUpMdqC+HmLQ5p09m2giEQfJTYkP+JiYIS18dwUiRRyjeID r3k7Ef4gtiLi0Jnj/vE4ZLuj5g2Aepiw+z1nrGM4giAZrJDYYK7FwWeLRnxCiWK7jCQMkREnpfX g4C61/TkrIFdLpFFVg8lrVhX/Whj2Xytmxzy9V9ZxY0UCSNW4vQVZ+pFibkq1JdiQBIg33BmUDt xNa2Uo+qI8UC4B9/8icG8iabWOd3nhX+3k7b/VqHmGNiHwjdQHdxlLJzVhKoGXd0MPhIhblvLGE UxEwpfyDSewCLSA==; DKIM-Signature: v=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-smtp.net; c=relaxed/relaxed; h=References:In-Reply-To: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=1796513634; x=1797118434; bh= Tw4ug2E97KmjkvI8nT8HgwSxe1AMixYChI1kIdasF5w=; b=Lnq1AAyiwxGWDYAYyx9HTt5vlKz RVauW2dv/POjxIeHoHmhpkltJGK9aZnXVK6LaThJBlSEZ3PQ/3nwKuPxc6N6xpuXK0aVrsMiDcO 4QM+K02khbWbIB1XDtA6gBgWxnGKf3woQztGXNdv/JrFX8IyLDdN+Ak2Ld+KHLy/iRkw9DDgO8s S87Hr8p0eW5sex2aD4Z3kP0UvCFNu3iHycUBsJVI38EqD/TmQTEMgQSrP47JSsX9cwhBUM/PAQJ ujh85ymcJbXumbNnN9VvxY878s4SbrmR8McOVz5v3ToxWaMWelgwCQeC3LcYBKtIr0Pvh5b45wg w3dysMVfiBKfKmw==; Feedback-ID: talkjune.com:5:5:Cloudflare From: "Mar Dominguez" Message-ID: Date: Sat, 05 Dec 2026 23:33:50 +0000 Subject: [PATCH v2 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 In-Reply-To: References: 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 buffer using coda_readlink.data as an offset and coda_readlink.count as a length, without checking either against the reply size returned by Venus. count is only clamped from above to *length - 1, so a malfunctioning Venus returning a short reply, a negative count, or an out-of-range offset would cause venus_readlink() to read past the reply buffer or pass a negative length to memcpy(). As defensive hardening against a buggy or short reply from Venus, 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. Signed-off-by: Mar Dominguez --- Changes in v2: - Reframed as defensive hardening against a buggy or short reply from Venus and dropped security wording, Fixes:, and Cc: stable. - No code changes. 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