Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5622470rwp; Mon, 17 Jul 2023 07:07:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGanyZVdTWlgziCu+hdCBrQ5wNZHFFl2zxoDV5tUB3nN+57H0oqV8IAKYl+E4lP6PsKjR6A X-Received: by 2002:a05:6e02:1d9c:b0:348:7d73:20a8 with SMTP id h28-20020a056e021d9c00b003487d7320a8mr7086599ila.1.1689602850223; Mon, 17 Jul 2023 07:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689602850; cv=none; d=google.com; s=arc-20160816; b=HzLFXMs32Ec74Zo4xUD+wradK/Dk/JESa8wHJvqCQkcrJDIFcD+nZ/nDk2CzaFJvl9 b2jaPDD1WdupblGwQbBJthH2h0LBIto4Yu8vxEcDmxK21OR0JMt92/wb54ZuwAT1UtYj WWrvbf0f3cTfPknEW2mE4zb0AoILwvOWygWSZzxPJ61W+j0Jv60WeRhvsA6Qil4jT4EP mD9dMJ9ZOt/oBGdC8/e6s8BJdTUKSNlAf0SpxgOARkzm5UtaBxhpA3bVzS4nJFrN2Oo9 HTWaECEXx1PxfOj2zLoCClbZSt6E7L9+9iGOoIfWVwguW2mxfewXWDnFICA8q5YWKItu CC6Q== 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:dkim-signature; bh=NGhBJDzK/BM5omhjtk3XcApjj6iCqwWj80Nq511FRfU=; fh=HH22fYZY8YufMtV7LpfcHSX8cLZQh69r7YE63iPLWmE=; b=qXBszeESLz6AH5bNlegIop7DJkG2AmgMEh16oN30JVnEny22mXuVMIMKeZ2wQ0yg5F WEoTV7FWMmEtMZKSCApAd3HaKjteOrYflz7h6N2CEGVIXcDRYicVTxrhA2nTI1LVS2dH OzmxMM2jgJjw7jPOTE/FgN1Ahsggei2iS9lVWFzarn8rWUL7jKuq99um90cWhB703grA 0HhFWDMo+LGFTDbbFz1q5FC9g5Zh/J8YDZyT5qIUWx2P12MDDx+6+mOR2SvRlevNARKL 1y6QIzaCUQPsg8qKJCQXEZwb97iKeKGiVAV+njyKUxQyCuOi5W4Tvf/O+nEznEW2S1C8 +Xkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=j6+qAp97; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 b7-20020a17090a550700b00263035570e1si5630573pji.89.2023.07.17.07.07.21; Mon, 17 Jul 2023 07:07:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@suse.cz header.s=susede2_rsa header.b=j6+qAp97; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231636AbjGQNxv (ORCPT + 58 others); Mon, 17 Jul 2023 09:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231378AbjGQNxr (ORCPT ); Mon, 17 Jul 2023 09:53:47 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A106BBD; Mon, 17 Jul 2023 06:53:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 2D363218F8; Mon, 17 Jul 2023 13:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1689602024; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGhBJDzK/BM5omhjtk3XcApjj6iCqwWj80Nq511FRfU=; b=j6+qAp97kIaAGQsttxpdrwu3ZJ39DYBPXdkxVXGAbJvQxZlDIvouAicJ0RXcm3EF+W6uXi eCSn+RLmYx06Xc50yJSMbreOfzcXN3VM8ZI0gTlnIFrfGMiX7Vf3IKpImVUO4af6jiLcux A+8LO4/0x2RcIy0/JeEeDnkv/3J6KfM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1689602024; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGhBJDzK/BM5omhjtk3XcApjj6iCqwWj80Nq511FRfU=; b=hLy0WTYyo0GTK85US7wgooIs0L1s1HNxXLN6pkogTg9FgDNeGZdTjwi3lQOqBfmlEcWakj Ui+IIMCp0Rf4tFDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9DA17138F8; Mon, 17 Jul 2023 13:53:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pM++JOdHtWQ+WwAAMHmgww (envelope-from ); Mon, 17 Jul 2023 13:53:43 +0000 Message-ID: Date: Mon, 17 Jul 2023 15:53:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: Fwd: mm/page_alloc.c:4453 with cfg80211_wiphy_work [cfg80211] Content-Language: en-US To: Matthew Wilcox , Bagas Sanjaya Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Rudi Heitbaum , Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Kirill A. Shutemov" , Michael Ellerman , Andrew Morton , Linux Kernel Mailing List , Linux Regressions , Linux Memory Management List , Linux Networking , Linux Wireless References: <51e53417-cfad-542c-54ee-0fb9e26c4a38@gmail.com> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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-wireless@vger.kernel.org On 7/16/23 13:28, Matthew Wilcox wrote: > On Sun, Jul 16, 2023 at 06:10:44PM +0700, Bagas Sanjaya wrote: >> Hi, >> >> I notice a regression report on Bugzilla [1]. Quoting from it: > > Maybe you could try doing some work on this bug before just spamming > people with it? > > if (WARN_ON_ONCE_GFP(order > MAX_ORDER, gfp)) > return NULL; > > This is the page allocator telling the caller that they've asked for an > unreasonably large allocation. > > Now, this bug is actually interesting to the MM because the caller > called kmalloc() with a ridiculous size. Arguable kmalloc should > protect callers from themselves (alloc_pages() is more low level > and can presume its users know what they're doing). > > Vlastimil, what do you think? Something like ... Hmm should be more robust to check size > KMALLOC_MAX_SIZE before even doing get_order(size). Ultimately it checks the same limit. But I'm unsure about just returning NULL. I think warn_on_once might be useful even there - in case a bug is introduced/exposed, even a inexperienced user will be easily able to report sufficient information wich a WARN and its stacktrace, even if the callsite's alloc check doesn't provide it in an obvious way? > +++ b/mm/slab_common.c > @@ -1119,6 +1119,8 @@ static void *__kmalloc_large_node(size_t size, gfp_t flags, int node) > void *ptr = NULL; > unsigned int order = get_order(size); > > + if (order > MAX_ORDER) > + return NULL; > if (unlikely(flags & GFP_SLAB_BUG_MASK)) > flags = kmalloc_fix_flags(flags); > > >