Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Li Pengfei" <ljdlns1987@gmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v7 05/10] trace: make the stackmap capacity settable on the kernel command line
Date: Sat, 12 Sep 2026 08:58:40 +0000	[thread overview]
Message-ID: <20260912085841.48E7B1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260912083753.3426176-6-lipengfei28@xiaomi.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Booting with the parameter `ftrace_stackmap.bits` without providing a value causes a NULL pointer dereference, crashing the kernel during early boot.
--

commit 7bbdd67c3f0e40d0b1656f5e92da61a336e639f5
Author: Pengfei Li <lipengfei28@xiaomi.com>

trace: make the stackmap capacity settable on the kernel command line

This commit adds the ftrace_stackmap.bits kernel command line parameter to
allow sizing the stackmap capacity at boot. The value is clamped between
10 and 18 to bound the worst-case element pool allocations.

> diff --git a/kernel/trace/trace_stackmap.c b/kernel/trace/trace_stackmap.c
> index 439d3be9e3516..49ea403822ba3 100644
> --- a/kernel/trace/trace_stackmap.c
> +++ b/kernel/trace/trace_stackmap.c

[ ... ]

> +static int __init stackmap_bits_setup(char *str)
> +{
> +	unsigned long val;
> +
> +	if (kstrtoul(str, 0, &val))

[Severity: High]
What happens if the ftrace_stackmap.bits boot parameter is passed without an
equals sign and value?

During early boot, parse_args() uses next_arg() to parse the command line. If
the parameter is passed without a value (e.g., just ftrace_stackmap.bits),
next_arg() assigns a NULL pointer to the value string.

Does passing this NULL pointer directly to kstrtoul() cause an immediate NULL
pointer dereference and kernel panic, since kstrtoul() does not check for a
NULL pointer before dereferencing it?

> +		return -EINVAL;
> +	val = clamp_val(val, FTRACE_STACKMAP_BITS_MIN, FTRACE_STACKMAP_BITS_MAX);
> +	stackmap_map_bits = val;
> +	return 0;
> +}
> +early_param("ftrace_stackmap.bits", stackmap_bits_setup);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912083753.3426176-1-lipengfei28@xiaomi.com?part=5

  reply	other threads:[~2026-09-12  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  8:37 [RFC PATCH v7 00/10] trace: stack trace deduplication for ftrace ring buffer Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 01/10] trace: add lock-free stackmap for stack trace deduplication Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 02/10] trace: use the stackmap from the ftrace stack recording path Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 03/10] trace: add stackmap statistics interface Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 04/10] trace: add stackmap binary export Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 05/10] trace: make the stackmap capacity settable on the kernel command line Li Pengfei
2026-09-12  8:58   ` sashiko-bot [this message]
2026-09-12  8:37 ` [RFC PATCH v7 06/10] Documentation: tracing: document the ftrace stackmap Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 07/10] tools/tracing: add a parser for the stackmap binary export Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 08/10] selftests/ftrace: add a stackmap basic functionality test Li Pengfei
2026-09-12  9:02   ` sashiko-bot
2026-09-12  8:37 ` [RFC PATCH v7 09/10] selftests/ftrace: add a stackmap reset and binary ABI test Li Pengfei
2026-09-12  8:37 ` [RFC PATCH v7 10/10] selftests/ftrace: add a stackmap instance gating test Li Pengfei

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=20260912085841.48E7B1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=ljdlns1987@gmail.com \
    --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