linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Fix off-by-one vdso trampoline return value
@ 2020-11-12  0:14 Will McVicker
  2020-11-12  1:00 ` Nick Desaulniers
  2020-11-12 10:12 ` Will Deacon
  0 siblings, 2 replies; 7+ messages in thread
From: Will McVicker @ 2020-11-12  0:14 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon
  Cc: Will McVicker, Nick Desaulniers, Dmitry Safonov, linux-kernel,
	clang-built-linux, Andrei Vagin, Nathan Chancellor,
	Vincenzo Frascino, kernel-team, Thomas Gleixner, linux-arm-kernel

Depending on your host nm version, the generated header
`include/generated/vdso32-offsets.h` may have the bottom bit set for the
thumb vdso offset addresses (as observed when using llvm-nm). This
results in an additional +1 for thumb vdso trampoline return values
since compat_setup_return() already includes `vdso_trampoline + thumb`.
As a result, I see a SIGBUS error when running the LTP test
syscalls.rt_sigaction01. To fix this, let's clear the bottom bit of the
vdso_offset in the VDSO_SYMBOL macro.

Test: LTP test syscalls.rt_sigaction01
Fixes: f01703b3d2e6 ("arm64: compat: Get sigreturn trampolines from vDSO")
Signed-off-by: Will McVicker <willmcvicker@google.com>
---
 arch/arm64/include/asm/vdso.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/vdso.h b/arch/arm64/include/asm/vdso.h
index f99dcb94b438..a7384379e8e1 100644
--- a/arch/arm64/include/asm/vdso.h
+++ b/arch/arm64/include/asm/vdso.h
@@ -23,7 +23,7 @@
 
 #define VDSO_SYMBOL(base, name)						   \
 ({									   \
-	(void *)(vdso_offset_##name - VDSO_LBASE + (unsigned long)(base)); \
+	(void *)((vdso_offset_##name & ~1UL) - VDSO_LBASE + (unsigned long)(base)); \
 })
 
 #endif /* !__ASSEMBLY__ */
-- 
2.29.2.299.gdc1121823c-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-11-16 22:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-12  0:14 [PATCH] arm64: Fix off-by-one vdso trampoline return value Will McVicker
2020-11-12  1:00 ` Nick Desaulniers
2020-11-12  1:07   ` Nick Desaulniers
2020-11-12  2:14   ` Nick Desaulniers
2020-11-12 10:12 ` Will Deacon
2020-11-12 18:51   ` William Mcvicker
2020-11-16 22:55     ` William Mcvicker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).