From: Anthony Krowiak <akrowiak@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-s390@vger.kernel.org,
Alexander Gordeev <agordeev@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
kvm@vger.kernel.org,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Jason Herne <jjherne@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>
Subject: Re: [PATCH 4/4] s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add()
Date: Mon, 24 Aug 2026 17:08:31 -0400 [thread overview]
Message-ID: <f2a050d7-e964-4472-8b4e-cd1df574a099@linux.ibm.com> (raw)
In-Reply-To: <20260824141119.9C19C1F000E9@smtp.kernel.org>
On 8/24/26 10:11 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>
> Pre-existing issues:
> - [High] Incomplete Fix / Latent Stack Buffer Overflow due to Inconsistent Constant Usage
> --
>
> --- Patch [4]: [PATCH 4/4] s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add() ---
> commit 35cf2442d556c90b8b97a43b8f409fe51d21bae0
> Author: Anthony Krowiak <akrowiak@linux.ibm.com>
>
> s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add()
>
> This commit changes the bitmap size constant from AP_DEVICES to AP_DOMAINS
> in vfio_ap_mdev_cfg_add() for the adm_add bitmap. The change prevents future
> issues if the constants' values ever diverge.
>
>> Control domains are indexed by AP queue index (APQI) and their
>> bitmaps are sized by AP_DOMAINS, not AP_DEVICES. The two
>> constants are both 256 today so there is no functional impact,
>> but the wrong constant is inconsistent with the two bitmap_and()
>> calls immediately above it and with every other operation on
>> adm/aqm bitmaps in the file, all of which correctly use
>> AP_DOMAINS.
> [Severity: High]
> This is a pre-existing issue, but does every other operation correctly use
> AP_DOMAINS?
>
> Looking at vfio_ap_mdev_on_cfg_remove(), it appears AP_DEVICES is still used
> for domain masks sized by AP_DOMAINS:
>
> drivers/s390/crypto/vfio_ap_ops.c:vfio_ap_mdev_on_cfg_remove() {
> ...
> do_remove |= bitmap_andnot(aqrem,
> (unsigned long *)prev_config_info->aqm,
> (unsigned long *)cur_config_info->aqm,
> AP_DEVICES);
> do_remove |= bitmap_andnot(cdrem,
> (unsigned long *)prev_config_info->adm,
> (unsigned long *)cur_config_info->adm,
> AP_DEVICES);
> ...
> }
>
> Similarly, in vfio_ap_mdev_hot_unplug_domain():
>
> drivers/s390/crypto/vfio_ap_ops.c:vfio_ap_mdev_hot_unplug_domain() {
> ...
> DECLARE_BITMAP(apqis, AP_DOMAINS);
>
> bitmap_zero(apqis, AP_DEVICES);
> ...
> }
>
> If the constants AP_DEVICES and AP_DOMAINS ever diverge, could these
> operations cause out-of-bounds stack memory accesses?
Yes, those all need to be changed to use AP_DOMAINS
>
next prev parent reply other threads:[~2026-08-24 21:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 13:58 [PATCH 0/4] Fix pre-existing bugs in vfio_ap device driver Anthony Krowiak
2026-08-24 13:58 ` [PATCH 1/4] s390/vfio-ap: Fix leak of pinned NIB and registered NISC in vfio_ap_irq_enable() Anthony Krowiak
2026-08-24 14:11 ` sashiko-bot
2026-08-24 19:45 ` Anthony Krowiak
2026-08-24 16:57 ` Matthew Rosato
2026-08-24 19:26 ` Anthony Krowiak
2026-08-24 19:39 ` Anthony Krowiak
2026-08-24 19:56 ` Matthew Rosato
2026-08-24 20:56 ` Anthony Krowiak
2026-08-24 21:03 ` Anthony Krowiak
2026-08-24 13:58 ` [PATCH 2/4] s390/vfio-ap: Fix failure to release IRQ notification eventfd contexts Anthony Krowiak
2026-08-24 14:09 ` sashiko-bot
2026-08-24 17:04 ` Matthew Rosato
2026-08-24 13:58 ` [PATCH 3/4] s390/vfio-ap: Fix unbounded loop in apq_reset_check() Anthony Krowiak
2026-08-24 14:14 ` sashiko-bot
2026-08-24 17:04 ` Matthew Rosato
2026-08-24 19:54 ` Anthony Krowiak
2026-08-24 20:08 ` Anthony Krowiak
2026-08-24 13:58 ` [PATCH 4/4] s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add() Anthony Krowiak
2026-08-24 14:11 ` sashiko-bot
2026-08-24 21:08 ` Anthony Krowiak [this message]
2026-08-24 15:03 ` Jason J. Herne
2026-08-24 17:04 ` Matthew Rosato
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=f2a050d7-e964-4472-8b4e-cd1df574a099@linux.ibm.com \
--to=akrowiak@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--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