[U-Boot] [PATCH 04/10] ARM: allocate extra space for PSCI stack in secure section during link phase

Chen-Yu Tsai wens at csie.org
Mon May 23 14:41:40 CEST 2016


The PSCI implementation expects at most 2 pages worth of space reserved
at the end of the secure section for its stacks. This was not properly
marked and taken into consideration when reserving memory from the
kernel.

If one accesses PSCI after Linux has fully booted, the memory that should
have been reserved for the PSCI stacks may have been used by the kernel
or userspace, and would be corrupted. Observed after effects include the
system hanging or telinit core dumping when trying to reboot. It seems
the init process gets hit the most on my test bed.

This fix is only a stop gap. It would be better to rework the stack
allocation mechanism, maybe with proper usage of CONFIG_ macros and an
explicit symbol.

Signed-off-by: Chen-Yu Tsai <wens at csie.org>
---
 arch/arm/cpu/u-boot.lds | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index cfab8b041234..c7f37b606ad5 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -67,6 +67,9 @@ SECTIONS
 		SIZEOF(.__secure_start) +
 		SIZEOF(.secure_text);
 
+	/* Align to page boundary and skip 2 pages */
+	. = (. & ~ 0xfff) + 0x2000;
+
 	__secure_end_lma = .;
 	.__secure_end : AT(__secure_end_lma) {
 		*(.__secure_end)
-- 
2.8.1



More information about the U-Boot mailing list