All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Namhyung Kim" <namhyung@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 6/7] perf trace: Add beautifier script for fsmount flags
Date: Tue, 12 May 2026 21:54:01 +0000	[thread overview]
Message-ID: <20260512215402.0CFE5C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260510202346.49853-7-namhyung@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] NULL pointer dereference when parsing string filters for the `fsmount` syscall flags in `perf trace`.
--

commit f130ece1ce49e8a473ebf43d62d18d2a42d44946
Author: Namhyung Kim <namhyung@kernel.org>

perf trace: Add beautifier script for fsmount flags

This commit introduces a beautifier script to generate fsmount_flags[] from
mount.h, moving the existing array to fsmount_attr.sh.

> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
[ ... ]
> @@ -1202,7 +1197,9 @@ static const struct syscall_fmt syscall_fmts[] = {
>  	{ .name     = "fsconfig",
>  	  .arg = { [1] = STRARRAY(cmd, fsconfig_cmds), }, },
>  	{ .name     = "fsmount",
> -	  .arg = { [1] = STRARRAY_FLAGS(flags, fsmount_flags),
> +	  .arg = { [1] = { .scnprintf = SCA_FSMOUNT_FLAGS, /* fsmount_flags */
> +			   .strtoul   = STUL_STRARRAYS,
> +			   .show_zero = true, },

Could this cause a NULL pointer dereference when parsing string filters?

Because .parm is omitted here, it defaults to NULL. If a user runs a trace
command with a string filter like perf trace -e 'fsmount(flags==CLOEXEC)',
the STUL_STRARRAYS parser will pass this NULL .parm to strarrays__strtoul(),
which will unconditionally dereference sas->nr_entries.

Also, does STUL_STRARRAYS expect a struct strarrays rather than a struct
strarray? Since fsmount flags are bitmasks, should this use
STUL_STRARRAY_FLAGS along with an exported strarray instead?

>  		   [2] = { .scnprintf = SCA_FSMOUNT_ATTR_FLAGS, /* attr_flags */ }, }, },
>  	{ .name     = "fspick",
>  	  .arg = { [0] = { .scnprintf = SCA_FDAT,	  /* dfd */ },

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260510202346.49853-1-namhyung@kernel.org?part=6

  reply	other threads:[~2026-05-12 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 20:23 [PATCH v3 0/7] perf build: Update kernel headers Namhyung Kim
2026-05-10 20:23 ` [PATCH v3 1/7] perf trace: Sync linux/socket.h with the kernel source Namhyung Kim
2026-05-10 20:23 ` [PATCH v3 2/7] perf trace: Sync uapi/linux/fs.h " Namhyung Kim
2026-05-10 20:23 ` [PATCH v3 3/7] perf trace: Sync uapi/linux/mount.h " Namhyung Kim
2026-05-10 20:23 ` [PATCH v3 4/7] perf trace: Sync uapi/linux/sched.h " Namhyung Kim
2026-05-12 21:53   ` sashiko-bot
2026-05-10 20:23 ` [PATCH v3 5/7] perf build: Add make check-headers target Namhyung Kim
2026-05-12 21:54   ` sashiko-bot
2026-05-10 20:23 ` [PATCH v3 6/7] perf trace: Add beautifier script for fsmount flags Namhyung Kim
2026-05-12 21:54   ` sashiko-bot [this message]
2026-05-10 20:23 ` [PATCH v3 7/7] perf trace: Update beautifier script for clone flags Namhyung Kim
2026-05-12 21:54   ` sashiko-bot
2026-05-11 18:22 ` [PATCH v3 0/7] perf build: Update kernel headers Ian Rogers

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=20260512215402.0CFE5C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sashiko@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.