orbis: propagate SIGSEGV, SIGBUS and SIGFPE in userspace to guest handler

fix minor race
fix signal delivery without handler freeze
This commit is contained in:
DH 2025-09-21 09:13:21 +03:00
parent 70fa577a7b
commit f7651d7eae
4 changed files with 96 additions and 39 deletions

View file

@ -325,14 +325,14 @@ void Thread::sendSignal(int signo) {
}
}
if (pthread_sigqueue(getNativeHandle(), SIGUSR1, {.sival_int = signo})) {
perror("pthread_sigqueue");
}
// TODO: suspend uses another delivery confirmation
if (signo != -1) {
interruptedMtx.store(1, std::memory_order::release);
if (pthread_sigqueue(getNativeHandle(), SIGUSR1, {.sival_int = signo})) {
perror("pthread_sigqueue");
}
while (interruptedMtx.wait(1, std::chrono::microseconds(1000)) !=
std::errc{}) {
if (interruptedMtx.load() == 0) {
@ -343,6 +343,10 @@ void Thread::sendSignal(int signo) {
perror("pthread_sigqueue");
}
}
} else {
if (pthread_sigqueue(getNativeHandle(), SIGUSR1, {.sival_int = signo})) {
perror("pthread_sigqueue");
}
}
}