Kernel Panic: General Protection Fault on syscall iretq
I specially built the kernel with -Og -g to include debugging symbols to aid determining the function where the fault happens. But, because it interferes with optimisations, I'm attaching the kernel I used to reproduce the issue and report the faulting address and thus the faulting instruction. The kernel has been built from /src from last night's volatile.
To reproduce the issue, just try doing something more demanding like compiling a project (e.g. the Sortix source code).
After disassembling the code around the faulting address, I found it's caused by the iretq instruction at https://gitlab.com/sortix/sortix/blob/staging/kernel/x64/syscall.S#L88, address 0x1028c8 in the attached kernel.
Here are the last three interrupts in the qemu log: https://gist.github.com/glauxosdever/6033e6e52bd4f4d93b36c3128be38ca3 It seems there is first a syscall, then some 0x81 interrupt, then the GPF at the iretq of the syscall.