Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Niklas Schnelle" <schnelle@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH] s390/sclp: Allow SCLP Action Qualifiers for Spyre card status reporting
Date: Fri, 24 Jul 2026 12:36:53 +0000	[thread overview]
Message-ID: <20260724123654.2886C1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260724-sclp_allow_aqs_spyre-v1-1-569acfe11385@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Medium] The sysfs `report_error` binary attribute does not verify that the user-provided write buffer size (`count`) is large enough to cover the embedded payload length (`report->length`). This leads to reading uninitialized kernel heap memory which is then sent to the SCLP hardware.
--

--- Patch [1]: [PATCH] s390/sclp: Allow SCLP Action Qualifiers for Spyre card status reporting ---
commit 320785563461e373b0db5b021ac2e04f40ee8406
Author: Niklas Schnelle <schnelle@linux.ibm.com>

s390/sclp: Allow SCLP Action Qualifiers for Spyre card status reporting

Add SCLP Action Qualifiers used by the Spyre stack for reporting of the
card's initialization status, recoverable errors, and telemetry data.

> diff --git a/drivers/s390/char/sclp_pci.c b/drivers/s390/char/sclp_pci.c
> index d61a7fc0dd610..b79ef7006e46f 100644
> --- a/drivers/s390/char/sclp_pci.c
> +++ b/drivers/s390/char/sclp_pci.c
> @@ -99,6 +99,9 @@ static int sclp_pci_check_report(struct zpci_report_error_header *report)
>  	case SCLP_ERRNOTIFY_AQ_INFO_LOG:
>  	case SCLP_ERRNOTIFY_AQ_OPTICS_DATA:
>  	case SCLP_ERRNOTIFY_AQ_NVME_SMART_LOG:
> +	case SCLP_ERRNOTIFY_AQ_ADAPTER_INITIALIZED:
> +	case SCLP_ERRNOTIFY_AQ_RECOVERABLE_ERROR:
> +	case SCLP_ERRNOTIFY_AQ_TELEMETRY_DATA:

[Severity: Medium]
This is a pre-existing issue and was not introduced by the patch under review,
but could this code leak uninitialized kernel heap memory to the SCLP
hardware?

Looking at how report_error_write() handles the sysfs write, it verifies the
buffer is at least as large as the header struct:

arch/s390/pci/pci_sysfs.c:report_error_write() {
	if (off || (count < sizeof(*report)))
		return -EINVAL;
}

However, it does not check if the user-provided count is large enough to cover
the embedded payload length (report->length).

Later, when sclp_pci_report() processes this report, it copies report->length
bytes:

drivers/s390/char/sclp_pci.c:sclp_pci_report() {
	memcpy(sccb->evbuf.data, report->data, report->length);
}

If a user writes a small payload length but specifies a large report->length
in the embedded header, will memcpy() read past the end of the sysfs buffer
and send uninitialized heap data?

>  		break;
>  	default:
>  		return -EINVAL;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-sclp_allow_aqs_spyre-v1-1-569acfe11385@linux.ibm.com?part=1

  reply	other threads:[~2026-07-24 12:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 12:23 [PATCH] s390/sclp: Allow SCLP Action Qualifiers for Spyre card status reporting Niklas Schnelle
2026-07-24 12:36 ` sashiko-bot [this message]
2026-07-24 12:49 ` Benjamin Block
2026-07-24 12:55   ` Benjamin Block
2026-07-29 11:28 ` Vasily Gorbik

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=20260724123654.2886C1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=schnelle@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox