From mboxrd@z Thu Jan 1 00:00:00 1970 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 C8F67298CC4; Tue, 21 Jul 2026 22:24:57 +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=1784672698; cv=none; b=mWVxeDKk8+qWqhULa35xOGmD9JBQJnJfZ4UQtWRH9S8ah8cuHeNWdS9VzOqyUUagXa5qZanIXqg7UxQWuOKyyojKei024dUfvuCNX9s7tp2Zw2moHXtJFVkbuaChxqpP6RmBYYGDU28vP6ZGJ9vtGcmWdIdhNjn1DtPvfE/pbX0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672698; c=relaxed/simple; bh=jHWwGKc3hsuEQF289NgXSQYLjEFwdqMCBXzZSxfsJ8k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BimVk18ZU67GmCEZ3ygV3QMxjl32x8MVtMXaTyMes5hHv1HgNU5WpoqwLs3YtAVrwHuIsawixxZTHH+Nyx9Ge/G4ry9M+jnXHq6ow3NLDomIubdRGCSNi+WBIiBbb8cJHD9huR2juORiSEXjZZvirxFbKuAv8i/llYjZDr2Lmno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XFBNfcdZ; 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="XFBNfcdZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BE5F1F000E9; Tue, 21 Jul 2026 22:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784672697; bh=u/UTXxubKSxPzR4d914zby8/uYY9ZkNRADoI31bqoIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XFBNfcdZ3+ref+v747Nfe7PE1KstGoew0EUk7AnHIuCTMj0sm26ikgzpZtA4ErWe/ aR3eYIs0fL4DqclFOPrf1AHL3HF9W6IVYSeM/8NaswBk0yHIwuKryfJoh4JD22cbs2 C8McuJ2dHHSP4LpzCOu9oWVIiVnkc/fOUI7eIduo= 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 5.15 721/843] powerpc/spufs: fix out-of-bounds access in spufs_mem_mmap_access() Date: Tue, 21 Jul 2026 17:25:56 +0200 Message-ID: <20260721152422.264377619@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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 5.15-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);