Skip to contentSkip to conversation

src/nsexec: fix stack pointer alignment exception

PATCH Superseded Zorro Lang 1 participant 1 message Sep 29, 2017

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH v2 1/1 src/nsexec: fix stack pointer alignment exception

When test g/317 or g/318 on ARM server, we got a kernel exception:

kernel: nsexec[8203]: SP Alignment exception: pc=00000000004010a0 sp=00000000005200e8

nsexec gives an unaligned child stack address to clone() system call sometimes. For making sure it's always aligned, use "__attribute__((aligned))" extension of GCC (Thanks this suggestion from Eric sandeen).

---

V2 move the "__attribute__((aligned))" after array name, for following common "__attribute__" usage.

Thanks,
Zorro

 src/nsexec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/nsexec.c +2 -1
index f033b1a4..205dd081 100644
@@ -138,7 +138,8 @@ childFunc(void *arg)
 
 #define STACK_SIZE (1024 * 1024)
 
-static char child_stack[STACK_SIZE];    /* Space for child's stack */
+/* Space for child's stack */
+static char __attribute__((aligned)) child_stack[STACK_SIZE];
 
 int
 main(int argc, char *argv[])
Signature · 1 line
2.13.6