mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mike Rapoport" <rppt@kernel.org>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Pasha Tatashin" <pasha.tatashin@soleen.com>,
	"Yangyang Lian" <lianyangyang@kylinos.cn>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Baoquan He" <baoquan.he@linux.dev>
Cc: "Haoran Jiang" <jianghaoran@kylinos.cn>,
	loongarch@lists.linux.dev, "WANG Xuerui" <kernel@xen0n.name>,
	"George Guo" <guodongtai@kylinos.cn>,
	"Dave Young" <ruirui.yang@linux.dev>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LoongArch: kdump: add arch_crash_save_vmcoreinfo() support
Date: Wed, 23 Sep 2026 06:16:35 +0000	[thread overview]
Message-ID: <20260923061635.8E3AF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923060349.146780-1-lianyangyang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kdump: off-by-one in VMEMMAP_END export causes incorrect range in tools
--

commit 39488158a1b2af61bc47f6be1cf24b8ef1c6d7cd
Author: Yangyang Lian <lianyangyang@kylinos.cn>

LoongArch: kdump: add arch_crash_save_vmcoreinfo() support
    
This commit implements arch_crash_save_vmcoreinfo() for LoongArch to export
architecture-specific values to the vmcoreinfo PT_NOTE. This allows userspace
crash analysis tools to reliably derive module ranges, vmemmap ranges, VA_BITS,
and the KASLR offset.

> diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmcoreinfo.rst
> index 404a15f6782c3..a714ce4cf2141 100644
> --- a/Documentation/admin-guide/kdump/vmcoreinfo.rst
> +++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst

[ ... ]

> +MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END
> +-----------------------------------------------------------------------------
> +
> +Used to get the correct ranges:
> +	MODULES_VADDR ~ MODULES_END-1 : Kernel module space.
> +	VMALLOC_START ~ VMALLOC_END-1 : vmalloc() / ioremap() space.
> +	VMEMMAP_START ~ VMEMMAP_END-1 : vmemmap region, used for struct page array.

[ ... ]

> diff --git a/arch/loongarch/kernel/vmcore_info.c b/arch/loongarch/kernel/vmcore_info.c
> new file mode 100644
> index 0000000000000..1128f6cdfe0dd
> --- /dev/null
> +++ b/arch/loongarch/kernel/vmcore_info.c

[ ... ]

> +void arch_crash_save_vmcoreinfo(void)
> +{
> +	VMCOREINFO_NUMBER(VA_BITS);
> +	/* NUMBER(VMALLOC_START) is exported by the generic code */
> +	vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
> +#ifdef CONFIG_64BIT
> +	vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
> +	vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
> +	vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", (unsigned long)vmemmap);
> +	vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);

[Severity: Medium]
Is this exporting the correct boundary for VMEMMAP_END?

As documented in the newly added admin-guide for vmcoreinfo (above), tools
like crash or makedumpfile expect the exported VMEMMAP_END to act as an
exclusive bound (VMEMMAP_START ~ VMEMMAP_END-1).

However, on LoongArch, the VMEMMAP_END macro is defined as an inclusive bound.
Exporting it directly without adjusting it to an exclusive bound
(e.g., VMEMMAP_END + 1) means the exported value is off by one byte. 

Could this cause tools calculating the size via VMEMMAP_END - VMEMMAP_START
to get VMEMMAP_SIZE - 1, thereby truncating the last page when shifted and
triggering errors when analyzing the vmcore?

> +#endif
> +	vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%lx\n", PHYS_OFFSET);
> +	vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923060349.146780-1-lianyangyang@kylinos.cn?part=1

      reply	other threads:[~2026-09-23  6:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  6:03 Yangyang Lian
2026-09-23  6:16 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923061635.8E3AF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=chenhuacai@kernel.org \
    --cc=guodongtai@kylinos.cn \
    --cc=jianghaoran@kylinos.cn \
    --cc=kernel@xen0n.name \
    --cc=kexec@lists.infradead.org \
    --cc=lianyangyang@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=ruirui.yang@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®