]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/scs: Fix handling of DWARF augmentation data in CIE/FDE frames
authorArd Biesheuvel <ardb@kernel.org>
Wed, 6 Nov 2024 18:55:15 +0000 (19:55 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 8 Nov 2024 16:37:55 +0000 (16:37 +0000)
commitccf54058f5328e6da5ecc61c961bf68bbb7d865b
treef079da385aeae985d013b549266a4beee9710321
parent8e929cb546ee42c9a61d24fae60605e9e3192354
arm64/scs: Fix handling of DWARF augmentation data in CIE/FDE frames

The dynamic SCS patching code pretends to parse the DWARF augmentation
data in the CIE (header) frame, and handle accordingly when processing
the individual FDE frames based on this CIE frame. However, the boolean
variable is defined inside the loop, and so the parsed value is ignored.

The same applies to the code alignment field, which is also read from
the header but then discarded.

This was never spotted before because Clang is the only compiler that
supports dynamic SCS patching (which is essentially an Android feature),
and the unwind tables it produces are highly uniform, and match the
de facto defaults.

So instead of testing for the 'z' flag in the augmentation data field,
require a fixed augmentation data string of 'zR', and simplify the rest
of the code accordingly.

Also introduce some error codes to specify why the patching failed, and
log it to the kernel console on failure when this happens when loading a
module. (Doing so for vmlinux is infeasible, as the patching is done
extremely early in the boot.)

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20241106185513.3096442-6-ardb+git@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/scs.h
arch/arm64/kernel/module.c
arch/arm64/kernel/pi/patch-scs.c