Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#3544 RV64: Fix patch_stub for unaligned stub_pc #6711

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

ksco
Copy link
Member

@ksco ksco commented Mar 19, 2024

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.

Issue: #3544
Related: #2328

To simplify codegen, we require the exit stub pc to be aligned to 4 bytes. If it
is not aligned, we place a c.nop at the beginning of the exit stub. Therefore,
all functions that modify the exit stub should skip the possible c.nop.
@ksco ksco requested a review from derekbruening March 19, 2024 10:18
@ksco ksco merged commit b2e6177 into DynamoRIO:master Mar 19, 2024
16 checks passed
@ksco ksco deleted the i3544-fix-patch_stub branch March 19, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants