public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: avoid false-positive objtool warning in page_fault_oops()
@ 2024-12-17  8:30 Arnd Bergmann
  2024-12-17 11:47 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2024-12-17  8:30 UTC (permalink / raw)
  To: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86
  Cc: Josh Poimboeuf, Arnd Bergmann, H. Peter Anvin, Andrew Morton,
	Jason Gunthorpe, Suren Baghdasaryan, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When printing the oops for a VMAP_STACK overflow, the final call
frompage_fault_oops() does not return to the original stack, which
confuses gcc, and the unreachable() annotation leads to the end
of the function just continuing on in the next one:

arch/x86/mm/fault.o: warning: objtool: page_fault_oops() falls through to next function kernelmode_fixup_or_oops.constprop.0()

To work around the warning, add an explicit endless loop here that
objtool can detect.

Fixes: 6271cfdfc0e4 ("x86/mm: Improve stack-overflow #PF handling")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I'm not sure about this one, maybe there is a way for objtool to
detect this and not warn?
---
 arch/x86/mm/fault.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index e6c469b323cc..0ef6e3cc54d2 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -678,7 +678,7 @@ page_fault_oops(struct pt_regs *regs, unsigned long error_code,
 			      ASM_CALL_ARG3,
 			      , [arg1] "r" (regs), [arg2] "r" (address), [arg3] "r" (&info));
 
-		unreachable();
+		do { } while (1); /* unreachable */
 	}
 #endif
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/mm: avoid false-positive objtool warning in page_fault_oops()
  2024-12-17  8:30 [PATCH] x86/mm: avoid false-positive objtool warning in page_fault_oops() Arnd Bergmann
@ 2024-12-17 11:47 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2024-12-17 11:47 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dave Hansen, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, Josh Poimboeuf, Arnd Bergmann,
	H. Peter Anvin, Andrew Morton, Jason Gunthorpe,
	Suren Baghdasaryan, linux-kernel

On Tue, Dec 17, 2024 at 09:30:41AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When printing the oops for a VMAP_STACK overflow, the final call
> frompage_fault_oops() does not return to the original stack, which
> confuses gcc, and the unreachable() annotation leads to the end
> of the function just continuing on in the next one:
> 
> arch/x86/mm/fault.o: warning: objtool: page_fault_oops() falls through to next function kernelmode_fixup_or_oops.constprop.0()
> 
> To work around the warning, add an explicit endless loop here that
> objtool can detect.
> 
> Fixes: 6271cfdfc0e4 ("x86/mm: Improve stack-overflow #PF handling")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I'm not sure about this one, maybe there is a way for objtool to
> detect this and not warn?
> ---
>  arch/x86/mm/fault.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index e6c469b323cc..0ef6e3cc54d2 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -678,7 +678,7 @@ page_fault_oops(struct pt_regs *regs, unsigned long error_code,
>  			      ASM_CALL_ARG3,
>  			      , [arg1] "r" (regs), [arg2] "r" (address), [arg3] "r" (&info));
>  
> -		unreachable();
> +		do { } while (1); /* unreachable */

Ah, I have one that puts a BUG() there, like 2190966fbc14 ("x86: Convert
unreachable() to BUG()").

For some reason this hunk went missing from that patch.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-17 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17  8:30 [PATCH] x86/mm: avoid false-positive objtool warning in page_fault_oops() Arnd Bergmann
2024-12-17 11:47 ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox