Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp109802iob; Tue, 17 May 2022 20:31:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTbkovfJ+BHd35mUaY1cSPCYLct6C7V7btqoqvLCnNHGO5UziX4LVW+Yf09sDwRkCvkSwy X-Received: by 2002:a17:902:ce8a:b0:161:af5e:a7b9 with SMTP id f10-20020a170902ce8a00b00161af5ea7b9mr4949833plg.167.1652844663099; Tue, 17 May 2022 20:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652844663; cv=none; d=google.com; s=arc-20160816; b=Ax6qWp5DmfaB9aEiROTRyHRLmL0Mh1Pa6oZelRuREpxrQkeSGI60Yx+ROmPm1IuXhS Qg3U98VhOmUlfe8/oe2+/BYQXhs80pV5tWNhOfXAG8rgcs/YRqP70FUmiPNSm1vMC605 IHBrQI+k8/al8cqAoSXjUVND4mmi9epaLuIxHSghH8r6uoHoPgtK/0dg6KpjAzkALJO0 ocBwFqHXJ6660FrtrrCcXbZChTJlsoAty3qY1GdIiERodWWb3cqatWcIX98qc4MrJmNe JYhXBlGhjz5VzJXBs2gW4RuN1tMpzqz9zf6MoKETYa0rzjEZeb/X8uGhYcNIj1jqYunY 955g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XbwAA+UV9EPS2eBIxxAE6MtJ2V0j/gU0x4NnduH/tGo=; b=AzWJbqVqLjUkdiWwjYdIcEAUizaJXzNnfH/8iWKRd5P+T+1dNUKdhPtk2rMtobXLny xzqsf+qy5zy1qNtwo32GU6Xjji82wTTpLUdlxZ26fxzU9HCtBdchaTH7tSb3Dgc1T571 M55S73jZEz1vXhsptzeIlh03dTXoJuWOakx6reanjMn/9lxX0jYRt56n8HEwyr1HkgPX ERIJDLnydmDYLa8OF3kqYWkrAP82SQcnAUWoWxsluPUAYcUx20yzHeF/I/1fi7VOdPG4 m34T1hvEGoGEwUgVW6kkoTqkCVQx4cKSrZghylg3nruhPd4agveuYfcLKYbBFrH6hGHY RIlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uw5ox4qo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s14-20020a056a0008ce00b005103c78638asi1776834pfu.205.2022.05.17.20.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 20:31:03 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Uw5ox4qo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0C8F6EC5D; Tue, 17 May 2022 20:25:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345949AbiEQMYV (ORCPT + 99 others); Tue, 17 May 2022 08:24:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345325AbiEQMYR (ORCPT ); Tue, 17 May 2022 08:24:17 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAEA045ADC for ; Tue, 17 May 2022 05:24:15 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id g17so6375332wrb.11 for ; Tue, 17 May 2022 05:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=XbwAA+UV9EPS2eBIxxAE6MtJ2V0j/gU0x4NnduH/tGo=; b=Uw5ox4qoK+tiwNJytljXi9S6rvn6HY8q4CA1Z0qKALSZ1b6S0ttNJU4tlRpkJEwsGG K5E14DQUPF/n9al3BIk5Wd69mdn7QPzAsOLpKwuDKcQk2tv8n4WlBcaAALxs/wImrs8e 4fHKxDdBystE6zeabxnsurOqo6FCZs/3H9sQy78x0PW7/U86zvfnqZovupRnoe91hAyF /H6aXkNICjxT1qH3CeU1CHrl2OLwYWeZQEyRNoGAEG3NOcy1dys7BEMSjVukbpur+CZM OmA2xNqPaw7Ymp+GPDC3R3jATTNIDqwJkuEgxLev0w1q3uuR8ovmAgwO0Spp3GvsdaGX i1gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=XbwAA+UV9EPS2eBIxxAE6MtJ2V0j/gU0x4NnduH/tGo=; b=ylMZfbHvXGo9m/p9AObmfHM7zBSj5Fx9Rc3D1OZ02BcDdjURtdZBJRDZp82MQLfwNQ CHPEFgKQyqBIS9666pjcv9KQdMet+Zjhz8id/GiBBvBG1HqTDjqgNpjH0EB5BIu8hkzS vj+YPwZ5JY2lGakWAoaEPF3+P/EjDYY1Rn57TgF9T6kSE4J8qZAq6TZTfiKiOGA3SqWB kD+wA2YT5DtcTNJ2Y+hevvI6RkUQLHjNzmmvQpadPjBKIfl7pb8f1aoTIjRrsg3xsc9e ijqFNZlUlSsOKAFHVCXABH2J6XwL5PCAkpFhxQ/2npBw9VLVD+1s4GK8m6tWo8Xhf4ng BzGw== X-Gm-Message-State: AOAM531Y1lHqDPylArM20i7pLakbk5DCThsOQjkKf2DWr93x20inca5j nVc2r1ISdyEOWNKFkBj3W6w3jGriG8v42w== X-Received: by 2002:adf:f787:0:b0:20d:8e3:9439 with SMTP id q7-20020adff787000000b0020d08e39439mr8257040wrp.425.1652790254379; Tue, 17 May 2022 05:24:14 -0700 (PDT) Received: from google.com (cpc155339-bagu17-2-0-cust87.1-3.cable.virginm.net. [86.27.177.88]) by smtp.gmail.com with ESMTPSA id p26-20020adfa21a000000b0020c61af5e1fsm11917542wra.51.2022.05.17.05.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 05:24:14 -0700 (PDT) Date: Tue, 17 May 2022 13:24:12 +0100 From: Lee Jones To: Jens Axboe Cc: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [REPORT] Use-after-free Read in __fdget_raw in v5.10.y Message-ID: References: <97cba3e1-4ef7-0a17-8456-e0787d6702c6@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <97cba3e1-4ef7-0a17-8456-e0787d6702c6@kernel.dk> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. I'll have a go at back-porting it. Please bear with me. -- Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog