Re: [PATCH] x86/mm: fix lookup_address() to handle physical memory holes in direct mapping

From: Jürgen Groß
Date: Tue Jul 02 2024 - 01:30:00 EST


On 01.07.24 21:39, Kalra, Ashish wrote:

On 7/1/2024 2:13 PM, Edgecombe, Rick P wrote:
On Mon, 2024-07-01 at 13:59 -0500, Kalra, Ashish wrote:
Then what is the caller supposed to do in this case ?

As the return from lookup_address() is non-NULL in this case, accessing it
causes a fatal #PF.

Is the caller supposed to add the check for a valid PTE using pte_none(*pte) ?
I did a quick look at the callers, and some do their own check for pte_none().
But some don't. Some also assume the return can't be NULL.

Can you elaborate on your goal for this change? Just a cleanup?

Hit this issue while implementing and testing SNP guest kexec.

So trying to understand if need a generic fix for this issue or do i need to add my own check for pte_none() ?

Please add a check for pte_none() after calling lookup_address().


Juergen