Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1587575ybt; Thu, 2 Jul 2020 08:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQ2Gr/A24YxvzVT70Bh/cA/h3Qj4rdNAi8ikTumBb9ATj0bBAtNG5SSQh310vfYDZY8RvA X-Received: by 2002:a17:906:1245:: with SMTP id u5mr27636275eja.286.1593705389456; Thu, 02 Jul 2020 08:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593705389; cv=none; d=google.com; s=arc-20160816; b=YdonRYuKtU08RNIqE4xOqmq6uhYT+CNLQf6yNmXp3iLbvoJbZIPQFhZ/RfhP3lUOKa RRl4xCSHIa7TsbDl+981exA1GCxpifx4o7m/5V4MNYoFUkmTKkAbipedk0eKwyUO/zQR C6VH/6LV9Z4QnxntRSkQ5/Yyfclqxr6xoFXsC1umZ8M7bWTdV9HXzPkVQwwjaOCoW7JY 41gkdJ0rrVdsYvrzTmOZV9NGN2L2qYJuwU4T2FuQjKvr0+HV/rR+7wkrvqdzlVy3OkHV CZVlF1v3RS9xVNCOnIeDMI/DA9yRzkqBfzzCLVA9fEFqtrZB87My+TdPpcOPSDU/5lO9 PDIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=X1hZZYHT2jx0soQwDY2Nw4ZNux9TK2TS4ou5sFWlySY=; b=BLCi073aJJTLDEqYRggB96qmLt24UaFWcMqmttakXOxFxF8wC0QKL6A5X1R3e6W3zj cTMJgX6278jbDLwM7FUfzEhpJ+hCL5rQuWkwxExc/La3KMszGC/DuLJBnO9EUuOTVFtA ciGAlmCsmaRDjPvHCD3XfQE7FFzyY6UvxaNNjh1fVKK7kd3wXlIZcyZuPPlHDdx2GFIC h3Xm1bcpDFU64+XLa0PRHiX9HS6zjix3Uv3aBVQum0VEVNL/JdXiEASZNRwpqfQgLpA6 S+KCLKEHTJEhcrpdA+2dWoh0hGLi0EGUB0VeELjAa5reGsCf9g8vQ/MJBnngo37EaH2O /Pfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KwW+/U9f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a28si6568002edj.27.2020.07.02.08.56.06; Thu, 02 Jul 2020 08:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KwW+/U9f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726028AbgGBPxA (ORCPT + 99 others); Thu, 2 Jul 2020 11:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgGBPw7 (ORCPT ); Thu, 2 Jul 2020 11:52:59 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DCE2C08C5DE for ; Thu, 2 Jul 2020 08:52:59 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id d17so18151404ljl.3 for ; Thu, 02 Jul 2020 08:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X1hZZYHT2jx0soQwDY2Nw4ZNux9TK2TS4ou5sFWlySY=; b=KwW+/U9fkM+srFlFPvkKz4V3jEnKIKH8ygaroNt4YXgCxeue/VrdTKoJwmcn9oXIVs 4DY0ZVk34mPlw7u4KLu6rGjhvnrQL6/lofTS76CSIpt1KUwe2M3VISdDz83TvG8iTXSI W47Pw8OTk/hC0zb2MZaQ1r596h7N8T5A23JSQkaU9RWiYgGd5Xav7JwLesO4IqMIFUZL 2VuieIxaw/GaR9iMUF6CkG5lHBbOPJgWIfkSCxXHB48wkXOO7uuaIH8G93d6r33rKKeJ p2LG1w2EFwjJvNEP/726kUUAmMNBPXMl5+BvhQTxMO/S6XCBw/1QqIdNdExANIirUL/4 +A/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X1hZZYHT2jx0soQwDY2Nw4ZNux9TK2TS4ou5sFWlySY=; b=UGvfmvrW2e08/vnrNzYWLqmr+k5CDM0JLZaExVIs0DEWqbviwn3sGluMAQ3245G75P ztPJ1lONL95AW36KkClaZJXG2K8M4Yglnjf/Da0v0qth8z6O9TYzSthBxaC7s19YrveO 9PJLFmWkFDAi+zrYjHUv/v1SOO0TF3ESma6uwpt3uEeBY1jKDlictJ/2neCUTGm51YTV FNff+XCxcUmQmCw280JuL414XvqErrTHXA4ksqVFIUeFXdUzEeLWwDM2SuEXNFAJEciC FMp72S+ubMu0XDpxpfPIIgCjDX3oB/5b6d6Hryk3gWnI/CqREg3Nzj5ydNggOzt7Tleu 5wQg== X-Gm-Message-State: AOAM533HtrqaJnr3cnENTBpt8oS7+bWeiZiOO9Jaim12OJ1jzJyFdOBy kSykNgqS5uKWuGgWPd+2s+xHOIjNCdhRU+moaoq4fA== X-Received: by 2002:a2e:b88c:: with SMTP id r12mr16463205ljp.266.1593705177353; Thu, 02 Jul 2020 08:52:57 -0700 (PDT) MIME-Version: 1.0 References: <20200629193947.2705954-1-hch@lst.de> <20200629193947.2705954-19-hch@lst.de> <20200702141001.GA3834@lca.pw> <20200702151453.GA1799@lst.de> In-Reply-To: <20200702151453.GA1799@lst.de> From: Naresh Kamboju Date: Thu, 2 Jul 2020 21:22:46 +0530 Message-ID: Subject: Re: [PATCH 18/20] block: refator submit_bio_noacct To: Christoph Hellwig Cc: Qian Cai , Jens Axboe , dm-devel@redhat.com, open list , linux-m68k@lists.linux-m68k.org, linux-xtensa@linux-xtensa.org, drbd-dev@lists.linbit.com, linuxppc-dev , linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-nvdimm@lists.01.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Jul 2020 at 20:45, Christoph Hellwig wrote: > > On Thu, Jul 02, 2020 at 10:10:10AM -0400, Qian Cai wrote: > > On Mon, Jun 29, 2020 at 09:39:45PM +0200, Christoph Hellwig wrote: > > > Split out a __submit_bio_noacct helper for the actual de-recursion > > > algorithm, and simplify the loop by using a continue when we can't > > > enter the queue for a bio. > > > > > > Signed-off-by: Christoph Hellwig > > > > Reverting this commit and its dependencies, > > > > 5a6c35f9af41 block: remove direct_make_request > > ff93ea0ce763 block: shortcut __submit_bio_noacct for blk-mq drivers > > > > fixed the stack-out-of-bounds during boot, > > > > https://lore.kernel.org/linux-block/000000000000bcdeaa05a97280e4@google.com/ > > Yikes. bio_alloc_bioset pokes into bio_list[1] in a totally > undocumented way. But even with that the problem should only show > up with "block: shortcut __submit_bio_noacct for blk-mq drivers". > > Can you try this patch? Applied your patch on top of linux-next 20200702 and tested on arm64 and x86_64 devices and the reported BUG fixed. Reported-by: Naresh Kamboju Tested-by: Naresh Kamboju > > diff --git a/block/blk-core.c b/block/blk-core.c > index bf882b8d84450c..9f1bf8658b611a 100644 > --- a/block/blk-core.c > +++ b/block/blk-core.c > @@ -1155,11 +1155,10 @@ static blk_qc_t __submit_bio_noacct(struct bio *bio) > static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) > { > struct gendisk *disk = bio->bi_disk; > - struct bio_list bio_list; > + struct bio_list bio_list[2] = { }; > blk_qc_t ret = BLK_QC_T_NONE; > > - bio_list_init(&bio_list); > - current->bio_list = &bio_list; > + current->bio_list = bio_list; > > do { > WARN_ON_ONCE(bio->bi_disk != disk); > @@ -1174,7 +1173,7 @@ static blk_qc_t __submit_bio_noacct_mq(struct bio *bio) > } > > ret = blk_mq_submit_bio(bio); > - } while ((bio = bio_list_pop(&bio_list))); > + } while ((bio = bio_list_pop(&bio_list[0]))); > > current->bio_list = NULL; > return ret; ref: https://lkft.validation.linaro.org/scheduler/job/1538359#L288 https://lkft.validation.linaro.org/scheduler/job/1538360#L572 - Naresh