From: sashiko-bot@kernel.org
To: "Alexander Gordeev" <agordeev@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [RFC PATCH 4/4] s390/mm: implement __ptent-aware pte_t type
Date: Fri, 17 Jul 2026 13:39:46 +0000 [thread overview]
Message-ID: <20260717133946.83EF81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <2580c0c643125fb89247f255ff42803bea44e4c3.1784292223.git.agordeev@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] In `set_pte()` when `STRICT_MM_TYPECHECKS` is defined, the `_PAGE_UNUSED` bit is incorrectly left asserted on present PTEs because a stale snapshot of the PTE is written to the page table instead of the updated value.
--
--- Patch [4]: [RFC PATCH 4/4] s390/mm: implement __ptent-aware pte_t type ---
commit 7300d6f6725c9361fd35e232d50cadaf34b8a823
Author: Alexander Gordeev <agordeev@linux.ibm.com>
s390/mm: implement __ptent-aware pte_t type
This commit introduces a new pteraw_t type to enforce strict mm type checks
for PTEs on s390, modifying how set_pte() and other helpers handle page
table entries.
[ ... ]
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index e882663a58e77..473e6f58ff9e8 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
[ ... ]
> @@ -978,6 +978,49 @@ static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
> WRITE_ONCE(*pmdp, pmd);
> }
>
> +#ifdef STRICT_MM_TYPECHECKS
> +static inline void set_pte(pte_t *ptep, pte_t pte)
> +{
> + pteraw_t *pteraw_ptep = (__force pteraw_t *)ptep;
> + pteraw_t pteraw = __pteraw(pte_val(pte));
> +
> + if (pte_present(pte))
> + pte = clear_pte_bit(pte, __pgprot(_PAGE_UNUSED));
> + WRITE_ONCE(*pteraw_ptep, pteraw);
[Severity: High]
Does this WRITE_ONCE() write the unmodified original pte instead of the
cleared one?
Since pteraw is captured from the initial pte argument before clear_pte_bit()
is called, it looks like the _PAGE_UNUSED modification to pte is completely
ignored when writing to memory.
Should pteraw be updated with the modified pte before calling WRITE_ONCE()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784292223.git.agordeev@linux.ibm.com?part=4
next prev parent reply other threads:[~2026-07-17 13:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 13:32 [RFC PATCH 0/4] mm: introduce __ptent sparse attribute Alexander Gordeev
2026-07-17 13:32 ` [RFC PATCH 1/4] mm: use proper PTE accessors in madvise() and mremap() Alexander Gordeev
2026-07-17 13:53 ` sashiko-bot
2026-07-17 17:14 ` Kevin Brodsky
2026-07-17 13:32 ` [RFC PATCH 2/4] mm: introduce ptep_get_nopgtable() and set_pte_nopgtable() accessors Alexander Gordeev
2026-07-17 14:10 ` sashiko-bot
2026-07-17 13:32 ` [RFC PATCH 3/4] mm: introduce __ptent sparse attribute Alexander Gordeev
2026-07-17 13:32 ` [RFC PATCH 4/4] s390/mm: implement __ptent-aware pte_t type Alexander Gordeev
2026-07-17 13:39 ` sashiko-bot [this message]
2026-07-17 14:53 ` [RFC PATCH 0/4] mm: introduce __ptent sparse attribute David Hildenbrand (Arm)
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=20260717133946.83EF81F000E9@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 \
/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.