From nobody Mon May 25 01:17:34 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.5]) (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 9A720366060; Wed, 20 May 2026 06:28:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258533; cv=none; b=cxVgHPJpERT7hGdxW/x93h5BdD5+E9nP5r2Kltbi2+uvVHbr0cBnk13FMRAPKDRA+NdtfSNBAYlhid8qox7PQBq2nMTvR0+FSEjwuHfFPiRYmaegLFzuNcVkZLbfaPs8taWfeMMQGLbgfksA4obopxAybLX1CA0fQBlxeUJlF1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258533; c=relaxed/simple; bh=I+1ogSeJKYuojHSs42V27ZpdzAvHqRsNBg2CvhsGyz0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hZuYPCGbhJbYgju74zhXZSwtEVTJrVJKWr4v4oBYfTuhKxwlQfs1YyqMFUS7uzVJOVwGo82O9tKB7yM3zFHXn+Cb6jbu4X/7o5J/HUB4dX/br+u2aQwsw7bHZw2Hbi6dYAiHIJvIoBnrTjDgNpTMyLf7kTUDMor2Gkizy1ykOC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=WYETC6VC; arc=none smtp.client-ip=220.197.31.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="WYETC6VC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=V/ w9FUmKivkArIsAleWJ2/m6pzU1GMwFJZlkA2kvgXI=; b=WYETC6VCjRelVe8zXD Ho6QzUrHpq5qLJjsuxCpJgUiE34vztRLWh59JMaA4FCi2oPIJiCN7BEClZ5VUOtn ubeHkz0eRhz/HuXh5GpHHN/LjoDNPA+xVSWWOIg1mN4/RGb6JVJpSZhpNBHArsf9 vGuyGJOS5b4gNq9Ps41cFGoAw= Received: from pek-lpg-core5.wrs.com (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgBnrbWRVA1qpWqxEQ--.9S2; Wed, 20 May 2026 14:28:36 +0800 (CST) From: Robert Garcia To: stable@vger.kernel.org, Pavel Begunkov Cc: Jens Axboe , Li Zetao , Robert Garcia , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5.15.y] io_uring: prevent opcode speculation Date: Wed, 20 May 2026 14:28:33 +0800 Message-Id: <20260520062833.2563847-1-rob_garcia@163.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: PygvCgBnrbWRVA1qpWqxEQ--.9S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFWUGr45tF15Ww1rKrWUtwb_yoW8JF47pr yUGa1YqrykKryxK3Z5GF43CFWUCa9xAFWxXw4Duw4Syr17ZFnIgr109FWIgFy7tFWvkry5 ZrZavFZYv3y7Aa7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0piGjg8UUUUU= X-CM-SenderInfo: 5uresw5dufxti6rwjhhfrp/xtbC5hQYg2oNVJQ8PAAA3O Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov [ Upstream commit 1e988c3fe1264708f4f92109203ac5b1d65de50b ] sqe->opcode is used for different tables, make sure we santitise it against speculations. Cc: stable@vger.kernel.org Fixes: d3656344fea03 ("io_uring: add lookup table for various opcode needs") Signed-off-by: Pavel Begunkov Reviewed-by: Li Zetao Link: https://lore.kernel.org/r/7eddbf31c8ca0a3947f8ed98271acc2b4349c016.17= 39568408.git.asml.silence@gmail.com Signed-off-by: Jens Axboe [ Use req->opcode instead of opcode here. ] Signed-off-by: Robert Garcia --- io_uring/io_uring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 38decfc1a914..47221d7bad61 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -7365,6 +7365,8 @@ static int io_init_req(struct io_ring_ctx *ctx, struc= t io_kiocb *req, return -EINVAL; if (unlikely(req->opcode >=3D IORING_OP_LAST)) return -EINVAL; + req->opcode =3D array_index_nospec(req->opcode, IORING_OP_LAST); + if (!io_check_restriction(ctx, req, sqe_flags)) return -EACCES; =20 --=20 2.34.1