All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lkdtm: cfi: Fix type width for masking PAC bits
@ 2022-04-27  0:12 Kees Cook
  2022-04-27  7:14 ` Geert Uytterhoeven
  2022-04-27 22:39 ` Randy Dunlap
  0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2022-04-27  0:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Kees Cook, kernel test robot, Geert Uytterhoeven, Arnd Bergmann,
	Dan Li, linux-kernel, linux-hardening

The masking for PAC bits wasn't handling 32-bit architectures correctly.
Replace the u64 cast with uintptr_t.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/lkml/CAMuHMdVz-J-1ZQ08u0bsQihDkcRmEPrtX5B_oRJ+Ns5jrasnUw@mail.gmail.com
Fixes: 2e53b877dc12 ("lkdtm: Add CFI_BACKWARD to test ROP mitigations")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/misc/lkdtm/cfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm/cfi.c b/drivers/misc/lkdtm/cfi.c
index 804965a480b7..666a7f4bc137 100644
--- a/drivers/misc/lkdtm/cfi.c
+++ b/drivers/misc/lkdtm/cfi.c
@@ -59,7 +59,7 @@ static void lkdtm_CFI_FORWARD_PROTO(void)
 #endif
 
 #define no_pac_addr(addr)      \
-	((__force __typeof__(addr))((__force u64)(addr) | PAGE_OFFSET))
+	((__force __typeof__(addr))((uintptr_t)(addr) | PAGE_OFFSET))
 
 /* The ultimate ROP gadget. */
 static noinline __no_ret_protection
-- 
2.32.0


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

end of thread, other threads:[~2022-04-27 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27  0:12 [PATCH] lkdtm: cfi: Fix type width for masking PAC bits Kees Cook
2022-04-27  7:14 ` Geert Uytterhoeven
2022-04-27 22:39 ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.