u-boot-brain/arch
Lukas Auer 6b20dc165e riscv: increase stack size to avoid a stack overflow during distro boot
This fixes a problem, where booting Linux using distro boot will
sometimes lead to an invalid instruction exception on the main hart. The
secondary harts are not affected and boot Linux successfully. The root
cause of this problem is a stack overflow on the main hart.

With distro boot, the current default stack size of 8KiB on RISC-V is
not sufficient and will cause a stack overflow. The stacks are allocated
sequentially. In the case of a stack overflow the stack of the main hart
can reach into that of another hart and be corrupted.

The stack overflow previously did not cause any problems, because only
stack frames, which are not used anymore since the hart enters Linux,
were corrupted. Starting with GCC 9, the stack usage has decreased. Now,
only the most recent stack frame overflows into the stack of a secondary
hart and is corrupted. The illegal instruction exception is caused by
the secondary hart overwriting the return address in the stack frame of
the main hart with an address that does not include valid code.

Increase the default stack size of each hart to 16KiB to avoid this
problem.

Reported-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Rick Chen <rick@andestech.com>
2019-12-10 08:23:10 +08:00
..
arc common: Move enable/disable_interrupts out of common.h 2019-12-02 18:25:01 -05:00
arm arm: -march=armv5t for ARM11 2019-12-09 10:36:00 -05:00
m68k common: Move trap_init() out of common.h 2019-12-02 18:25:25 -05:00
microblaze common: Move enable/disable_interrupts out of common.h 2019-12-02 18:25:01 -05:00
mips Merge branch '2019-12-02-master-imports' 2019-12-02 22:05:35 -05:00
nds32 common: Move enable/disable_interrupts out of common.h 2019-12-02 18:25:01 -05:00
nios2 common: Move enable/disable_interrupts out of common.h 2019-12-02 18:25:01 -05:00
powerpc common: Move some board functions out of common.h 2019-12-02 18:25:21 -05:00
riscv riscv: increase stack size to avoid a stack overflow during distro boot 2019-12-10 08:23:10 +08:00
sandbox common: Move command functions out of common.h 2019-12-02 18:25:02 -05:00
sh common: Move enable/disable_interrupts out of common.h 2019-12-02 18:25:01 -05:00
x86 x86: simplify ljmp to 32-bit code 2019-12-08 19:10:21 +08:00
xtensa common: Move interrupt functions into a new header 2019-12-02 18:25:00 -05:00
.gitignore
Kconfig sh: r2dplus: Enable OF control 2019-09-02 17:38:43 +02:00