Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mukesh Ojha" <mukesh.ojha@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 02/26] init/version: Annotate static information into meminspect
Date: Wed, 08 Jul 2026 07:21:40 +0000	[thread overview]
Message-ID: <20260708072140.C5EFC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-meminspect-v3-v3-2-7aa5a0a74d5c@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] The linux_banner meminspect entry is duplicated in the .inspect_table section, leading to brittle size resolution based strictly on linker command-line order.

Pre-existing issues:
- [High] Adding static kernel symbols to the meminspect table triggers a kernel warning during boot because the framework incorrectly uses virt_to_phys() on non-linear addresses.
--

--- Patch [2]: [PATCH v3 02/26] init/version: Annotate static information into meminspect ---
commit fe87675e956aedb4b693667a58386a5bc91ca7cd
Author: Eugen Hristev <ehristev@kernel.org>

init/version: Annotate static information into meminspect

Annotate vital static information into inspection table:
 - init_uts_ns
 - linux_banner

Information on these variables is stored in a dedicated meminspect
section.

> diff --git a/init/version-timestamp.c b/init/version-timestamp.c
> index 375726e05f690..37bdcdd443f9b 100644
> --- a/init/version-timestamp.c
> +++ b/init/version-timestamp.c

[ ... ]

> @@ -24,3 +25,5 @@ struct uts_namespace init_uts_ns = {
>  const char linux_banner[] =
>  	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
> +
> +MEMINSPECT_SIMPLE_ENTRY(linux_banner);

[Severity: Medium]
Does this result in duplicate entries for linux_banner in the inspect_table
section?

Because init/version-timestamp.c is compiled independently as a standalone
object and also included directly by init/version.c, this macro expands twice
during the build.

This generates two entries: one with a dummy size from the early compile
phase where UTS_VERSION is a stub, and one with the actual size. While
scripts/link-vmlinux.sh currently appends version-timestamp.o last to ensure
the real size overwrites the dummy size during initialization, this approach
relies strictly on linker command-line order.

Could this break under Link Time Optimization or section sorting optimizations,
causing the dummy size to be used and truncating the banner in the inspection
tool?

> diff --git a/init/version.c b/init/version.c
> index 94c96f6fbfe6a..eeb1392365627 100644
> --- a/init/version.c
> +++ b/init/version.c

[ ... ]

> @@ -51,4 +52,6 @@ const char linux_banner[] __weak;
>  
>  #include "version-timestamp.c"
>  
> +MEMINSPECT_SIMPLE_ENTRY(init_uts_ns);

[Severity: High]
This isn't a bug introduced by this patch, but adding static kernel symbols
here triggers a kernel warning during boot because the meminspect framework
incorrectly uses virt_to_phys() on non-linear addresses.

When meminspect_prepare_table() iterates over the table unconditionally at boot:

kernel/meminspect/meminspect.c:meminspect_prepare_table()
    if (!inspect_entries[e->id].pa && inspect_entries[e->id].va)
        inspect_entries[e->id].pa = virt_to_phys(inspect_entries[e->id].va);

It passes the virtual addresses of static symbols like linux_banner and
init_uts_ns to virt_to_phys(). This records an invalid physical address in the
meminspect table, and on architectures where static kernel symbols reside in
non-linear virtual memory (like vmalloc space on arm64 or x86_64 with KASLR),
this triggers a kernel WARN.

Should the framework be updated to use __pa_symbol() for these entries instead
to safely handle non-linear kernel image addresses?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-meminspect-v3-v3-0-7aa5a0a74d5c@oss.qualcomm.com?part=2

  reply	other threads:[~2026-07-08  7:21 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  5:31 [PATCH v3 00/26] Introduce meminspect Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 01/26] kernel: " Mukesh Ojha
2026-07-08  7:21   ` sashiko-bot
2026-07-08  7:38   ` Lorenzo Stoakes
2026-07-08 13:33     ` Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 02/26] init/version: Annotate static information into meminspect Mukesh Ojha
2026-07-08  7:21   ` sashiko-bot [this message]
2026-07-08  5:31 ` [PATCH v3 03/26] mm/percpu: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 04/26] cpu: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 05/26] genirq/irqdesc: " Mukesh Ojha
2026-07-08  7:20   ` sashiko-bot
2026-07-08  7:46   ` Lorenzo Stoakes
2026-07-08  5:31 ` [PATCH v3 06/26] timers: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 07/26] timekeeping: Register tk_data " Mukesh Ojha
2026-07-08  7:18   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 08/26] kernel/fork: Annotate static information " Mukesh Ojha
2026-07-08  7:16   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 09/26] mm/page_alloc: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 10/26] mm/show_mem: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 11/26] mm/swapfile: " Mukesh Ojha
2026-07-08  7:47   ` Lorenzo Stoakes
2026-07-08 19:05     ` Mukesh Ojha
2026-07-09 14:53       ` Lorenzo Stoakes
2026-07-10  4:09         ` Christoph Hellwig
2026-07-08  5:31 ` [PATCH v3 12/26] kernel/vmcore_info: Register dynamic " Mukesh Ojha
2026-07-08  7:25   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 13/26] kernel/configs: " Mukesh Ojha
2026-07-08  7:20   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 14/26] mm/init-mm: Annotate static " Mukesh Ojha
2026-07-08  7:23   ` sashiko-bot
2026-07-08  7:52   ` Lorenzo Stoakes
2026-07-08  5:31 ` [PATCH v3 15/26] panic: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 16/26] kallsyms: " Mukesh Ojha
2026-07-08  7:23   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 17/26] mm/mm_init: " Mukesh Ojha
2026-07-08  5:31 ` [PATCH v3 18/26] sched/core: Annotate runqueues " Mukesh Ojha
2026-07-08  7:22   ` sashiko-bot
2026-07-08  5:31 ` [PATCH v3 19/26] mm/numa: Register node data information " Mukesh Ojha
2026-07-08  7:29   ` sashiko-bot
2026-07-08  7:55   ` Lorenzo Stoakes
2026-07-08  5:31 ` [PATCH v3 20/26] mm/sparse: Register " Mukesh Ojha
2026-07-08  7:27   ` sashiko-bot
2026-07-08  5:32 ` [PATCH v3 21/26] printk: " Mukesh Ojha
2026-07-08  7:24   ` sashiko-bot
2026-07-08  7:59   ` Lorenzo Stoakes
2026-07-08 18:53     ` Mukesh Ojha
2026-07-09  8:16     ` Petr Mladek
2026-07-08  5:32 ` [PATCH v3 22/26] remoteproc: qcom: Move minidump data structures into its own header Mukesh Ojha
2026-07-08  7:23   ` sashiko-bot
2026-07-08  5:32 ` [PATCH v3 23/26] soc: qcom: Add minidump backend driver Mukesh Ojha
2026-07-08  7:26   ` sashiko-bot
2026-07-08  5:32 ` [PATCH v3 24/26] soc: qcom: smem: Add minidump platform device Mukesh Ojha
2026-07-08  5:32 ` [PATCH v3 25/26] dt-bindings: reserved-memory: Add Google Kinfo Pixel reserved memory Mukesh Ojha
2026-07-08  7:08 ` [PATCH v3 26/26] meminspect: Add debug kinfo compatible driver Mukesh Ojha
2026-07-08  7:37   ` sashiko-bot
2026-07-08  8:06   ` Lorenzo Stoakes
2026-07-08 18:46     ` Mukesh Ojha
2026-07-09 13:24   ` Petr Pavlu
2026-07-08  7:11 ` [PATCH v3 00/26] Introduce meminspect Lorenzo Stoakes
2026-07-08  8:18   ` Lorenzo Stoakes
2026-07-09 20:42     ` Mukesh Ojha
2026-07-10  1:51 ` Liam R. Howlett

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=20260708072140.C5EFC1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --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