Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C2C246F487; Tue, 21 Jul 2026 17:34:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655273; cv=none; b=DQNjYzCPDshrU2gmqLe/rO55QKmUOdD07pEcuOSa8so34QkZjjTcXOsjuukn31+GuHX8f7vdFjnCkgg2btL/sGz6fFYwI4Tlxpx2RCLv1+5l/ZEqYW3jGC3RYvSczYj7AfGhN1I5jDwVDdFCsxJGUsDyVtiFiLf1FXao42HHJog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655273; c=relaxed/simple; bh=aL2M2enYsUZSP5RXiDHTz1/I9gv8k8zYKcTkFLuT0mo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PzqEJlBv7vIkjbi+AqByd0yZ5es4vW4avYGlmIJSTH4JpCSC5D760Ls9vihd3Oqq4Vfv2TKijis7immQzvmL3tE7F+1FwUg5DAkmsCVVko5aF1TzsfVMfoV/BWGZK2iTq46S7B86OmCVhKgLn7IIVAwRGMkEdJ2rkHzlv6mabng= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QlZk1JYn; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QlZk1JYn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A19001F000E9; Tue, 21 Jul 2026 17:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784655272; bh=PSwpYe4bfRhUbyucZykDeg9yPMtnbLwVimR4BBxBesw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QlZk1JYnyQZC0oiPYKS1bsYSZz+AqL9YnPN+vb74/XugWB2UH6HnumS0bG1CkUA0o ZmLnkoNDZCMtOgLfqNyskb3xlguT+rA2jeh0S+MU7T58DGknueviVRxBDIKmA361ru hyyGiBCPwEdAktwvVkzFdCBiy12BR2tpyuf8362I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuhao Jiang , Junrui Luo , Madhavan Srinivasan Subject: [PATCH 7.1 2020/2077] powerpc/spufs: fix out-of-bounds access in spufs_mem_mmap_access() Date: Tue, 21 Jul 2026 17:28:13 +0200 Message-ID: <20260721152640.344872157@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Junrui Luo commit 47b87f469a35b5ffc81c16eee6b13a9b6c8d55c6 upstream. spufs_mem_mmap_access() computes the local store offset as address - vma->vm_start, but bounds-checks it against vma->vm_end instead of the local store size. On 64-bit, offset is always well below vma->vm_end, so the clamp never fires and len stays unbounded against the LS_SIZE buffer returned by ctx->ops->get_ls(). Reject offsets at or beyond LS_SIZE and clamp len to the remaining space, mirroring the guard already used by spufs_mem_mmap_fault() and spufs_ps_fault(). Fixes: a352894d0705 ("spufs: use new vm_ops->access to allow local state access from gdb") Reported-by: Yuhao Jiang Cc: stable@vger.kernel.org Signed-off-by: Junrui Luo Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/SYBPR01MB7881EE775E8B51C09F5A29E7AF152@SYBPR01MB7881.ausprd01.prod.outlook.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/cell/spufs/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -268,10 +268,12 @@ static int spufs_mem_mmap_access(struct if (write && !(vma->vm_flags & VM_WRITE)) return -EACCES; + if (offset >= LS_SIZE) + return -EFAULT; if (spu_acquire(ctx)) return -EINTR; - if ((offset + len) > vma->vm_end) - len = vma->vm_end - offset; + if ((offset + len) > LS_SIZE) + len = LS_SIZE - offset; local_store = ctx->ops->get_ls(ctx); if (write) memcpy_toio(local_store + offset, buf, len);