Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexander Gordeev" <agordeev@linux.ibm.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
	linux-s390@vger.kernel.org,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v8 11/15] s390: Distinguish hardware and software PTEs
Date: Wed, 07 Oct 2026 11:57:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-162958@kernel.org> (raw)
In-Reply-To: <c22ed0a2d9ff0f4fff69a17332a377c460d993dc.1791365932.git.agordeev@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] s390/mm: set_pte() discards _PAGE_UNUSED clearance
--

commit a9d06a7ccc3dae14aa4eb7e5a46302fce251265b
Author: Alexander Gordeev <agordeev@linux.ibm.com>
s390: Distinguish hardware and software PTEs

This commit introduces the hw_pte_t type for hardware PTEs on s390,
distinguishing them from software PTEs which continue to use the pte_t type.
It updates various memory management functions and callbacks to enforce this
type separation, similar to ARM64. It also enables the ARCH_HAS_HW_PTE_T
configuration for the architecture.

> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index e882663a58e77..c47264f3abf21 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h

[ ... ]

> @@ -978,17 +978,19 @@ static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
>  	WRITE_ONCE(*pmdp, pmd);
>  }
>  
> -static inline void set_pte(pte_t *ptep, pte_t pte)
> +static inline void set_pte(hw_pte_t *ptep, pte_t pte)
>  {
> +	hw_pte_t hwpte = (hw_pte_t) { (pte) };
> +
>  	if (pte_present(pte))
>  		pte = clear_pte_bit(pte, __pgprot(_PAGE_UNUSED));
> -	WRITE_ONCE(*ptep, pte);
> +	WRITE_ONCE(*ptep, hwpte);

[Severity: High]
Does this discard the _PAGE_UNUSED bit clearance?

Because hwpte is initialized before pte is potentially modified, the
WRITE_ONCE call writes the original snapshot to the page table, ignoring
the update from clear_pte_bit.

If this _PAGE_UNUSED bit incorrectly remains set on an active page, could the
hypervisor (z/VM or KVM) reclaim its backing physical memory and cause silent
guest data loss or memory corruption?

>  }
>  
>  #define ptep_get ptep_get

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791365932.git.agordeev@linux.ibm.com?part=11

  reply	other threads:[~2026-10-07 11:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 11:41 [PATCH v8 00/15] s390/mm: Batch PTE updates in lazy MMU mode Alexander Gordeev
2026-10-07 11:41 ` [PATCH v8 01/15] mm: introduce hw_pte_t for PTE table storage Alexander Gordeev
2026-10-07 11:55   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 02/15] mm: rename pointers to software PTE values as ptentp Alexander Gordeev
2026-10-07 11:54   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 03/15] mm: use hw_pte_t for generic PTE table storage Alexander Gordeev
2026-10-07 12:02   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 04/15] mm: convert PTE table entries in ptep_get() Alexander Gordeev
2026-10-07 11:55   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 05/15] mm: convert PTE table entry to pte Alexander Gordeev
2026-10-07 11:50   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 06/15] mm: add hw_pte_val for HW PTE storage Alexander Gordeev
2026-10-07 11:51   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 07/15] mm/kasan: use hw_pte_t for the early shadow PTE table Alexander Gordeev
2026-10-07 11:49   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 08/15] drm/i915: use hw_pte_t for PTE range callbacks Alexander Gordeev
2026-10-07 11:51   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 09/15] xen: " Alexander Gordeev
2026-10-07 11:52   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 10/15] s390/mm: Cleanup pXXp_flush_lazy() routines Alexander Gordeev
2026-10-07 11:52   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 11/15] s390: Distinguish hardware and software PTEs Alexander Gordeev
2026-10-07 11:57   ` sashiko-bot [this message]
2026-10-07 12:01     ` Alexander Gordeev
2026-10-08 10:32   ` kernel test robot
2026-10-07 11:41 ` [PATCH v8 12/15] mm: Make lazy MMU mode context-aware Alexander Gordeev
2026-10-07 11:53   ` sashiko-bot
2026-10-07 11:41 ` [PATCH v8 13/15] s390/mm: Batch PTE updates in lazy MMU mode Alexander Gordeev
2026-10-07 12:06   ` sashiko-bot
2026-10-08  6:32     ` Alexander Gordeev
2026-10-07 11:41 ` [PATCH v8 14/15] mm/kasan: Introduce helpers for lazy MMU mode sanitizer Alexander Gordeev
2026-10-07 11:56   ` sashiko-bot
2026-10-07 20:24   ` kernel test robot
2026-10-07 20:35   ` kernel test robot
2026-10-08  1:11   ` kernel test robot
2026-10-07 11:41 ` [PATCH v8 15/15] s390/mm: Lazy " Alexander Gordeev
2026-10-07 11:53   ` 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=sashiko-outbox-162958@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@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 \
    /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