Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2290857iof; Wed, 8 Jun 2022 01:35:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuIttqTIpc2vJsg+KHSNxKuPqwNoBdM02dKWouasZROGkOE3jRqZP9zeoaEePRNXFdlG9l X-Received: by 2002:a17:90a:7841:b0:1ea:3f61:7673 with SMTP id y1-20020a17090a784100b001ea3f617673mr2213151pjl.110.1654677322845; Wed, 08 Jun 2022 01:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654677322; cv=none; d=google.com; s=arc-20160816; b=TOOXwVPW0ssqc0ZiplUeiwBe9PH7kNYnG0vWGkSzmMIz1WE1Jtyzy89USGC7L3KYTk hCPRsgcSyvO7VAEI3sZ1Qh5v/lvuIbERaacRQPECX5K3qDuoO7UYxMnG4puG7rIpHrAc S0UjqVccDd+jg324cDeFRp4Ugii5cjUwWeLPwB8NMxXamVWyZB8yhej2CT9t7aqX/M5G mBGwcJQAYv4/Vf/aiQ/BCuKIOpcUwOxvMJmFGLD3qKhfaNo3zCwWZLUnXmm4aRf0tw/R UFfowdXgQyJKY/nSb3y3qOIOsOetidncA2klMcpbDeMkBG/UxWXmIk1wkgnVMlv/1Mwf 8/VA== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rb8PtiqYu5cbp4L1/wbvkrZWp96775LgK31d20avxd0=; b=oZ6GdS4O2gjzg0niJ2qGhuAP7hLvQZd0wIfqPI9XBxxGla+SCCmDvPbY/h4uY8VL9A I29DxApXnWzcoxMM2QruMoS8AGlLyxmkiuriVYrMRlcBUgBbRxjsMvgIDq+hvU3ZzapT tFvqmcwm87wuM/Jthy8dQlC28i30mHx5RXxfgzTA811qCyMK3v7NpV4lCrJykRe3oLuP EaHovZrl47hsKUicJatzdmkSqhml7KxTdkiz+kiLM8bUmQNuucpo5NjsbyENf8xumkOO Q5Ab+rJyoKgf4Atrr52S9xuRiOW8dDrUN8xzwbIdllrDQ/Hm60QBhNkEL0he+3IP3tLb D+LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XDQVraJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v3-20020a056a00148300b0051c4c9292e5si3722343pfu.308.2022.06.08.01.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XDQVraJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 54C471F0FE1; Wed, 8 Jun 2022 01:01:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240598AbiFHHME (ORCPT + 99 others); Wed, 8 Jun 2022 03:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235703AbiFHFtz (ORCPT ); Wed, 8 Jun 2022 01:49:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04BDF1567C2; Tue, 7 Jun 2022 20:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rb8PtiqYu5cbp4L1/wbvkrZWp96775LgK31d20avxd0=; b=XDQVraJG6VNU51qlL2Cm9Ls3AW QwUxqU1rbHT7aux/Hf7mU8uBRW+nAvn/g434eK7KcdQvxHq1XqCkXN45g0Jy0uDMpBxtcUzRZ8JYb L9o9w1mjqa/kbQBQism8A7rfvU4zaxYSQVB0bLTNhZo2xNHD4NxtmLg/wNo766JpC75Lj2PXd/HJ1 Yu1kWx7yGd6y/F7zAVvZ2sfYrAhImlz+3cG82JXuajyGx23L1xPDzBWasTjfmgUnEycNQIzdZBJ6L LRFZoUyM5iBpbcBtzAwxgjseaIER0sY7FETYccxpTBBLQskNFCTPh9rXB6RUZ+1y5o1C8fbDFcPcN qQbhKTUg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nymJw-00CH9N-Dj; Wed, 08 Jun 2022 03:25:24 +0000 Date: Wed, 8 Jun 2022 04:25:24 +0100 From: Matthew Wilcox To: Dmitry Vyukov Cc: Dan Carpenter , Greg KH , Alan Stern , Andy Shevchenko , syzbot , hdanton@sina.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, rafael.j.wysocki@intel.com, rafael@kernel.org, rjw@rjwysocki.net, syzkaller-bugs@googlegroups.com, linux-usb@vger.kernel.org, Linux-MM Subject: Re: [syzbot] general protection fault in __device_attach Message-ID: References: <000000000000bb7f1c05da29b601@google.com> <00000000000010b7d305e08837c8@google.com> <20220606123839.GW2146@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Jun 07, 2022 at 09:15:09AM +0200, Dmitry Vyukov wrote: > On Mon, 6 Jun 2022 at 14:39, Dan Carpenter wrote: > > > > On Sat, Jun 04, 2022 at 10:32:46AM +0200, 'Dmitry Vyukov' via syzkaller-bugs wrote: > > > On Fri, 3 Jun 2022 at 18:12, Greg KH wrote: > > > > > > > > But again, is this a "real and able to be triggered from userspace" > > > > problem, or just fault-injection-induced? > > > > > > Then this is something to fix in the fault injection subsystem. > > > Testing systems shouldn't be reporting false positives. > > > What allocations cannot fail in real life? Is it <=page_size? > > > > > > > Apparently in 2014, anything less than *EIGHT?!!* pages succeeded! > > > > https://lwn.net/Articles/627419/ > > > > I have been on the look out since that article and never seen anyone > > mention it changing. I think we should ignore that and say that > > anything over PAGE_SIZE can fail. Possibly we could go smaller than > > PAGE_SIZE... > > +linux-mm for GFP expertise re what allocations cannot possibly fail > and should be excluded from fault injection. > > Interesting, thanks for the link. > > PAGE_SIZE looks like a good start. Once we have the predicate in > place, we can refine it later when/if we have more inputs. > > But I wonder about GFP flags. They definitely have some impact on allocations. > If GFP_ACCOUNT is set, all allocations can fail, right? > If GFP_DMA/DMA32 is set, allocations can fail, right? What about other zones? > If GFP_NORETRY is set, allocations can fail? > What about GFP_NOMEMALLOC and GFP_ATOMIC? > What about GFP_IO/GFP_FS/GFP_DIRECT_RECLAIM/GFP_KSWAPD_RECLAIM? At > least some of these need to be set for allocations to not fail? Which > ones? > Any other flags are required to be set/unset for allocations to not fail? I'm not the expert on page allocation, but ... I don't think GFP_ACCOUNT makes allocations fail. It might make reclaim happen from within that cgroup, and it might cause an OOM kill for something in that cgroup. But I don't think it makes a (low order) allocation more likely to fail. There's usually less memory avilable in DMA/DMA32 zones, but we have so few allocations from those zones, I question the utility of focusing testing on those allocations. GFP_ATOMIC allows access to emergency pools, so I would say _less_ likely to fail. KSWAPD_RECLAIM has no effect on whether _this_ allocation succeeds or fails; it kicks kswapd to do reclaim, rather than doing reclaim directly. DIRECT_RECLAIM definitely makes allocations more likely to succeed. GFP_FS allows (direct) reclaim to happen from filesystems. GFP_IO allows IO to start (ie writeback can start) in order to clean dirty memory. Anyway, I hope somebody who knows the page allocator better than I do can say smarter things than this. Even better if they can put it into Documentation/ somewhere ;-) https://www.kernel.org/doc/html/latest/core-api/memory-allocation.html exists but isn't quite enough to answer this question.