From nobody Mon Sep 28 12:33:47 2026 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F044735E1B8 for ; Fri, 21 Aug 2026 17:04:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787331858; cv=none; b=tih69iCoLbFuwwhQ3k68Ws/5ElQhG7xVqvCk4fNzTeBG8Xj1ioti7Ic0bS6V8cH1z32xWwIVCJ/qNH9AV24dETGz9lcXK34olSE2wGl8BndWcYNmk8VYYRhqyYUp6aQjlE01aymczYAOsQcwpeoOpohjaWiOmLK6ZEh+F/LJB2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787331858; c=relaxed/simple; bh=Y2LNCgayfl9tkEIjkTOpOURD8s++FfPBJRytir7Tc5A=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Ot7Ry1PjGFBZdsIDZj/R1/Ttj124V5dufPVQ+u+iD/e0lvJ20HRXU/EdG2qmHwfy+ZVVvNzd/dNKzqiZsHIWbIWzIMaCtev2GrX8RAImWCMhfLZlQfI6q1uBo05PzI10pH6hEpNGSTDJjD9nVwEo+01tTetXHl4+ZVWs3vSqvXM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KZJg9Z7A; arc=none smtp.client-ip=209.85.222.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KZJg9Z7A" Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-936aa34873bso105423785a.3 for ; Fri, 21 Aug 2026 10:04:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787331855; x=1787936655; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ytXCiIXJSEWeQd3fczjuZy6blW2T09URPllThg0U0lI=; b=KZJg9Z7A89GJ0SpxPSFIsCVY64juu6ojxM1mFR143+GfbZfXFZm2ik5gVaWeKlQewH awUO0Of0RmcFrm0jgZI2trYnb0mcm8MUscdSQqZHjUkNwjzGwGw/rLbRhQU2/LuORSYR sc5LuI0c0N6OhYh0GdJU7sTYokeg8GAWj7PyZuziaPbFJanhujeXSHoP/KjBITgdsFDn hQ2G8D/U27TobqQvEOgYnFD7CkmsAQQ8rH3M0cwHwHvR0MaSaoX6TnDmvE63K68nxZks K7tmzaCuoBAxwxPa5jjY1pJFXeF7G/F/sC6ysLktviEP0+KGyO9fMKgGPdLOJP0c43WD 0Uiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787331855; x=1787936655; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ytXCiIXJSEWeQd3fczjuZy6blW2T09URPllThg0U0lI=; b=Ek9ndx6hRrYapEB+z3dt8QdgvAtdBobnCpDWlOGd1fVge7nHCHDOg2JylTrgvydt+8 sys3bL2OWhnheZG9bKUD8Cm9FxvMsb+TL1CHJjMtdNo4EtWn2KId/sOuhNJvRZd0eXJt Dwl4ndL5Lpuj96/mNYi9e41ANky5GKmaHGp+f5mUSCA+T4eq91QVUcxWmy/S6cLLCCZj YBlihLqmA76p4AeViqGTNwpkt/s5U014qVk01mvBv0jy3z7g1LVhhz8yKyHENjCRSKXd fsJFvqAUSkYwRo6sTS8PsP+WkvKLHvSgF3nT7SQFO/7436fhcy7roibosKhYIOEckdwF KylA== X-Gm-Message-State: AOJu0YzgqdQGylX8SfDw6TVlgLlQccd/pVoXfpBIhFvgryHyra5XeD8/ zw1jHI+VaYD8Hqq45tpiGuer8ebcLZZ3pvCL0g9Z37jJIcPYaanVnHZAI5VPTB9QJNsHysPNdlb K4+F+uqi8cCf9kg== X-Received: from qklc14.prod.google.com ([2002:a05:620a:134e:b0:92e:6551:eed3]) (user=edumazet job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:31a8:b0:92e:e1d1:49dd with SMTP id af79cd13be357-9373957489amr644583685a.21.1787331854394; Fri, 21 Aug 2026 10:04:14 -0700 (PDT) Date: Fri, 21 Aug 2026 17:04:07 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.766.g2966f0265a-goog Message-ID: <20260821170407.3721004-1-edumazet@google.com> Subject: [PATCH] mm/mempolicy: Fix sleeping allocation in alloc_pages_bulk_weighted_interleave() From: Eric Dumazet To: Andrew Morton Cc: linux-kernel , Eric Dumazet , syzbot+0dbf6d295b3350944f0b@syzkaller.appspotmail.com, David Hildenbrand , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , linux-mm@kvack.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" syzbot reported a sleeping function called from invalid context splat in bucket_table_alloc(). When rhashtable_insert_slow() rehashes the table under rcu_read_lock(), it calls bucket_table_alloc(..., GFP_ATOMIC | __GFP_NOWARN). If the bucket table allocation uses vmalloc, __vmalloc_node_range_noprof() invokes vm_area_alloc_pages() -> alloc_pages_bulk_mempolicy_noprof() with the passed GFP_ATOMIC flags. If the current task has an MPOL_WEIGHTED_INTERLEAVE mempolicy, alloc_pages_bulk_weighted_interleave() is called and currently hardcodes GFP_KERNEL when allocating the temporary weights array, triggering a might_alloc() splat in atomic/RCU contexts. Pass the gfp flags (masked with GFP_RECLAIM_MASK to strip page-allocator zone modifiers like __GFP_HIGHMEM) received by alloc_pages_bulk_weighted_interleave() to kmalloc() instead of hardcoding GFP_KERNEL. Since the weights buffer is immediately initialized in full, kmalloc() is sufficient. Fixes: fa3bea4e1f82 ("mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for = weighted interleaving") Reported-by: syzbot+0dbf6d295b3350944f0b@syzkaller.appspotmail.com Closes: https://lore.kernel.org/lkml/6a88837e.ae6ddae5.3da009.0040.GAE@goog= le.com/T/#u Signed-off-by: Eric Dumazet Acked-by: David Hildenbrand (Arm) Reviewed-by: Gregory Price (Meta) --- Cc: David Hildenbrand Cc: Zi Yan Cc: Matthew Brost Cc: Joshua Hahn Cc: Rakie Kim Cc: Byungchul Park Cc: Gregory Price Cc: Ying Huang Cc: Alistair Popple Cc: linux-mm@kvack.org --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 501e0b80d7da..1ef50ca37d42 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2688,7 +2688,7 @@ static unsigned long alloc_pages_bulk_weighted_interl= eave(gfp_t gfp, prev_node =3D node; =20 /* create a local copy of node weights to operate on outside rcu */ - weights =3D kzalloc(nr_node_ids, GFP_KERNEL); + weights =3D kmalloc(nr_node_ids, gfp & GFP_RECLAIM_MASK); if (!weights) return total_allocated; =20 base-commit: 4e69c1856bfd9ffb7e9d335a25842fa211628929 --=20 2.55.0.766.g2966f0265a-goog