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

Segfault the guest process when we encounter an unaligned atomic cmpxchg8b #1667

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

kmeisthax
Copy link
Contributor

Like #1429, but less wrong.

My prior PR misinterpreted certain paragraphs of Intel's processor documentation. Unaligned lock cmpxchg8b maintains atomicity regardless of alignment; this is not emulatable with ARM atomics alone. Properly emulating this requires a complicated locking setup that would almost certainly harm the performance of well-behaved x86 processes. In fact, I'm pretty sure the prior PR never worked - I've noticed this crash doesn't always occur when you launch mariadbd; and it's entirely possible that I was just getting very lucky with heap allocations that just so happened to align whatever packed structs are there.

So, instead, here's a new PR that triggers a segfault on unaligned atomic access. This will keep the user from losing any other work they might have been doing in other guest processes.

emkey1 pushed a commit to emkey1/ish-AOK that referenced this pull request Dec 27, 2021
…hax/ish into AOK

Incorporate kmeisthaxs pending PR in upstream/mainline to catch unaligned cmpxchg8b instructions. Upstream PR ish-app#1667
@tbodt
Copy link
Member

tbodt commented Jan 4, 2022

LGTM, thanks!

@tbodt tbodt merged commit b74ec82 into ish-app:master Jan 4, 2022
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