Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4040369iob; Tue, 17 May 2022 12:31:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweEea3XZCvwTOEynaGRP89/ecVPTguOfK/w/0z4jfISaqRgwDXTsjmAn4mosdbLlpVmdHA X-Received: by 2002:a17:907:3e28:b0:6f4:3900:78f8 with SMTP id hp40-20020a1709073e2800b006f4390078f8mr22044123ejc.736.1652815900154; Tue, 17 May 2022 12:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652815900; cv=none; d=google.com; s=arc-20160816; b=1CzCS6GpbkDqjuHNn0TyW6DghS/OdMOYPnh7xDXVwxbinQJFbqXjtXr3/fA5aCQWx4 n5j/SDVJAvzsN2CvGioDCDztlmgVGmj/RvFz921V7x7g1nAdki/TnSmUJqgzF5nO52mo IhbdtwiQPQUlO4aDTKX1ehVcEjQJlE1sE+ySVOybkUzrfatL4DEGsNcLuqsOG5WzU/JC bU2q/63K8VUZd73JraY2aifH0EH/XLGaK7Hzp7+Lev6iakV5uadhw9yZflacQ3oLVac7 tJ6BqIhYee5QTrXlJ+IoDp/x6TOYgV+6r7ZeEWGWdmiXAlLVAApbtI0Zu/78zoSVkETq 1DBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IrIkpbmuHKrrFsBUcjgqjjP93rmoX31NTGTCvMbPP4Y=; b=GoHZlK2c1WASU08coOq8B0jV6JIfn+RDv/QyzwBKnvt3pM+WpcKyW8a/QmnDVZkihR 897WcVxWESHrEJLcc9mfWxFJaVAr4Dk62jDUBsNaRORWCgLCD7B343bLGFNDM0peg2hL 6TSylWOqECK0GYgwZkDnwxdkk4VtiOleJBw+gafUWG+ArJOzXTweC3xxGpdvsMIwV+XJ O2FwNiOZSqwKG6zMP8d4+1cbwbOiXpj5QEsgnbe/vudhZ3YIPEEGNwhzOhTqiEgzEyrJ mLFqjYp8l136mMv/hikRCEaC07eh1nYFBya2cq4aQ/XTdZ171TwxWfFDSl3tEh4IlsDJ HVCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=NBnYbNP+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hr4-20020a1709073f8400b006f395a10e8fsi102558ejc.594.2022.05.17.12.31.12; Tue, 17 May 2022 12:31:40 -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=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=NBnYbNP+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345981AbiEQMZd (ORCPT + 99 others); Tue, 17 May 2022 08:25:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345972AbiEQMZV (ORCPT ); Tue, 17 May 2022 08:25:21 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B1048392 for ; Tue, 17 May 2022 05:25:19 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id i8so3247185plr.13 for ; Tue, 17 May 2022 05:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=IrIkpbmuHKrrFsBUcjgqjjP93rmoX31NTGTCvMbPP4Y=; b=NBnYbNP+J+JpzURJ6Bf3exMaOrCVSX0qu7AbJU/g5utF6PrfU0h0Z3iopcGlBvlMaC GPNDDKiTgAOxADt5l7Ze5F7iIYg0EeQWUaoI2NkGxf4FSSIbbwRwWPxUNQHvoCM9b3Fd RbW2rvRzAo+Kf46ym8S/g4GDjZXkuFzjGEU4H3BLIEeBLDIPm0KvzYVaZDnPOKrlJalB LrmgUM3YBO579B1Rq/5vGNGBTpVc80eg0Z+iMNjWSBL4pDDBAUriFACI5YQWiy0QYXAt foThqezPvxPmiwv0HisQ9imencOBCyxh/lJ9aQxB2Y3NH3Iqr81CvzDrcRTWh0DqwQ6S gtwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=IrIkpbmuHKrrFsBUcjgqjjP93rmoX31NTGTCvMbPP4Y=; b=lcEwYTNtQBnQ2ruBXzgbrF4BhApPZbQ4hxY5Ob6YnG0T2oz2Hu0FGb7prny2H3GrU5 8wm/ktWz2Y3Ef74W7794xYiwS5or3Gz1Fono7MNr2262xwDjYNDtYSQWuo8k3bwfmpl+ QGCV1eIvs92jTGG0EHsEhQCbAviHgPxnz6cnMaJBlXngCM42LGcIzt0MquT98gESvCKg aoIO7Q0FMnQSskx93oBv1YSr6kBt5LDTUJpt+R4j4jtaSN+chfZdXGqNPCG+APIY0v/V IILOthVg/wevA/g57JS2oRn5UVyFem+HC4/TqgYg2hbuCTswUU9c73iKZhg9JF2lonvq II4g== X-Gm-Message-State: AOAM531tCImGYe1Sr5VARDxLXoASvx2grvFRUaPFFKmgpjfZNq634xbJ kIjqqGOAXXex4AFeIg0LCLwZfwnN/Tr5tg== X-Received: by 2002:a17:90b:4a51:b0:1df:7617:bcfb with SMTP id lb17-20020a17090b4a5100b001df7617bcfbmr6584943pjb.207.1652790319084; Tue, 17 May 2022 05:25:19 -0700 (PDT) Received: from [192.168.1.100] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id b8-20020a17090a990800b001df6216e89dsm1542814pjp.28.2022.05.17.05.25.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 May 2022 05:25:18 -0700 (PDT) Message-ID: Date: Tue, 17 May 2022 06:25:17 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [REPORT] Use-after-free Read in __fdget_raw in v5.10.y Content-Language: en-US To: Lee Jones Cc: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <97cba3e1-4ef7-0a17-8456-e0787d6702c6@kernel.dk> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On 5/17/22 6:24 AM, Lee Jones wrote: > On Tue, 17 May 2022, Jens Axboe wrote: > >> On 5/17/22 5:41 AM, Lee Jones wrote: >>> Good afternoon Jens, Pavel, et al., >>> >>> Not sure if you are presently aware, but there appears to be a >>> use-after-free issue affecting the io_uring worker driver (fs/io-wq.c) >>> in Stable v5.10.y. >>> >>> The full sysbot report can be seen below [0]. >>> >>> The C-reproducer has been placed below that [1]. >>> >>> I had great success running this reproducer in an infinite loop. >>> >>> My colleague reverse-bisected the fixing commit to: >>> >>> commit fb3a1f6c745ccd896afadf6e2d6f073e871d38ba >>> Author: Jens Axboe >>> Date: Fri Feb 26 09:47:20 2021 -0700 >>> >>> io-wq: have manager wait for all workers to exit >>> >>> Instead of having to wait separately on workers and manager, just have >>> the manager wait on the workers. We use an atomic_t for the reference >>> here, as we need to start at 0 and allow increment from that. Since the >>> number of workers is naturally capped by the allowed nr of processes, >>> and that uses an int, there is no risk of overflow. >>> >>> Signed-off-by: Jens Axboe >>> >>> fs/io-wq.c | 30 ++++++++++++++++++++++-------- >>> 1 file changed, 22 insertions(+), 8 deletions(-) >> >> Does this fix it: >> >> commit 886d0137f104a440d9dfa1d16efc1db06c9a2c02 >> Author: Jens Axboe >> Date: Fri Mar 5 12:59:30 2021 -0700 >> >> io-wq: fix race in freeing 'wq' and worker access >> >> Looks like it didn't make it into 5.10-stable, but we can certainly >> rectify that. > > Thanks for your quick response Jens. > > This patch doesn't apply cleanly to v5.10.y. This is probably why it never made it into 5.10-stable :-/ > I'll have a go at back-porting it. Please bear with me. Let me know if you into issues with that and I can help out. -- Jens Axboe