Re: [PATCH] KVM: arm64: Fix the upper limit of the walker range

Suzuki K Poulose
2025-01-16T13:50:07Z

On 16/01/2025 10:55, Marc Zyngier wrote:
> On Thu, 16 Jan 2025 01:16:40 +0000,
> Mark Brown <broonie@kernel.org> wrote:
>>
>> On Tue, Jan 14, 2025 at 02:50:51PM +0000, Sebastian Ene wrote:
>>
>>> Prevent the walker from running into weeds when walking an
>>> entire address range.
>>
>> The KVM page_fault_test selftest started failing in next-20250115 on
>> at least n1sdp and TX2 in VHE mode and a bisect seems to point to this
>> change. The bisect only just finished, I've done no further
>> investigation.
>>
>> When the test fails it generates backtraces like that below:
>
> [...]
>
> Thanks for the heads up.
>
> Given how close we are to the merge window opening, I've dropped this
> patch from -next.
>
> Seb: it looks this breaks a bunch of existing assumptions. Let's
> revisit this before -rc1, if possible.
In kvm_pgtable_walk() we set the walk_data.end to PAGE_ALIGNED(start +
size), where size is BIT(ia_size) and start = 0, for
kvm_pgtable_stage2_destroy().

And subtracting the limit in _kvm_pgtable_walk makes things go bad,
returning -ERANGE.
Given the kvm_pgtable_walk() passes the "end" as the top address (not
including it), and is always PAGE_ALIGNED, we should probably leave
things as it is in the code.

Cheers
Suzuki

>
> Thanks,
>
> M.
>