From mboxrd@z Thu Jan 1 00:00:00 1970 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 4528E2222B7 for ; Thu, 20 Nov 2025 14:43:23 +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=1763649806; cv=none; b=FagGqJQZ62Z5dZKwm7sDrsECoqbrXrvlTS8N8GsWmfYA/FIV3YAw1BJe4BwCSvYlFM/djcaMWC4qMZTOX3w3X9XxSi3PwLNHhaGkJhbeIbpgex0oGAvGdVtV3x6MfBpb5+pjZKqPu94U+asT4CuyQdVVhborQjs8wRxVlPjwjA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763649806; c=relaxed/simple; bh=EeYinPIyQlvBuBq4fEOtxpHwxY3MrWaXTaV2jQ2w2tg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IAclI9vsoeqm3G8imMHLcNDVhhIFpKuuEQ3s+Ok+jkV4dFLmLiSoozL+H3kuHgDQL9Wy1F7sN7tbaOnZA7o0xVB0/Bsa7nYUpVCKdfEH1Gw92i+ZWHY89FwRKqAUvsGvsEgbq+LRKHQbqzzstxSDlCbhsfHxGWMzPLuu2ajfN7Y= 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=TbRkCcmS; 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="TbRkCcmS" 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=Vz Gv03IYbkXuhrbno5kD8tYczSIVbSX/Gu02hzXe/jo=; b=TbRkCcmSf4nblu/8gP A+0RSQtSnda2MSlbfIJ3KV8GTzmlSCTkSNmRxtB2/7BUSupFgEIWHcOxBbBypd9q VIyaGSxakci3yrFW68ev6/b7x4j15RepqGAw17oVexLk8UUll6ahvX1Bx/3mvD4m /nb+WzcHfYRzFQtqZk2oDrft8= Received: from ubuntu24-z.. (unknown []) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wA3yJmuKB9pTEQrBQ--.727S2; Thu, 20 Nov 2025 22:41:51 +0800 (CST) From: ranxiaokai627@163.com To: catalin.marinas@arm.com, akpm@linux-foundation.org, graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, changyuanl@google.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kexec@lists.infradead.org, ran.xiaokai@zte.com.cn, ranxiaokai627@163.com Subject: [PATCH 0/2] liveupdate: Fix boot failure due to kmemleak access to unmapped pages Date: Thu, 20 Nov 2025 14:41:45 +0000 Message-ID: <20251120144147.90508-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: 8bit X-CM-TRANSID:_____wA3yJmuKB9pTEQrBQ--.727S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Kr48CF43Jw4kJF4fJw1UWrg_yoW8Zr1xpr yDCr4jkrsrJa4Y9Fsavay0kryIyws3KFWUAFy7Xw15Z3s8WrWIyws5A34YyFyUGw48Gr4f XF4UKay7ur1jqaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pin2-UUUUUU= X-CM-SenderInfo: xudq5x5drntxqwsxqiywtou0bp/xtbBEAkMTGkfJUZRaAAAs1 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. Crash logs: BUG: unable to handle page fault for address: ffff8880cd400000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 11de00067 P4D 11de00067 PUD 11af2b067 PMD 11aec1067 PTE 800fffff32bff020 Oops: Oops: 0000 [#1] SMP DEBUG_PAGEALLOC RIP: 0010:scan_block+0x43/0xb0 Call Trace: scan_gray_list+0x2b5/0x2f0 kmemleak_scan+0x3b1/0xcf0 kmemleak_scan_thread+0x7d/0xc0 kthread+0x11c/0x240 ret_from_fork+0x2d3/0x370 ret_from_fork_asm+0x11/0x20 This occurs because: With debug_pagealloc enabled, __free_pages() invokes debug_pagealloc_unmap_pages(), clearing the _PAGE_PRESENT bit for freed pages in the direct mapping. Commit 3dc92c311498 ("kexec: add Kexec HandOver (KHO) generation helpers") releases the KHO scratch region via init_cma_reserved_pageblock(), unmapping its physical pages. Subsequent kmemleak scanning accesses these unmapped pages, triggering fatal page faults. This patch introduces kmemleak_no_scan_phys(phys_addr_t), a physical-address variant of kmemleak_no_scan(), which marks memblock regions as OBJECT_NO_SCAN. We invoke this from kho_reserve_scratch() to exclude the reserved region from scanning before it is released to the buddy allocator. This is based linux next-20251119. Ran Xiaokai (2): mm: kmemleak: introduce kmemleak_no_scan_phys() helper liveupdate: Fix boot failure due to kmemleak access to unmapped pages include/linux/kmemleak.h | 4 ++++ kernel/liveupdate/kexec_handover.c | 4 ++++ mm/kmemleak.c | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) -- 2.25.1