From: sashiko-bot@kernel.org
To: "Ondrej Mosnacek" <omosnace@redhat.com>
Cc: selinux@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf test amd ibs: avoid using executable heap
Date: Wed, 01 Jul 2026 05:53:25 +0000 [thread overview]
Message-ID: <20260701055326.109C71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701054807.508994-1-omosnace@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incorrect error check for mmap() return value leads to segmentation fault.
--
commit 40ff2c8c34df3809a114852f1d0dd5630a45771c
Author: Ondrej Mosnacek <omosnace@redhat.com>
perf test amd ibs: avoid using executable heap
This commit replaces the malloc() and mprotect() combination with a single
mmap() call for creating executable memory in the AMD IBS test. This change
avoids SELinux executable heap restrictions by directly creating an
anonymous rwx mapping.
> diff --git a/tools/perf/arch/x86/tests/amd-ibs-period.c b/tools/perf/arch/x86/tests/amd-ibs-period.c
> --- a/tools/perf/arch/x86/tests/amd-ibs-period.c
> +++ b/tools/perf/arch/x86/tests/amd-ibs-period.c
[ ... ]
> @@ -59,18 +58,11 @@ static int dummy_workload_1(unsigned long count)
> + func = mmap(NULL, page_size, PROT_READ | PROT_WRITE | PROT_EXEC,
> + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> + if (!func) {
[Severity: Medium]
Does this error check properly handle mmap() failures? mmap() returns
MAP_FAILED ((void *)-1) rather than NULL when it fails.
If mmap() fails (e.g., due to SELinux denying execmem), this check will
evaluate to false, and the code will fall through to memcpy() into an
invalid address, triggering a segmentation fault.
> + pr_debug("mmap() failed. %m\n");
> + return -1;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701054807.508994-1-omosnace@redhat.com?part=1
prev parent reply other threads:[~2026-07-01 5:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 5:48 [PATCH] perf test amd ibs: avoid using executable heap Ondrej Mosnacek
2026-07-01 5:53 ` sashiko-bot [this message]
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=20260701055326.109C71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=selinux@vger.kernel.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