lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <111b1bfb-e2e0-4b2f-a559-9803828f3406@redhat.com>
Date: Mon, 22 Sep 2025 09:41:33 +0200
From: David Hildenbrand <david@...hat.com>
To: Lance Yang <lance.yang@...ux.dev>, akpm@...ux-foundation.org,
 lorenzo.stoakes@...cle.com
Cc: usamaarif642@...il.com, yuzhao@...gle.com, ziy@...dia.com,
 baolin.wang@...ux.alibaba.com, baohua@...nel.org, voidice@...il.com,
 Liam.Howlett@...cle.com, catalin.marinas@....com,
 cerasuolodomenico@...il.com, hannes@...xchg.org, kaleshsingh@...gle.com,
 npache@...hat.com, riel@...riel.com, roman.gushchin@...ux.dev,
 rppt@...nel.org, ryan.roberts@....com, dev.jain@....com, ryncsn@...il.com,
 shakeel.butt@...ux.dev, surenb@...gle.com, hughd@...gle.com,
 willy@...radead.org, matthew.brost@...el.com, joshua.hahnjy@...il.com,
 rakie.kim@...com, byungchul@...com, gourry@...rry.net,
 ying.huang@...ux.alibaba.com, apopple@...dia.com, qun-wei.lin@...iatek.com,
 Andrew.Yang@...iatek.com, casper.li@...iatek.com,
 chinwen.chang@...iatek.com, linux-arm-kernel@...ts.infradead.org,
 linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org,
 linux-mm@...ck.org, ioworker0@...il.com, stable@...r.kernel.org
Subject: Re: [PATCH 1/1] mm/thp: fix MTE tag mismatch when replacing
 zero-filled subpages

On 22.09.25 04:14, Lance Yang wrote:
> From: Lance Yang <lance.yang@...ux.dev>
> 
> When both THP and MTE are enabled, splitting a THP and replacing its
> zero-filled subpages with the shared zeropage can cause MTE tag mismatch
> faults in userspace.
> 
> Remapping zero-filled subpages to the shared zeropage is unsafe, as the
> zeropage has a fixed tag of zero, which may not match the tag expected by
> the userspace pointer.
> 
> KSM already avoids this problem by using memcmp_pages(), which on arm64
> intentionally reports MTE-tagged pages as non-identical to prevent unsafe
> merging.
> 
> As suggested by David[1], this patch adopts the same pattern, replacing the
> memchr_inv() byte-level check with a call to pages_identical(). This
> leverages existing architecture-specific logic to determine if a page is
> truly identical to the shared zeropage.
> 
> Having both the THP shrinker and KSM rely on pages_identical() makes the
> design more future-proof, IMO. Instead of handling quirks in generic code,
> we just let the architecture decide what makes two pages identical.
> 
> [1] https://lore.kernel.org/all/ca2106a3-4bb2-4457-81af-301fd99fbef4@redhat.com
> 
> Cc: <stable@...r.kernel.org>
> Reported-by: Qun-wei Lin <Qun-wei.Lin@...iatek.com>
> Closes: https://lore.kernel.org/all/a7944523fcc3634607691c35311a5d59d1a3f8d4.camel@mediatek.com
> Fixes: b1f202060afe ("mm: remap unused subpages to shared zeropage when splitting isolated thp")
> Suggested-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Lance Yang <lance.yang@...ux.dev>
> ---

LGTM, thanks

Acked-by: David Hildenbrand <david@...hat.com>

-- 
Cheers

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ