Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp143316rwb; Mon, 26 Sep 2022 10:18:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6w4PHFv9KGYmxGrTs+W7503U+oV2LMf+ukk4E43wGWFvi4r023IPhGitlMsEhNMjscZfEk X-Received: by 2002:a17:907:2e0b:b0:77f:5fd8:8712 with SMTP id ig11-20020a1709072e0b00b0077f5fd88712mr18231105ejc.575.1664212737166; Mon, 26 Sep 2022 10:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664212737; cv=none; d=google.com; s=arc-20160816; b=xPe8vQCohz05SKwRFgQKNYZOyhxD+51s07oLGCgFGWvcU275oxn1SeP996kbRYKqQx Gys190CU//TnNwGHq0vK8Mf25lKDzFCsH/hC6MBVpQMyOyHWvDl+Ku8nUpBVE9USx6Lz cVs1Yp35xQz16JXQYwhE8KnWXsmRJllM+9Kax2voMOooq7NNHyfIG41WSbxO2YySCZ+M hIW6PSbuSetTHd8zgVzbSBamdQt7zxssu+AJzv4Ckt9ygRYxU+FmHDb3uW9LoWjZPO+7 MXZmq4KS5X9UJoK4Mv7hTgVrezvP5pBpK2ETJhXyAxnsgmYeb9VXTKmQGiA0sVR6074Q a3Xw== 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=/QQNa5fjWpYSTINNZ8fkhajG7/HHXIdA5rA4AKSfwoc=; b=1CR5+FR1DmBj4Vgfc9F8ANIiVNCSUaAVNAqo0Y7r/Dbbj5Y84drin+J4w1iPjK272h HNMfDYjvwnp51TRMppCptj0sA1jbE18gQMWlZI2SEqoaLU9PY+5v+AJy926MkBjk5//B o8ubVE9I9uJp7jrOsBmcxzpqFkl5NhLEgi1gXVnx+Enm2pSrzF+i4bD46TsZYRTf8XD4 T3oO5LU5pOjVhZJw9w0F2zXdNIfeUhFwL8TezdowLBszNbfF/ChdkQAaPrUzRppS5grZ Buni3LbscgPnJHPa7gwbpwpHwg6zRH+fWwi2lrBsX/v7Ij7lOCLaHUf3T7SotcdVQNqZ GgQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=XHZoyzEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a50aac7000000b0044611122003si16377789edc.599.2022.09.26.10.18.32; Mon, 26 Sep 2022 10:18:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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.com header.s=susede1 header.b=XHZoyzEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbiIZQhI (ORCPT + 99 others); Mon, 26 Sep 2022 12:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229626AbiIZQgi (ORCPT ); Mon, 26 Sep 2022 12:36:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201446D56B for ; Mon, 26 Sep 2022 08:24:40 -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 5EE2B21EF4; Mon, 26 Sep 2022 15:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1664205816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/QQNa5fjWpYSTINNZ8fkhajG7/HHXIdA5rA4AKSfwoc=; b=XHZoyzENCRIiGgTd/+ssg8u8SLzggAtIrjmeJmHRRhZnuW7nbag5ljev7ZALJKePOpt4JG ctbdLsvrk28VOBey7XZsYNI0eVyWmzlSah7hDNULEh6tffIGgLrdBkFJ1P7F6Ukol5flUB xECfGvDcjnLEnuVoYDbU/VbHMq4bjts= 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 4348C13486; Mon, 26 Sep 2022 15:23:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id m0CZDfjDMWPaIgAAMHmgww (envelope-from ); Mon, 26 Sep 2022 15:23:36 +0000 Date: Mon, 26 Sep 2022 17:23:35 +0200 From: Michal Hocko To: Florian Westphal Cc: linux-mm@kvack.org, akpm@linux-foundation.org, vbabka@suse.cz, urezki@gmail.com, linux-kernel@vger.kernel.org, Martin Zaharinov Subject: Re: [PATCH v2 mm] mm: fix BUG splat with kvmalloc + GFP_ATOMIC Message-ID: References: <20220926151650.15293-1-fw@strlen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220926151650.15293-1-fw@strlen.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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-kernel@vger.kernel.org On Mon 26-09-22 17:16:50, Florian Westphal wrote: > Martin Zaharinov reports BUG with 5.19.10 kernel: > kernel BUG at mm/vmalloc.c:2437! > invalid opcode: 0000 [#1] SMP > CPU: 28 PID: 0 Comm: swapper/28 Tainted: G W O 5.19.9 #1 > [..] > RIP: 0010:__get_vm_area_node+0x120/0x130 > __vmalloc_node_range+0x96/0x1e0 > kvmalloc_node+0x92/0xb0 > bucket_table_alloc.isra.0+0x47/0x140 > rhashtable_try_insert+0x3a4/0x440 > rhashtable_insert_slow+0x1b/0x30 > [..] > > bucket_table_alloc uses kvzalloc(GPF_ATOMIC). If kmalloc fails, this now > falls through to vmalloc and hits code paths that assume GFP_KERNEL. > > Reported-by: Martin Zaharinov > Fixes: a421ef303008 ("mm: allow !GFP_KERNEL allocations for kvmalloc") > Suggested-by: Michal Hocko > Link: https://lore.kernel.org/linux-mm/Yy3MS2uhSgjF47dy@pc636/T/#t > Signed-off-by: Florian Westphal Maybe we can extend this to GFP_NOWAIT capable vmalloc call but I am not sure this exists or whether this is something vmalloc maintainers want to commit to. This is a clear and trivial fixup of the above commit. I would add this to the stable tree as well. Acked-by: Michal Hocko Thanks! > --- > mm/util.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/util.c b/mm/util.c > index c9439c66d8cf..346e40177bc6 100644 > --- a/mm/util.c > +++ b/mm/util.c > @@ -619,6 +619,10 @@ void *kvmalloc_node(size_t size, gfp_t flags, int node) > if (ret || size <= PAGE_SIZE) > return ret; > > + /* non-sleeping allocations are not supported by vmalloc */ > + if (!gfpflags_allow_blocking(flags)) > + return NULL; > + > /* Don't even allow crazy sizes */ > if (unlikely(size > INT_MAX)) { > WARN_ON_ONCE(!(flags & __GFP_NOWARN)); > -- > 2.35.1 -- Michal Hocko SUSE Labs