Re: [PATCH] arm64/mm: restrict transparent contpte mappings to valid PTEs

From: David Hildenbrand (Arm)

Date: Mon Oct 26 2026 - 05:45:32 EST


On 10/24/26 18:00, Zhao Gongyi wrote:
> On 10/24/26 4:55 AM, David Hildenbrand (Arm) wrote:
>>
>> Hi,
>>
>> sorry for the late reply.
>>
>> If we have the spare PTE bit, why shouldn't we just use it?
>>
>> It will make batching over PTEs faster. And we care about that for present PTEs.
>>
>> So I don't quite see why the stable fix couldn't just do it right away? Do you
>> have a prototype that shows that it would require significant code changes?
>>
>
> Hi David,
>
> I tried a small prototype that keeps PTE_CONT on present-invalid PTEs.
> It leaves contpte_set_ptes() unchanged and makes contpte_try_unfold()
> recognize pte_present(pte) && pte_cont(pte), instead of checking only
> pte_valid_cont(pte).
>
> With this change, the guard-marker reproducer passed 100 iterations
> in an arm64 QEMU/KVM guest running a KASAN-enabled kernel. The fork
> and PMD-split probes passed five runs each, with no warnings or KASAN
> reports. In the earlier A/B test, the unmodified kernel failed on the
> first guard-marker iteration.
>
> The prototype makes the reported reproducer pass with a small change
> while retaining PTE_CONT. I therefore cannot point to evidence that
> fixing this failure requires significant code changes.

Can you paste the code here for easy review if that it the right approach?

--
Cheers,

David