All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Krowiak <akrowiak@linux.ibm.com>
To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org
Cc: jjherne@linux.ibm.com, borntraeger@de.ibm.com,
	mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex@shazbot.org,
	kwankhede@nvidia.com, fiuczy@linux.ibm.com, pbonzini@redhat.com,
	frankja@linux.ibm.com, imbrenda@linux.ibm.com,
	agordeev@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com
Subject: [PATCH v7 0/6] s390/vfio-ap: Fix pre-existing bugs in vfio_ap device driver
Date: Fri,  4 Sep 2026 18:35:25 -0400	[thread overview]
Message-ID: <20260904223531.1611088-1-akrowiak@linux.ibm.com> (raw)

The sashiko AI reported several pre-existing bugs in the vfio_ap device
driver code while reviewing unrelated patches. This series fixes four
such bugs.

Change log v6 => v7:
~~~~~~~~~~~~~~~~~~~
Patch: s390/vfio-ap: fix queue state leakage to guest and host

  apq_reset_check()
  - Fixed missing closing brace on -EIO early-return block that
    made the AP_RESET_MAX_WAIT timeout check unreachable.
  - Introduced apq_reset_finalize() helper to copy the final
    TAPQ status word to q->reset_status and set
    q->reset_status.response_code to AP_RESPONSE_NORMAL only
    when zeroization is confirmed (ret == 0). Replaces the
    done: label and goto.
  - Both pre-timeout and within-timeout completion paths now
    call apq_reset_finalize() directly.

  apq_status_check()
  - Signature changed from (int apqn, ...) to
    (struct vfio_ap_queue *q, ...) to support ratelimited
    warning reporting.

  vfio_ap_mdev_remove_queue()
  - Removed post-lock fallback unbounded reset block that had
    a use-after-free risk on q->matrix_mdev after
    release_update_locks_for_mdev().

Patch: s390/vfio-ap: replace guest-reachable WARNs with
       ratelimited warnings and add dmesg visibility to DBF_WARNs
       
This is a new patch created in response to review comments of the
v6 series.

  vfio_ap_wait_for_irqclear()
  - Signature changed from (int apqn) to
    (struct vfio_ap_queue *q).
  - Replaced WARN_ONCE calls with report_tapq_rc() and
    report_irqclear_timeout().

  vfio_ap_irq_disable()
  - Replaced three WARN_ONCE calls with
    report_aqic_disable_error().
  - Added AP_RESPONSE_STATE_CHANGE_IN_PROGRESS to retry case.
  - Added AP_RESPONSE_INVALID_GISA,
    AP_RESPONSE_ASSOC_SECRET_NOT_UNIQUE and
    AP_RESPONSE_ASSOC_FAILED as explicit end_fail cases.

  vfio_ap_irq_enable()
  - Added dev_warn_ratelimited() alongside each
    VFIO_AP_DBF_WARN() call for dmesg visibility.

  handle_pqap()
  - Added pr_warn_ratelimited() for AIV facility not installed
    and hook not registered cases.
  - Added dev_warn_ratelimited() for mdev not in use and queue
    not bound cases.

  apq_status_check()
  - Replaced WARN with report_tapq_rc().

  vfio_ap_mdev_reset_queue()
  - Replaced WARN with report_zapq_rc().
  - Removed AP_RESPONSE_BUSY from async-reset case (not a
    valid ZAPQ response code).

  New functions introduced:
  - apq_reset_finalize()
  - report_tapq_rc()
  - report_irqclear_timeout()
  - report_aqic_disable_error()
  - report_zapq_rc()
  
Anthony Krowiak (6):
  s390/vfio-ap: Fix leaks of pinned NIB and registered GISC
  s390/vfio-ap: Fix failure to release IRQ notification eventfd contexts
  s390/vfio-ap: Fix unbounded loop in apq_reset_check()
  s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in
    vfio_ap_mdev_cfg_add()
  s390/vfio-ap: fix queue state leakage to guest and host
  s390/vfio-ap: replace guest-reachable WARNs with ratelimited          
        warnings and add dmesg visibility to DBF_WARNs

 drivers/s390/crypto/vfio_ap_ops.c | 539 ++++++++++++++++++++++++------
 1 file changed, 441 insertions(+), 98 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-09-04 22:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 22:35 Anthony Krowiak [this message]
2026-09-04 22:35 ` [PATCH v7 1/6] s390/vfio-ap: Fix leaks of pinned NIB and registered GISC Anthony Krowiak
2026-09-04 22:51   ` sashiko-bot
2026-09-04 22:35 ` [PATCH v7 2/6] s390/vfio-ap: Fix failure to release IRQ notification eventfd contexts Anthony Krowiak
2026-09-04 22:49   ` sashiko-bot
2026-09-04 22:35 ` [PATCH v7 3/6] s390/vfio-ap: Fix unbounded loop in apq_reset_check() Anthony Krowiak
2026-09-04 22:49   ` sashiko-bot
2026-09-04 22:35 ` [PATCH v7 4/6] s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add() Anthony Krowiak
2026-09-04 22:46   ` sashiko-bot
2026-09-04 22:35 ` [PATCH v7 5/6] s390/vfio-ap: fix queue state leakage to guest and host Anthony Krowiak
2026-09-04 22:46   ` sashiko-bot
2026-09-04 22:35 ` [PATCH v7 6/6] s390/vfio-ap: replace guest-reachable WARNs with ratelimited warnings and add dmesg visibility to DBF_WARNs Anthony Krowiak
2026-09-04 22:50   ` 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=20260904223531.1611088-1-akrowiak@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alex@shazbot.org \
    --cc=borntraeger@de.ibm.com \
    --cc=fiuczy@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    /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.