From nobody Thu Dec 18 23:28:42 2025 Received: from esa2.hc555-34.eu.iphmx.com (esa2.hc555-34.eu.iphmx.com [23.90.104.147]) (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 5E97A328B43 for ; Tue, 16 Dec 2025 13:28:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765891726; cv=none; b=qYdX5VQ927gVLYF0NSht7+cm/uE5PsLoSgRsDmDsXvPPqetj+Cc+0uz+zvctxMakwgVQ/tF+h73vZMtwSkey9d+Guef7SAj5aIod1jaiqKVW8Atky1tE8Ql/9QlcsFsdUaszw01+Iutc6Goc6ORgoru9b4vUS2OMhCjXYQL6sEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765891726; c=relaxed/simple; bh=+k+9060VbjZlu9Xk37ggzq9agHSaf6TFpI6uV0BnxcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r0bbPDZYqyDCnOXYYkFQcJBZyNRC6MNiwBrRcRrYX93FTWR5wXJU3SMgdizNSDVvt4QzfX2PSqeA/k5MR/ISOeP8swpBl9AzfpgtDOUY0dnysS51O2jPVD6B194yssazYc/3wKVXhs26NgWZt/whW+lXiEe5ur8nla24rCbKYR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=P2ruUXzn reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="P2ruUXzn" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1765891723; x=1797427723; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+k+9060VbjZlu9Xk37ggzq9agHSaf6TFpI6uV0BnxcM=; b=P2ruUXzndzpFKQ3IR6PGywXyaomoq26v4qvFbFr/qNRDs+gkQZ6jrzRr 6BGatEp3k5JZQrKGTn/YgtpmXTdAjSrVlASUGKoXfEf3zQ+qsERRsCJeo YWUQjPg1z0TBXwd7ks2XsEvC/AVDrXOneiOJXyKPQEQN2Shz2b68l9QVq 2v8SubDe9zoj4+Vhi2NHL/UjNNcokYOPcyqVNIsCf3gKYxnrPTw5Mxlj1 4FXanvWLLnKJTSktGLK1rhN5/QcRaaXrg0sA20epeCKckCfZngt11YvFu wmpuVGZOo46qjau97aZMDZ5Bj7XcgixAC4E66OpIcvjbfPYeV38Yy/Wak w==; X-CSE-ConnectionGUID: uQt6+sSCSkq7gwxlCbF4xw== X-CSE-MsgGUID: xEnpMosHQ5edwqpeFgsXRQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces01_data.me-corp.lan) ([146.255.191.134]) by esa2.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2025 15:28:36 +0200 X-CSE-ConnectionGUID: qDu5oNm+RT+I2zFZyqnFsA== X-CSE-MsgGUID: n5AbACJbStS91yR4szaKew== Received: from unknown (HELO epgd034.me-corp.lan) ([10.154.54.6]) by ces01_data.me-corp.lan with SMTP; 16 Dec 2025 15:29:45 +0200 Received: by epgd034.me-corp.lan (sSMTP sendmail emulation); Tue, 16 Dec 2025 15:28:34 +0200 From: Pnina Feder To: Andrew Morton , Baoquan He Cc: Vivek Goyal , Dave Young , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Pnina Feder Subject: [PATCH 1/2] kernel: vmcoreinfo: allocate vmcoreinfo_data based on VMCOREINFO_BYTES Date: Tue, 16 Dec 2025 15:28:00 +0200 Message-ID: <20251216132801.807260-2-pnina.feder@mobileye.com> In-Reply-To: <20251216132801.807260-1-pnina.feder@mobileye.com> References: <20251216132801.807260-1-pnina.feder@mobileye.com> 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 Content-Type: text/plain; charset="utf-8" VMCOREINFO_BYTES defines the size of vmcoreinfo data, but the current implementation assumes a single page allocation. Allocate vmcoreinfo_data using get_order(VMCOREINFO_BYTES) so that vmcoreinfo can safely grow beyond PAGE_SIZE. This avoids hidden assumptions and keeps vmcoreinfo size consistent across the kernel. Signed-off-by: Pnina Feder --- kernel/vmcore_info.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/vmcore_info.c b/kernel/vmcore_info.c index fe9bf8db1922..22b3205dd4dc 100644 --- a/kernel/vmcore_info.c +++ b/kernel/vmcore_info.c @@ -137,7 +137,9 @@ EXPORT_SYMBOL_GPL(hwerr_log_error_type); =20 static int __init crash_save_vmcoreinfo_init(void) { - vmcoreinfo_data =3D (unsigned char *)get_zeroed_page(GFP_KERNEL); + int order; + order =3D get_order(VMCOREINFO_BYTES); + vmcoreinfo_data =3D (unsigned char *)__get_free_pages(GFP_KERNEL | __GFP_= ZERO, order); if (!vmcoreinfo_data) { pr_warn("Memory allocation for vmcoreinfo_data failed\n"); return -ENOMEM; @@ -146,7 +148,7 @@ static int __init crash_save_vmcoreinfo_init(void) vmcoreinfo_note =3D alloc_pages_exact(VMCOREINFO_NOTE_SIZE, GFP_KERNEL | __GFP_ZERO); if (!vmcoreinfo_note) { - free_page((unsigned long)vmcoreinfo_data); + free_pages((unsigned long)vmcoreinfo_data, order); vmcoreinfo_data =3D NULL; pr_warn("Memory allocation for vmcoreinfo_note failed\n"); return -ENOMEM; --=20 2.43.0 From nobody Thu Dec 18 23:28:42 2025 Received: from esa1.hc555-34.eu.iphmx.com (esa1.hc555-34.eu.iphmx.com [23.90.104.144]) (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 6567B3491C7 for ; Tue, 16 Dec 2025 13:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.90.104.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765891726; cv=none; b=NDLv5XNrAJt0lpejMSBlfWRWu+2RbHdtxNy1o4ht8aNpyf3icfpOJyqN3LyOhl9IE0cTBvBBLs+xtnjwq0/FWaSQY+3EnWWJYUKb3yLA8gjGjKSdEFEjcZK9ozZNTBS8QXzPhhz7I2MJpd2EkDYtf4VD+zQppL0GKqL809jhfK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765891726; c=relaxed/simple; bh=37oVug3GO/FYqPPdADlSo+znYXlYx9qasQSWVCIyI2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cQvcADxMkGgBBoyLe6+6pkrRBtSFEuPVwHPLvZt4YiS42UVruQ9SxZTaK1jS+U/BpQCWERe1IBvgrCwnncJx3e3aX4+RU2f2vT6jXqqdW6O3DtwWb5qubn+vMF3YgfL6DCHax6e1PZGXhPsLaAkARzGGNPfC7rQ6RGmHyvGes4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com; spf=pass smtp.mailfrom=mobileye.com; dkim=fail (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b=KmMzRq0X reason="key not found in DNS"; arc=none smtp.client-ip=23.90.104.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mobileye.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mobileye.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mobileye.com header.i=@mobileye.com header.b="KmMzRq0X" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mobileye.com; i=@mobileye.com; q=dns/txt; s=MoEyIP; t=1765891722; x=1797427722; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=37oVug3GO/FYqPPdADlSo+znYXlYx9qasQSWVCIyI2I=; b=KmMzRq0X2tqjuPOLkzY4flBQMnrlxjIuENmVk6WWXLVgcxB39XU66XU6 o2SL7hPXdL7m3QqEyPkyN0qwSyXkJ/ehIXBo8lDuZ6XorlLl48DZods93 GrEosyf8A6ri7w9N1Gaw2unow0NlKxniXBSFDlr9N1D1Pgx40/pvUZ/P/ BXjW3K1LJyjGFA29gjaHWzyREb3ZZ71Czvt1MZK5FrmzDehSO8rR7uHt1 sWPCQQLrtPsBHpjljl+oFX7LyebiXWgUC28BqXdcLtvojEmkvA/qDJAQl CRa7HcG3n2mf27ezeLJImqlnKEBbqTF1rRii+RK0rts7PBNOv3Q6hVWWk Q==; X-CSE-ConnectionGUID: IFy+yD4sQn6Al5+N+rlUtA== X-CSE-MsgGUID: Iu6zx6ElRSi1aWr0eirtmQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from unknown (HELO ces02_data.me-corp.lan) ([146.255.191.134]) by esa1.hc555-34.eu.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2025 15:28:40 +0200 X-CSE-ConnectionGUID: bQ8p51OVQ16U5mOwjNrmLg== X-CSE-MsgGUID: YTsECUlBR7eWu6f4MATFbw== Received: from unknown (HELO epgd034.me-corp.lan) ([10.154.54.6]) by ces02_data.me-corp.lan with SMTP; 16 Dec 2025 15:29:53 +0200 Received: by epgd034.me-corp.lan (sSMTP sendmail emulation); Tue, 16 Dec 2025 15:28:39 +0200 From: Pnina Feder To: Andrew Morton , Baoquan He Cc: Vivek Goyal , Dave Young , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Pnina Feder Subject: [PATCH 2/2] kernel/crash: handle multi-page vmcoreinfo in crash kernel copy Date: Tue, 16 Dec 2025 15:28:01 +0200 Message-ID: <20251216132801.807260-3-pnina.feder@mobileye.com> In-Reply-To: <20251216132801.807260-1-pnina.feder@mobileye.com> References: <20251216132801.807260-1-pnina.feder@mobileye.com> 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 Content-Type: text/plain; charset="utf-8" kimage_crash_copy_vmcoreinfo() currently assumes vmcoreinfo fits in a single page. This breaks if VMCOREINFO_BYTES exceeds PAGE_SIZE. Allocate the required order of control pages and vmap all pages needed to safely copy vmcoreinfo into the crash kernel image. Signed-off-by: Pnina Feder --- kernel/crash_core.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 99dac1aa972a..3952b3e102e0 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -44,9 +44,15 @@ note_buf_t __percpu *crash_notes; =20 int kimage_crash_copy_vmcoreinfo(struct kimage *image) { - struct page *vmcoreinfo_page; + struct page *vmcoreinfo_base; + struct page *vmcoreinfo_pages[DIV_ROUND_UP(VMCOREINFO_BYTES, PAGE_SIZE)]; + unsigned int order, nr_pages; + int i; void *safecopy; =20 + nr_pages =3D DIV_ROUND_UP(VMCOREINFO_BYTES, PAGE_SIZE); + order =3D get_order(VMCOREINFO_BYTES); + if (!IS_ENABLED(CONFIG_CRASH_DUMP)) return 0; if (image->type !=3D KEXEC_TYPE_CRASH) @@ -61,12 +67,15 @@ int kimage_crash_copy_vmcoreinfo(struct kimage *image) * happens to generate vmcoreinfo note, hereby we rely on * vmap for this purpose. */ - vmcoreinfo_page =3D kimage_alloc_control_pages(image, 0); - if (!vmcoreinfo_page) { + vmcoreinfo_base =3D kimage_alloc_control_pages(image, order); + if (!vmcoreinfo_base) { pr_warn("Could not allocate vmcoreinfo buffer\n"); return -ENOMEM; } - safecopy =3D vmap(&vmcoreinfo_page, 1, VM_MAP, PAGE_KERNEL); + for (i =3D 0; i < nr_pages; i++) + vmcoreinfo_pages[i] =3D vmcoreinfo_base + i; + + safecopy =3D vmap(vmcoreinfo_pages, nr_pages, VM_MAP, PAGE_KERNEL); if (!safecopy) { pr_warn("Could not vmap vmcoreinfo buffer\n"); return -ENOMEM; --=20 2.43.0