From: sashiko-bot@kernel.org
To: "Florian Fainelli" <florian.fainelli@broadcom.com>
Cc: bpf@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH stable 6.1 1/3] perf build: Conditionally define NDEBUG
Date: Tue, 19 May 2026 19:23:58 +0000 [thread overview]
Message-ID: <20260519192358.A44B31F00894@smtp.kernel.org> (raw)
In-Reply-To: <20260519185154.2987285-2-florian.fainelli@broadcom.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Defining NDEBUG removes the side-effecting `bfd_check_format()` call inside `assert()`, leaving the `bfd` object uninitialized.
- [Medium] Compiling out assert() removes critical runtime validation, leading to deadlocks and NULL pointer dereferences.
- [Low] Defining NDEBUG causes variables only used in assert() to trigger unused-but-set build failures.
--
commit 34a3ad3c8a3c7ed93c69e4b84492292fae1cb400
Author: Ian Rogers <irogers@google.com>
perf build: Conditionally define NDEBUG
When a build is done without DEBUG=1 then define NDEBUG. This will
compile out asserts and other debug code.
Link: https://lore.kernel.org/r/20230330183827.1412303-1-irogers@google.com
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 898226ea8cadc..45708084fd3d6 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -228,6 +228,7 @@ ifndef DEBUG
> endif
>
> ifeq ($(DEBUG),0)
> +CORE_CFLAGS += -DNDEBUG=1
[Severity: Medium]
Will this cause a regression in tools/perf/util/annotate.c? The function
bfd_check_format() is called directly inside an assert() macro there.
Since this function has side effects (identifying the binary format and
initializing the architecture and machine state), compiling it out will leave
the bfd structure uninitialized.
Subsequent calls like bfd_get_arch(bfdf) operate on uninitialized bfdf state,
leading to NULL pointer dereferences and crashes during perf annotate.
[Severity: Low]
Will this also cause build regressions due to unused variables? Variables such
as old in tools/perf/util/block-range.c are initialized and assigned values but
are only read inside assert() macros.
Compiling out assert() leaves these variables assigned but never read, which
triggers unused-but-set build failures because the perf build uses -Werror.
[Severity: Medium]
Does compiling out assert() remove required runtime validation elsewhere? The
codebase currently relies on assert() for handling expected runtime failures.
For example, in bench_sched_pipe() (tools/perf/bench/sched-pipe.c),
assert(pid >= 0) checks for fork() failures. Without it, a fork failure causes
the parent to execute the child's logic, reading from an empty pipe and
deadlocking indefinitely.
Similarly, in tools/perf/builtin-timechart.c (assert(cursor != NULL)) and
tools/perf/builtin-top.c (evlist__id2evsel), allocation and lookup failures
proceed without aborting, leading to immediate NULL pointer dereferences on
subsequent lines.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260519185154.2987285-1-florian.fainelli@broadcom.com?part=1
next prev parent reply other threads:[~2026-05-19 19:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 1/3] perf build: Conditionally define NDEBUG Florian Fainelli
2026-05-19 19:23 ` sashiko-bot [this message]
2026-05-19 18:51 ` [PATCH stable 6.1 2/3] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 3/3] perf build: Disable fewer bison warnings Florian Fainelli
2026-05-19 19:54 ` sashiko-bot
2026-05-19 18:55 ` [PATCH stable 6.1 0/3] perf build fixes Ian Rogers
2026-05-19 19:29 ` Florian Fainelli
2026-05-20 14:31 ` 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=20260519192358.A44B31F00894@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=linux-perf-users@vger.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