From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 100881C84A0 for ; Fri, 20 Mar 2026 03:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773976810; cv=none; b=TnqkvcVa9jRpVOEK6p4JImqRsC8c4adli1pt4M2VQhZT1JP3KFkza5s1hAkKZbBa5OpvGB1JcI+7n+0A48gF9niM/PIde4UrUUYVmt6hW+yYU0r+aSezeJ08l0P52bXfTnTH871fSw5EPpFfiWQijgpZ2FwOUYbu8+/i944HLOM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773976810; c=relaxed/simple; bh=w1tMzD/XRb+YrrA1NM0jO7YEy3lho5Nni7XsteZHJW4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=utJNfqiAXIZsxC4T7ejBDB+VkA5CUq7ZCl51r41VEImLO7QrnAYJBaOWVHFKkjgCkvX2A5OFrtKBDfoZeYtwowhb5wwJtwRtWMq0Z65YCs/ktYlXPh6Zkx5bzMV03cu32SSyUNPx1Or6C8RlGwKnL7Zb0fpRQ7zWHmX7MhbV67k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=S45tCuiH; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="S45tCuiH" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1773976806; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=6kvcdOy8PHd748Znf9GoXMatn6ilXfT0VuUn/Hau19o=; b=S45tCuiHUZGyJy5IYjoaHrwmqv/HMGEwI+xzBgwZKVjYmzZzRPKe1K7lR6oEN7MIg/EDT+sDkMNjfpt3yhI+piKB0iB6n7EeMEcqC7VpDZvNcdXsWWBnbBao6XlRupGPBVLlKBxJe2MeFskGRjQQOTJVbg7Wpsrv6XMfLNi+tU8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0X.K7mdY_1773976803; Received: from 30.74.144.136(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X.K7mdY_1773976803 cluster:ay36) by smtp.aliyun-inc.com; Fri, 20 Mar 2026 11:20:04 +0800 Message-ID: <87a5618e-3ae8-43f7-b0a2-3c1e808277df@linux.alibaba.com> Date: Fri, 20 Mar 2026 11:20:03 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/9] mm/huge_memory: handle buggy PMD entry in zap_huge_pmd() To: "Lorenzo Stoakes (Oracle)" , Andrew Morton Cc: David Hildenbrand , Zi Yan , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <1ec18767b106a1ee1ed6e33e332c3ad5531dc636.1773924928.git.ljs@kernel.org> From: Baolin Wang In-Reply-To: <1ec18767b106a1ee1ed6e33e332c3ad5531dc636.1773924928.git.ljs@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/19/26 9:00 PM, Lorenzo Stoakes (Oracle) wrote: > A recent bug I analysed [0] managed to, through a bug in the userfaultfd > implementation, reach an invalid point in the zap_huge_pmd() code where the > PMD was none of: > > - A non-DAX, PFN or mixed map. > - The huge zero folio > - A present PMD entry > - A softleaf entry > > The code at this point calls folio_test_anon() on a known-NULL > folio. Having logic like this explicitly NULL dereference in the code is > hard to understand, and makes debugging potentially more difficult. > > Add an else branch to handle this case and WARN(). > > [0]:https://lore.kernel.org/all/6b3d7ad7-49e1-407a-903d-3103704160d8@lucifer.local/ > > Signed-off-by: Lorenzo Stoakes (Oracle) LGTM. Reviewed-by: Baolin Wang