Open thehajime opened 4 years ago
The generated code unexpectedly uses r14 register. This is the root of the cause. The below is lldb log.
[ 0.010887] FDPIC ____ LOAD 1 ____
rumpuser started.
parent pid=1, ppid=0
Process 62194 stopped
* thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0xfd)
frame #0: 0x000000010000cfc4 fork-test`thread_bootstrap.cold.1 + 148
fork-test`thread_bootstrap.cold.1:
-> 0x10000cfc4 <+148>: movq 0x8(%r14), %rax
0x10000cfc8 <+152>: movq 0x160(%rax), %r13
0x10000cfcf <+159>: movq 0x8(%r14), %rax
0x10000cfd3 <+163>: movq 0x168(%rax), %r12
Here is the workaround.
diff --git a/arch/lkl/kernel/threads.c b/arch/lkl/kernel/threads.c
index 7688e62e7b24..2aff31d68370 100644
--- a/arch/lkl/kernel/threads.c
+++ b/arch/lkl/kernel/threads.c
@@ -169,7 +169,7 @@ void inline lkl_restore_register(struct task_struct *task)
asm("mov %0, %%rsp" :: "m"(newrsp));
RESTORE_REG(r15);
- RESTORE_REG(r14);
+// RESTORE_REG(r14);
RESTORE_REG(r13);
RESTORE_REG(r12);
// RESTORE_REG(bx);
3026e15 will fix this issue.
all 11.{0,1,2,3} versions have this issue.