From: Martin Kaiser <martin@kaiser.cx>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
James Clark <james.clark@linaro.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] perf test: fix sys_enter_openat event test for musl
Date: Thu, 30 Apr 2026 09:15:23 +0200 [thread overview]
Message-ID: <afMBi-V4FgEWgSVh@akranes.kaiser.cx> (raw)
In-Reply-To: <CAP-5=fU7vttJC6nP8swT19bynjnhV4DR4cetHK6=gBGsp67NMg@mail.gmail.com>
Thus wrote Ian Rogers (irogers@google.com):
> On Tue, Apr 28, 2026 at 7:39 AM Martin Kaiser <martin@kaiser.cx> wrote:
> > The "syscalls:sys_enter_openat event fields" test calls
> > openat(AT_FDCWD, "/etc/passwd", O_RDONLY | O_DIRECTORY)
> > and verifies that the flags of the captured event are matching.
> > This fails for musl, where the openat syscall wrapper always adds
> > O_LARGEFILE.
> > Update the check to allow for additional flags, the access mode flags
> > must be unchanged.
> > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> > ---
> > v2:
> > - check that access mode is unchanged
> > tools/perf/tests/openat-syscall-tp-fields.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> > diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
> > index 2a139d2781a8..5523cf4e9321 100644
> > --- a/tools/perf/tests/openat-syscall-tp-fields.c
> > +++ b/tools/perf/tests/openat-syscall-tp-fields.c
> > @@ -120,7 +120,10 @@ static int test__syscall_openat_tp_fields(struct test_suite *test __maybe_unused
> > tp_flags = evsel__intval(evsel, &sample, "flags");
> > perf_sample__exit(&sample);
> > - if (flags != tp_flags) {
> > + /* C library wrapper may set additional flags,
> > + access mode must be unchanged */
> I think normal style would be:
> ```
> /*
> * C library ...
> */
> ```
Ok, will fix this if we need another version.
> > + if ((tp_flags & O_ACCMODE) != (flags & O_ACCMODE) ||
> > + (tp_flags & flags) != flags) {
> How can this second condition be true given the first condition?
Sorry if I am missing something obvious.
The O_ACCMODE check verifies that the two lower bits (access mode flags) in
the syscall and in the recorded event are identical.
The second check tests that all flags from the syscall are also set in the
event. Additional flags in the event are ok.
For tp_flags == 0x0 and flags == 0x4, the first condition is false, the second
one is true.
Best regards,
Martin
> Thanks,
> Ian
> > pr_debug("%s: Expected flags=%#x, got %#x\n",
> > __func__, flags, tp_flags);
> > goto out_delete_evlist;
> > --
> > 2.43.7
next prev parent reply other threads:[~2026-04-30 7:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 14:38 [PATCH v2 0/3] perf: fix some tests for musl Martin Kaiser
2026-04-28 14:38 ` [PATCH v2 1/3] perf test: fix nanosleep check in the ftrace test Martin Kaiser
2026-04-28 14:38 ` [PATCH v2 2/3] perf test: fix sys_enter_openat event test for musl Martin Kaiser
2026-04-29 16:55 ` Ian Rogers
2026-04-30 7:15 ` Martin Kaiser [this message]
2026-04-28 14:38 ` [PATCH v2 3/3] perf test: fix "trace summary" test for musl-based systems Martin Kaiser
2026-04-29 16:57 ` Ian Rogers
2026-04-28 23:09 ` [PATCH v2 0/3] perf: fix some tests for musl Namhyung Kim
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=afMBi-V4FgEWgSVh@akranes.kaiser.cx \
--to=martin@kaiser.cx \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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