lkdtm: cfi: Fix type width for masking PAC bits

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: 2e53b877dc ("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>
This commit is contained in:
Kees Cook 2022-04-26 17:09:11 -07:00
parent 2e53b877dc
commit 2a0338769f
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ static void lkdtm_CFI_FORWARD_PROTO(void)
#endif #endif
#define no_pac_addr(addr) \ #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. */ /* The ultimate ROP gadget. */
static noinline __no_ret_protection static noinline __no_ret_protection