All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 2/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for the STSI buffer
Date: Wed, 2 Sep 2026 10:55:21 +0300	[thread overview]
Message-ID: <apfWaanSoZQOwEw_@kernel.org> (raw)
In-Reply-To: <20260902062223.5295D1F000E9@smtp.kernel.org>

On Wed, Sep 02, 2026 at 06:22:22AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Critical] Replacing get_zeroed_page() with kzalloc() breaks the hardware 4K alignment requirement for the STSI buffer, creating a Guest-to-Host Denial of Service (DoS) vulnerability.
> --
> 
> commit bcd4e89cdbdb3a1d43d3845b698f4de5d334121d
> Author: Mike Rapoport (Microsoft) <rppt@kernel.org>
> 
> KVM: s390: Replace get_zeroed_page() with kzalloc() for the STSI buffer
> 
> This commit replaces get_zeroed_page() with kzalloc() for allocating
> the STSI response block buffer in the s390 KVM subsystem.
> 
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> 
> > diff --git a/arch/s390/kvm/s390/priv.c b/arch/s390/kvm/s390/priv.c
> > index b3cb2c2c3aa71..856939acf012f 100644
> > --- a/arch/s390/kvm/s390/priv.c
> > +++ b/arch/s390/kvm/s390/priv.c
> [ ... ]
> > @@ -911,19 +912,19 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
> >  	switch (fc) {
> >  	case 1: /* same handling for 1 and 2 */
> >  	case 2:
> > -		mem = get_zeroed_page(GFP_KERNEL_ACCOUNT);
> > +		mem = kzalloc(PAGE_SIZE, GFP_KERNEL_ACCOUNT);
> >  		if (!mem)
> >  			goto out_no_data;
> > -		if (stsi((void *) mem, fc, sel1, sel2))
> > +		if (stsi(mem, fc, sel1, sel2))
> 
> [Severity: Critical]
> Does this allocation guarantee the 4K alignment required by the STSI hardware
> instruction?
> 
> While kzalloc() for PAGE_SIZE might often return page-aligned memory, it is
> not strictly guaranteed, especially if slab debugging (CONFIG_SLUB_DEBUG)
> with redzoning or CONFIG_KASAN is enabled.

It's strictly guaranteed, see commit 59bb47985c1db ("mm, sl[aou]b:
guarantee natural alignment for kmalloc(power-of-two)")
 
-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-09-02  7:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  6:15 [PATCH 0/4] KVM: s390: replace page allocator calls with kzalloc() Mike Rapoport (Microsoft)
2026-09-02  6:15 ` [PATCH 1/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for the STHYI buffer Mike Rapoport (Microsoft)
2026-09-02  6:19   ` sashiko-bot
2026-09-02  6:15 ` [PATCH 2/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for the STSI buffer Mike Rapoport (Microsoft)
2026-09-02  6:22   ` sashiko-bot
2026-09-02  7:55     ` Mike Rapoport [this message]
2026-09-02  6:15 ` [PATCH 3/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for the GIB Mike Rapoport (Microsoft)
2026-09-02  6:28   ` sashiko-bot
2026-09-02  6:15 ` [PATCH 4/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for sie_page2 and CMMA Mike Rapoport (Microsoft)
2026-09-02  6:26   ` sashiko-bot
2026-09-02 11:06 ` [PATCH 0/4] KVM: s390: replace page allocator calls with kzalloc() Claudio Imbrenda
2026-09-02 13:17   ` Mike Rapoport
2026-09-02 14:53     ` Claudio Imbrenda
2026-09-03  8:04       ` Mike Rapoport
2026-09-03 13:08         ` Claudio Imbrenda
2026-09-03 15:22           ` Mike Rapoport

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=apfWaanSoZQOwEw_@kernel.org \
    --to=rppt@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --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 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.