From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 52EAB254AE1 for ; Thu, 27 Nov 2025 16:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764260418; cv=none; b=QMz7vWWCDO0po5el0ltQ0hmyZ6w7XHnpEiObD7opjEpqrCT1FMxqrg323CXCKjqxQIvdxSroekvcjHNDUevGZReM9UPbYxXhmm9jCukB1tmIwrIXDKwIXWFGrlyi4DvtbHGQP8XSbUB8tAtxZ5fw+nWQ6vHCXWX09fuIUd+fxog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764260418; c=relaxed/simple; bh=avZf9Vu6ylIFB1LxLASnCOKBE9sB2MGp7u47/NpKjkk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=SvGELw6JIhkAzZZrk0TeqZcWl/kdYuMDjlmT4reDWjpqzRLlNGzWWK1zGSOpiApUS9Uty29S7cqeU6XRGrTce6fi95Q81vhbU7+IUReQnYbxSAT8lrG1/ZQm5h1qt0SYMGYFC83vQlCf1bu0ns3XzcBeV0cM5R1Am0wJss0xoDE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=enT7i+QG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="enT7i+QG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 240AFC4CEF8; Thu, 27 Nov 2025 16:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764260417; bh=avZf9Vu6ylIFB1LxLASnCOKBE9sB2MGp7u47/NpKjkk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=enT7i+QGeF5nMmfGvskWHyOmourYf9rryiYO17BNruJNNuOE3iYx0zIYavhZ3/6o8 0LeogTw+IqzuEAPVdEnA0B0qsUL6U3wSLD6fXyZCATBp73Z8UbUquCNIHwtlu0S8i1 ovyrsz2rMipXJIp3sP1/Ezn9ku7QE6ujpTyCbf5/o1yk/FkgNgEGa2NabB7ypXIMro /5+hOa5C2wFoefcDYmrW1oFyAPJ2HSCWxMyDLVKhy3S4x5G6I9wHGUcOt4y0KlDs5N uN3JYWaveYxh0o+R0dceTbU3iVHXvXP6oMVbvOyn4hVqnB37G8EzogSO5I8YFXZhPH 6KsRQiXRcv52g== From: Pratyush Yadav To: ranxiaokai627@163.com Cc: rppt@kernel.org, akpm@linux-foundation.org, catalin.marinas@arm.com, changyuanl@google.com, graf@amazon.com, pasha.tatashin@soleen.com, pratyush@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ran.xiaokai@zte.com.cn Subject: Re: [PATCH v4] KHO: Fix boot failure due to kmemleak access to non-PRESENT pages In-Reply-To: <20251127122700.103927-1-ranxiaokai627@163.com> (ranxiaokai's message of "Thu, 27 Nov 2025 12:27:00 +0000") References: <20251127122700.103927-1-ranxiaokai627@163.com> Date: Thu, 27 Nov 2025 17:20:14 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Nov 27 2025, ranxiaokai627@163.com wrote: > From: Ran Xiaokai > > When booting with debug_pagealloc=on while having: > CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=y > CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=n > the system fails to boot due to page faults during kmemleak scanning. > > This occurs because: > With debug_pagealloc is enabled, __free_pages() invokes > debug_pagealloc_unmap_pages(), clearing the _PAGE_PRESENT bit for > freed pages in the kernel page table. > KHO scratch areas are allocated from memblock and noted by kmemleak. But > these areas don't remain reserved but released later to the page allocator > using init_cma_reserved_pageblock(). This causes subsequent kmemleak scans > access non-PRESENT pages, leading to fatal page faults. > > Mark scratch areas with kmemleak_ignore_phys() after they are allocated > from memblock to exclude them from kmemleak scanning before they are > released to buddy allocator to fix this. > > Fixes: 3dc92c311498 ("kexec: add Kexec HandOver (KHO) generation helpers") > Signed-off-by: Ran Xiaokai > Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Pratyush Yadav Thanks! [...] -- Regards, Pratyush Yadav