To simplify codegen, we require the exit stub pc to be aligned to 4 bytes. If it is not aligned, we place a 2-byte c.nop at the beginning of the exit stub. Therefore, all functions that modify the exit stub should skip the possible c.nop.
The wrongly implemented patch_stub() makes unlink_branch() not affect the exit stub, which makes the async signal handling error-prone.
Before the fix, it hits the following assertion ~1/5 times when running linux.signal0001 on a RISC-V machine, which indicates that the second signal comes from a different fragment after the unlinking, and the real reason is that the unlinking is not successful.
ASSERT signal.c:4954 info->interrupted == NULL || info->interrupted == f
It would be great if we could enable the signal tests in CI, but these tests do not work in QEMU for unknown reasons.
To simplify codegen, we require the exit stub pc to be aligned to 4 bytes. If it is not aligned, we place a 2-byte
c.nop
at the beginning of the exit stub. Therefore, all functions that modify the exit stub should skip the possiblec.nop
.The wrongly implemented
patch_stub()
makesunlink_branch()
not affect the exit stub, which makes the async signal handling error-prone.Before the fix, it hits the following assertion ~1/5 times when running
linux.signal0001
on a RISC-V machine, which indicates that the second signal comes from a different fragment after the unlinking, and the real reason is that the unlinking is not successful.It would be great if we could enable the signal tests in CI, but these tests do not work in QEMU for unknown reasons.
Issue: #3544 Related: #2328