[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQLc4YlDfMRbnRJh@google.com>
Date: Thu, 29 Jul 2021 17:52:49 +0100
From: Quentin Perret <qperret@...gle.com>
To: David Brazdil <dbrazdil@...gle.com>
Cc: kvmarm@...ts.cs.columbia.edu, Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] KVM: arm64: Fix off-by-one in range_is_memory
On Wednesday 28 Jul 2021 at 15:32:31 (+0000), David Brazdil wrote:
> Hyp checks whether an address range only covers RAM by checking the
> start/endpoints against a list of memblock_region structs. However,
> the endpoint here is exclusive but internally is treated as inclusive.
> Fix the off-by-one error that caused valid address ranges to be
> rejected.
>
> Cc: Quentin Perret <qperret@...gle.com>
> Fixes: 90134ac9cabb6 ("KVM: arm64: Protect the .hyp sections from the host")
> Signed-off-by: David Brazdil <dbrazdil@...gle.com>
> ---
> arch/arm64/kvm/hyp/nvhe/mem_protect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/mem_protect.c b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> index d938ce95d3bd..a6ce991b1467 100644
> --- a/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> +++ b/arch/arm64/kvm/hyp/nvhe/mem_protect.c
> @@ -193,7 +193,7 @@ static bool range_is_memory(u64 start, u64 end)
> {
> struct kvm_mem_range r1, r2;
>
> - if (!find_mem_range(start, &r1) || !find_mem_range(end, &r2))
> + if (!find_mem_range(start, &r1) || !find_mem_range(end - 1, &r2))
> return false;
> if (r1.start != r2.start)
> return false;
Looks good to me:
Reviewed-by: Quentin Perret <qperret@...gle.com>
Thanks,
Quentin
Powered by blists - more mailing lists