Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp318159qtb; Wed, 19 Oct 2022 02:47:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xuF4g2W/4R/2p/useO3Z/SetvJqMMGm3uwRqAUfQftMIEcakCTG5d7cv7ecrztG5lGBxJ X-Received: by 2002:a05:6a00:1ac8:b0:563:7d18:7a15 with SMTP id f8-20020a056a001ac800b005637d187a15mr7734949pfv.59.1666172838986; Wed, 19 Oct 2022 02:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172838; cv=none; d=google.com; s=arc-20160816; b=Ztx8J2BelNH2P6EHkpsXTyKgz+ZT3Hr58EMyPoNkGlv6FJ2/TjndmcX3+77pecjJOf bqkOe3e+S6RQAHoqKDdNoiydI+1ZCnevyYp8V6af0b2cbKinSQTjhECZT1ZFS04LLkgX 3NHiWJG1xrf9tUQ3ZbEGlcfKiknKcvRj2mObPiQNHbVXLicm/c0FNtdk3OQqayhAMQDv IzIAGSOFyw4oBUwxJXz80wLDtUbMRS9qVg7JjnVQdhmEgWscv1tt5Y+hp8DeSaWXk8G5 WuSwjdHr9BKT/Xudwp8UMYW6cD0dFxU/g5KnBxR0Mn+wJzKGssdT211tKY0Kg5LLaANB Lvdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+JV4eGhallNZQy1tbM/go07E+phU8qcmKhznja7zYPk=; b=oIKfNpxS8Xy8DnfKCxibKQasDEkjTWpbaDSsc4aDT3GBzZMu6DAhdnwhqKBhmrKj6q 80+4mtygq+kGdUXDe2GdTx/SYVm2I85VLpN3WsYOIaLB/7/9m8eH9KycKSaQC40m1pX8 NG/luEHKHm4COr2/dTwvnvh8qWk+z4xhHvozMJbT4cqVo1oyAA4mWQGJdYhM0y9nD1PQ Qn3S8/zSLKmvZLKac1SBn9IVePIDvbdrw9jUg9egcE/vfh+zYUlKf8QdS6LNN5thj9Ib e+CPK5rZLO+mL1jAGroNum23IoDB7HebmK3ehPM2gpoV5pePB+uE96B+XCkhT1FKwJtt edSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hkwJ06WK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on10-20020a17090b1d0a00b0020db486e32esi20182213pjb.158.2022.10.19.02.47.05; Wed, 19 Oct 2022 02:47:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hkwJ06WK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234463AbiJSJoI (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234530AbiJSJkj (ORCPT ); Wed, 19 Oct 2022 05:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62677F018B; Wed, 19 Oct 2022 02:17:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6024361834; Wed, 19 Oct 2022 09:16:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C0EC433B5; Wed, 19 Oct 2022 09:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666171005; bh=N5Fk36xhWE9Z2gJD+Mj+1ntG8BLl5wzMznG0J3oGd0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hkwJ06WKwzCUgZIE3YUyZinW4i3eaIPo+U3avds+596YylDvKGna8c1p4JetkyCb9 SLI5cTA/i/hiLKBQsEjsLm1yNgadMzgK/fmbiogvMOSqPQJ6dhdxEroo9/+kP329sZ yJ2lWQZLcUInl5pO/cADjJ0mdOiLmi2ngCXm56no= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , syzbot+e5198737e8a2d23d958c@syzkaller.appspotmail.com Subject: [PATCH 6.0 858/862] io_uring: fix fdinfo sqe offsets calculation Date: Wed, 19 Oct 2022 10:35:45 +0200 Message-Id: <20221019083327.799672854@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Begunkov commit 00927931cb630bbf8edb6d7f4dadb25139fc5e16 upstream. Only with the big sqe feature they take 128 bytes per entry, but we unconditionally advance by 128B. Fix it by using sq_shift. Fixes: 3b8fdd1dc35e3 ("io_uring/fdinfo: fix sqe dumping for IORING_SETUP_SQE128") Reported-and-tested-by: syzbot+e5198737e8a2d23d958c@syzkaller.appspotmail.com Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/8b41287cb75d5efb8fcb5cccde845ddbbadd8372.1665449983.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/fdinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -95,7 +95,7 @@ static __cold void __io_uring_show_fdinf sq_idx = READ_ONCE(ctx->sq_array[entry & sq_mask]); if (sq_idx > sq_mask) continue; - sqe = &ctx->sq_sqes[sq_idx << 1]; + sqe = &ctx->sq_sqes[sq_idx << sq_shift]; seq_printf(m, "%5u: opcode:%s, fd:%d, flags:%x, off:%llu, " "addr:0x%llx, rw_flags:0x%x, buf_index:%d " "user_data:%llu",