From nobody Tue Dec 2 01:06:34 2025 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (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 F4207286D7C for ; Sat, 22 Nov 2025 18:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763836242; cv=none; b=SjjHBMEYkIhF5yzu+Gm8widYlrw5gg+wnXXLehmAi8y7n71KvonXn6DoJhktCa0/y8pBP/ZwIlHVJX82680qNcySInylzUGT8/SQfuu5FWYp1ys/Vj8pYlLSVdgkqPpTJVu+6MAEfmFB2yFUJ1/sSCFWbQgY2hIJe2781jMIrhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763836242; c=relaxed/simple; bh=Y14P+hFNESwD23S6U25+Fipm0JjJcyJugUmiqNQvBqg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=C67SMiTtV8jw1q+uA1US9m9QSNoUi6ZcBEs7Ytb0OXi9M35nPK/5Fq8hBbTGv5sSFX/6SpkIbR6FsGjWrH9p7rC9sbNByEWxxW/sC9zm4Q+OLQuLAhcqCiE60sIt4o5c9Vw4kURaR/1hWz1r8GP2Im/ICuGrVKDF3Jf3/GHKld4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=mn4CZRL2; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="mn4CZRL2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=lz i5XhSukkOja/rLxys4R+45N3tXtMtHv0ZgIb+J524=; b=mn4CZRL25YqENFPbeC zzmszo5bXyD5ImU4Twxaw4QauOcVVtpknuhgWv8997zhNpt/tfjWP/7+xAnSvtqJ FDodX9LF3oDGZd9wX8ALhdH/y6xPKiv7j3t/4fMom2tK6E3hwqWOArtOIbLzqpUD //96jurS2czrCIjSCqei8tM90= Received: from ubuntu24-z.. (unknown []) by gzga-smtp-mtada-g1-2 (Coremail) with SMTP id _____wDHm2QMASJpWaXTCA--.28911S2; Sun, 23 Nov 2025 02:29:32 +0800 (CST) From: ranxiaokai627@163.com To: rppt@kernel.org, akpm@linux-foundation.org, catalin.marinas@arm.com, changyuanl@google.com, graf@amazon.com, pasha.tatashin@soleen.com, pratyush@kernel.org Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ran.xiaokai@zte.com.cn, ranxiaokai627@163.com Subject: [PATCH v2] KHO: Fix boot failure due to kmemleak access to non-PRESENT pages Date: Sat, 22 Nov 2025 18:29:29 +0000 Message-ID: <20251122182929.92634-1-ranxiaokai627@163.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wDHm2QMASJpWaXTCA--.28911S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr48CF43Jw4kJrWxtw1rCrg_yoW8Aw1fpF yvkF1jk3yUt3ZrXFnFv3Wv9rySqws8Cw43Ja4jvry3Zr9xJ3Z3twsYyryIvF1UWFZYgF43 ZFWYq3yrur48XFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pin2-UUUUUU= X-CM-SenderInfo: xudq5x5drntxqwsxqiywtou0bp/xtbBEBoOTGkh99DNGAAAsy Content-Type: text/plain; charset="utf-8" From: Ran Xiaokai When booting with debug_pagealloc=3Don while having: CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT=3Dy CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=3Dn 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. Commit 3dc92c311498 ("kexec: add Kexec HandOver (KHO) generation helpers") triggers this when releases the KHO scratch region calling init_cma_reserved_pageblock(). Subsequent kmemleak scanning accesses these non-PRESENT pages, leading to fatal page faults. Call kmemleak_ignore_phys() from kho_init() to exclude the reserved region from kmemleak scanning before it is released to the buddy allocator to fix this. Signed-off-by: Ran Xiaokai Reviewed-by: Mike Rapoport (Microsoft) --- kernel/liveupdate/kexec_handover.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index 224bdf5becb6..c729d455ee7b 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -11,6 +11,7 @@ =20 #include #include +#include #include #include #include @@ -1369,6 +1370,7 @@ static __init int kho_init(void) unsigned long count =3D kho_scratch[i].size >> PAGE_SHIFT; unsigned long pfn; =20 + kmemleak_ignore_phys(kho_scratch[i].addr); for (pfn =3D base_pfn; pfn < base_pfn + count; pfn +=3D pageblock_nr_pages) init_cma_reserved_pageblock(pfn_to_page(pfn)); --=20 2.25.1