public inbox for linux-modules@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Petr Mladek <pmladek@suse.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>, David Gow <davidgow@google.com>,
	Kees Cook <kees@kernel.org>, Greg KH <gregkh@linuxfoundation.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Helge Deller <deller@gmx.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Juergen Gross <jgross@suse.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Petr Pavlu <petr.pavlu@suse.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-modules@vger.kernel.org, bpf@vger.kernel.org,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 0/2] kallsyms: show typed function parameters in oops/WARN dumps
Date: Mon, 23 Mar 2026 12:48:55 -0400	[thread overview]
Message-ID: <20260323164858.1939248-1-sashal@kernel.org> (raw)

Building on the lineinfo series, this adds typed function parameter
display to oops and WARN dumps.  A build-time tool extracts parameter
names and types from DWARF, and the kernel maps pt_regs to the calling
convention at crash time.  When BTF is available, struct pointer
parameters are dereferenced and their members displayed.

Example output from a WARN in a function receiving struct new_utsname *
(kernel version info) and struct file * parameters:

 ------------[ cut here ]------------
 WARNING: drivers/tty/sysrq.c:1209 at demo_crash+0xf/0x20 (drivers/tty/sysrq.c:1209)
 CPU: 2 UID: 0 PID: 323 Comm: bash
 RIP: 0010:demo_crash+0xf/0x20 (drivers/tty/sysrq.c:1209)
 ...
 RDI: ffffffffb8ca8d00
 RSI: ffffa0a3c250acc0
 ...
 Function parameters (paraminfo_demo_crash):
  uts      (struct new_utsname *) = 0xffffffffb8ca8d00
   .sysname = "Linux"                        .nodename = "localhost"
   .release = "7.0.0-rc2-00006-g3190..."     .version = "#45 SMP PRE"
  file     (struct file *       ) = 0xffffa0a3c250acc0
   .f_mode = (fmode_t)67993630               .f_op = (struct file_operations *)0xffffffffb7237620
   .f_flags = (unsigned int)32769            .f_cred = (struct cred *)0xffffa0a3c2e06a80
   .dentry = (struct dentry *)0xffffa0a3c0978cc0
   .prev_pos = (loff_t)-1
 Call Trace:
  <TASK>
  write_sysrq_trigger+0x96/0xb0 (drivers/tty/sysrq.c:1222)
  proc_reg_write+0x54/0xa0 (fs/proc/inode.c:330)
  vfs_write+0xc9/0x480 (fs/read_write.c:686)
  ksys_write+0x6e/0xe0 (fs/read_write.c:738)
  do_syscall_64+0xe2/0x570 (arch/x86/entry/syscall_64.c:62)
  entry_SYSCALL_64_after_hwframe+0x77/0x7f (arch/x86/entry/entry_64.S:121)

Patch 1 adds the core paraminfo infrastructure (DWARF extraction,
kernel-side lookup, register-to-parameter mapping, ~1-2 MB overhead).
Patch 2 adds optional BTF-based struct rendering, gated behind
CONFIG_KALLSYMS_PARAMINFO_BTF.

Sasha Levin (2):
  kallsyms: show function parameter info in oops/WARN dumps
  kallsyms: add BTF-based deep parameter rendering in oops dumps

 .../admin-guide/kallsyms-lineinfo.rst         |  31 +
 arch/x86/kernel/dumpstack.c                   |   6 +-
 include/linux/kallsyms.h                      |   9 +
 init/Kconfig                                  |  40 ++
 kernel/Makefile                               |   1 +
 kernel/kallsyms.c                             | 182 ++++++
 kernel/kallsyms_internal.h                    |   6 +
 kernel/kallsyms_paraminfo_btf.c               | 199 ++++++
 lib/Kconfig.debug                             |  11 +
 lib/tests/Makefile                            |   3 +
 lib/tests/paraminfo_kunit.c                   | 249 ++++++++
 scripts/Makefile                              |   3 +
 scripts/empty_paraminfo.S                     |  18 +
 scripts/gen_paraminfo.c                       | 597 ++++++++++++++++++
 scripts/link-vmlinux.sh                       |  44 +-
 15 files changed, 1393 insertions(+), 6 deletions(-)
 create mode 100644 kernel/kallsyms_paraminfo_btf.c
 create mode 100644 lib/tests/paraminfo_kunit.c
 create mode 100644 scripts/empty_paraminfo.S
 create mode 100644 scripts/gen_paraminfo.c

--
2.51.0


             reply	other threads:[~2026-03-23 16:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 16:48 Sasha Levin [this message]
2026-03-23 16:48 ` [PATCH 1/2] kallsyms: show function parameter info in oops/WARN dumps Sasha Levin
2026-03-24 15:03   ` Alexei Starovoitov
2026-03-24 16:00     ` Sasha Levin
2026-03-24 16:04       ` Alexei Starovoitov
2026-03-24 18:44         ` Sasha Levin
2026-03-25  1:18           ` [RFC] btf: split core BTF parsing out of BPF subsystem into kernel/btf/ Sasha Levin
2026-03-25  2:15             ` bot+bpf-ci
2026-03-24 17:34       ` [PATCH 1/2] kallsyms: show function parameter info in oops/WARN dumps Alan Maguire
2026-03-24 18:51         ` Sasha Levin
2026-03-23 16:48 ` [PATCH 2/2] kallsyms: add BTF-based deep parameter rendering in oops dumps Sasha Levin
2026-03-24 15:07   ` Alexei Starovoitov
2026-03-23 18:43 ` [PATCH 0/2] kallsyms: show typed function parameters in oops/WARN dumps Alexey Dobriyan
2026-03-23 22:58   ` Sasha Levin
2026-03-23 22:50 ` Andrew Morton
2026-03-23 23:08   ` Sasha Levin
2026-03-24  8:57 ` Jiri Olsa
2026-03-24 11:39   ` Sasha Levin

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=20260323164858.1939248-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=davidgow@google.com \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=kees@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=peterz@infradead.org \
    --cc=petr.pavlu@suse.com \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=x86@kernel.org \
    /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