From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/4] perf config: Move perf_config__set_variable() to util/config.c
Date: Mon, 28 Sep 2026 17:25:04 +0000 [thread overview]
Message-ID: <20260928172504.C0D671F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260928171244.2437283-2-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf: strcmp crash on OOM via perf_etc_perfconfig()
--
commit fa97c6103dec622e75b990c48525b0269551b0aa
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf config: Move perf_config__set_variable() to util/config.c
This commit moves perf_config__set_variable() out of the perf config builtin
so that opt-in features can persist their choice from outside it. It also
serializes parsing and rewriting of config files using a mutex to support
concurrent access from multiple threads.
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
[ ... ]
> +int perf_config__set_variable(const char *var, const char *value)
> +{
> + char path[PATH_MAX];
> + char *user_config = mkpath(path, sizeof(path), "%s/.perfconfig", getenv("HOME"));
> + const char *config_filename = config_exclusive_filename ?: user_config;
> + /*
> + * When rewriting the system wide file all entries are marked as coming
> + * from it and must be kept, or it would be truncated down to its
> + * header.
> + */
> + bool system_config = strcmp(config_filename, perf_etc_perfconfig()) == 0;
[Severity: Medium]
Can this cause a segmentation fault under memory pressure?
In perf_config__set_variable(), if ETC_PERFCONFIG is an absolute path and
system_path() fails to allocate memory via strdup(), it returns NULL.
This NULL propagates through perf_etc_perfconfig() and is passed directly
as the second argument to strcmp(), which will crash when dereferencing it.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260928171244.2437283-1-acme@kernel.org?part=1
next prev parent reply other threads:[~2026-09-28 17:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 17:12 [PATCH v2 0/4] perf tools: Add progress diagnostics and a false-sharing workload Arnaldo Carvalho de Melo
2026-09-28 17:12 ` [PATCH v2 1/4] perf config: Move perf_config__set_variable() to util/config.c Arnaldo Carvalho de Melo
2026-09-28 17:25 ` sashiko-bot [this message]
2026-09-28 17:12 ` [PATCH v2 2/4] perf report: Add --progress option Arnaldo Carvalho de Melo
2026-09-28 17:21 ` sashiko-bot
2026-09-28 17:12 ` [PATCH v2 3/4] perf scripts: Add perf-stuck, to tell where a running perf is stuck Arnaldo Carvalho de Melo
2026-09-28 17:23 ` sashiko-bot
2026-09-28 17:12 ` [PATCH v2 4/4] perf test: Add false_sharing workload exhibiting cross-CPU false sharing Arnaldo Carvalho de Melo
2026-09-28 17:18 ` sashiko-bot
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=20260928172504.C0D671F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.