[PATCH v3 1/4] arm64: assembler: Force error on misuse of .Lframe_local_offset
Ard Biesheuvel
ardb at kernel.org
Fri Dec 9 07:20:45 PST 2022
The frame_push macro sets a local symbol .Lframe_local_offset to the
offset where the local variable area resides in the stack frame.
However, while we take care not to nest frame_push and frame_pop
sequences, .Lframe_local_offset retains its most recent value, allowing
it to be referenced erroneously from outside a frame_push/frame_pop
pair. So set it to an obviously wrong value that is guaranteed to
trigger a link error in frame_pop.
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
arch/arm64/include/asm/assembler.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index e5957a53be3983ac..1c04701e4fda8458 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -758,6 +758,7 @@ alternative_endif
.endif
ldp x29, x30, [sp], #.Lframe_local_offset + .Lframe_extra
.set .Lframe_regcount, -1
+ .set .Lframe_local_offset, frame_local_offset_error
.endif
.endm
--
2.35.1
More information about the linux-arm-kernel
mailing list