[PATCH v2 2/2] arm64: hibernate: use a typed entry to drop __nocfi
Catalin Marinas
catalin.marinas at arm.com
Wed Nov 18 10:33:32 PST 2026
On Wed, Nov 11, 2026 at 03:26:05PM -0800, Ben Cressey wrote:
> swsusp_arch_resume() calls the safe page's copy of
> swsusp_arch_suspend_exit() indirectly, without a kCFI check. The MMU is
> on at the call and TTBR0 maps only that page. The copy starts at the
> page's first byte, so the check's load of the type hash in front of it
> would fault. SYM_CODE_START() also gives the routine no hash.
> Commit e2f8216ca2d8 ("arm64: Set __nocfi on swsusp_arch_resume()")
> disabled the check "for now", since the entry had to be first
> in .hibernate_exit.text.
>
> SYM_TYPED_FUNC_START() emits the hash inside that section, and
> create_safe_exec_page() already copies the whole section, at most 4 KiB,
> to the page's start, so the page holds both hash and entry. Relax the
> linker script's ASSERT, so the entry need only be in the section.
>
> Fix by typing the routine, with a C prototype, entering the copy at the
> symbol's offset in the section, and dropping __nocfi.
>
> Suggested-by: Mark Rutland <mark.rutland at arm.com>
> Link: https://lore.kernel.org/linux-arm-kernel/arZSe8hNnRPM5FqY@J2N7QTR9R3.cambridge.arm.com/
> Signed-off-by: Ben Cressey <ben at cressey.dev>
Acked-by: Catalin Marinas <catalin.marinas at arm.com>
More information about the linux-arm-kernel
mailing list