Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4826935ybc; Fri, 15 Nov 2019 10:40:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxP26iGJDjKDwQlLwgXUdVcrJAAZafJ7TY5xQ70xGuPLWXKoiIbaOY4pdxGsWVN2Vackjw/ X-Received: by 2002:a17:906:8307:: with SMTP id j7mr2710687ejx.171.1573843245965; Fri, 15 Nov 2019 10:40:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573843245; cv=none; d=google.com; s=arc-20160816; b=RncfTK5U/jOx3LvRKbToDKVjyhrUbWch6ZRIhD4jCRNdpJqTb/dWuhHG5ubW8EC14u Ve3uSbcyopq5XTzGvfqhoxhp5TTcQh7ibY96bUN9MfGVxhzuHrK8ZQSrQFwQEL+krB52 eZfAc+QfSDiLFfbeyAaOHNYpAu1K+96t2fcyjq1W8C7qyljpV7DMfNXIPj1x9omesUiG pzjK2lpVL0iPt0paiB0u+FnXBEDLroEJHkfRpbLIcbNbii5mr6FE9ci53KxCWJ7kK19l tJpoKu/hnzKLWLE70tpskwuQ04pMQZznQNpi9g52CqqqD8hnn5hEY0LFRNRrm7xCo0OV YuRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pOxtdnBlf400UFejhsn5PA0wzxRAH7tUC0YEWQoz7Sk=; b=sOpNJPgAcYBcFJSV3tF+41arTTl6VTbulnu18dy1Drlf3UxUcLzQuV49MR0tFKtFIY MesZyT+WtDERaFFBhTw3aImEUQDZ8nLeNhFyq8mhpbsTxs5J2mxwJAFr+TFB8nDzKgXm MKK4PoWNphAWvkHNlFVBaJ2xE54RVNgI/wVtNN4KfPkOSZiSKXaBjEj0wxWNgxHaBUcB fe0LQNTGp3HiBh1udzg20vuLpXo4KtSrGNReRM1eOGhgtic7g7hLS9/QNWHDKE/0CJLi UPblTrK3dN4GudSGeButZlkxFFSpdedeYIMRr8Y81crFyMEdrbJLU2ticqirpwsyXnRg TOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=aJTF8vWc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 49si7141359edz.9.2019.11.15.10.40.20; Fri, 15 Nov 2019 10:40:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=aJTF8vWc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726952AbfKOSis (ORCPT + 99 others); Fri, 15 Nov 2019 13:38:48 -0500 Received: from mail-il1-f193.google.com ([209.85.166.193]:40196 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfKOSis (ORCPT ); Fri, 15 Nov 2019 13:38:48 -0500 Received: by mail-il1-f193.google.com with SMTP id d83so9985396ilk.7 for ; Fri, 15 Nov 2019 10:38:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pOxtdnBlf400UFejhsn5PA0wzxRAH7tUC0YEWQoz7Sk=; b=aJTF8vWcLLieo99J4Vf7oxXJQZ3TVsoxbYA4wnDuGUZQGQ7Cpf7civp39orFKnXIMd HJqCdt3nD//124kt9MpeYzup3tPzk3o0ztCdXB/ugbXU3iTV1k6p3ZfIIQEQTOSnUkQp SKIH6Os/MuvXajhyUYJSplCgkG6gE4s1/8zt6nBVZSBY+LyMM9OE22mzw0/NMfOrNBjo n0GYzmc9tgwupv7oAaV+YKWs4TVUc5jxEFIXFKrR7ClEhVHaBbTGpHyWONoOtziGeZBJ u1IxIs84KlIRHjVURleIZ674Rgk/Tb7t7C+6fxVHQgBDihj6suKs3qLyUSpUd0hmTVO6 9xNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pOxtdnBlf400UFejhsn5PA0wzxRAH7tUC0YEWQoz7Sk=; b=YvyOTa451VSDd4SDKjBg1wsD5jyPs7Pfity1V8E8mvlV1xysof14iMtH1WRJ3y5/Au BAZokoVtz67QzYVI+Kdpk17sBzNXajes+ZIfGy01eSV2M0OZBQGQ6kV2LEC/IF0obYWF 4Pyy9urwT4QqOFiSdOza1jc6snMigPfkknshJXs9go09AgyeJLeRQDpdYd70zLREBPWW 404MXCoeUQ6+7cckCwPmLl93aKdtr7/zijApoBxX+n+ACtCJCWBxvbqn/PWyGGsBBgqR dEpDk9JmS7HFjxAvqPLYgSq6DK0nA69nybe1uCHr/CeW9jnKzOkEtCUcufVj6O9U+DN+ LcGw== X-Gm-Message-State: APjAAAVgtkoL9KFOw7x9jYii74vMU5U7X3ncvNj/Ib1AoOzlnObh3LUA YflNi9FgBg8SCAJvFidd6Vo4bQ== X-Received: by 2002:a92:d390:: with SMTP id o16mr2353175ilo.110.1573843126130; Fri, 15 Nov 2019 10:38:46 -0800 (PST) Received: from [192.168.1.159] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id x18sm1318752iob.70.2019.11.15.10.38.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Nov 2019 10:38:45 -0800 (PST) Subject: Re: [PATCH BUGFIX V2 1/1] block, bfq: deschedule empty bfq_queues not referred by any process To: =?UTF-8?Q?Holger_Hoffst=c3=a4tte?= , Paolo Valente Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, tschubert@bafh.org, patdung100@gmail.com, cevich@redhat.com References: <20191114093311.47877-1-paolo.valente@linaro.org> <20191114093311.47877-2-paolo.valente@linaro.org> <89dde326-fc76-10cc-5ec9-ec5fd4dae4ac@applied-asynchrony.com> From: Jens Axboe Message-ID: <79c4f395-4396-a874-d788-ef9ab0381b0d@kernel.dk> Date: Fri, 15 Nov 2019 11:38:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <89dde326-fc76-10cc-5ec9-ec5fd4dae4ac@applied-asynchrony.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/15/19 11:32 AM, Holger Hoffstätte wrote: > On 11/14/19 10:33 AM, Paolo Valente wrote: >> Since commit 3726112ec731 ("block, bfq: re-schedule empty queues if >> they deserve I/O plugging"), to prevent the service guarantees of a >> bfq_queue from being violated, the bfq_queue may be left busy, i.e., >> scheduled for service, even if empty (see comments in >> __bfq_bfqq_expire() for details). But, if no process will send >> requests to the bfq_queue any longer, then there is no point in >> keeping the bfq_queue scheduled for service. >> >> In addition, keeping the bfq_queue scheduled for service, but with no >> process reference any longer, may cause the bfq_queue to be freed when >> descheduled from service. But this is assumed to never happen, and >> causes a UAF if it happens. This, in turn, caused crashes [1, 2]. >> >> This commit fixes this issue by descheduling an empty bfq_queue when >> it remains with not process reference. >> >> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1767539 >> [2] https://bugzilla.kernel.org/show_bug.cgi?id=205447 >> >> Fixes: 3726112ec731 ("block, bfq: re-schedule empty queues if they deserve I/O plugging") >> Reported-by: Chris Evich >> Reported-by: Patrick Dung >> Reported-by: Thorsten Schubert >> Tested-by: Thorsten Schubert >> Tested-by: Oleksandr Natalenko >> Signed-off-by: Paolo Valente > > Jens, > > can you please also tag this for stable-5.3 before the next push? > The original problem was found on 5.3 after all, and hoping for the > stable-bot to pick it up automagically is a bit unreliable. Too late for that, but we can point stable@ at it once it's merged. -- Jens Axboe