mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
signal: fix race in Signal_receiver pending_signal
In the past, we had the lock of the context we found for the rest of the scope of pending_signal. Now we use for_each_locked to find the context and the lock is released as soon as we return from for_each_locked. Thus, we need to lock the context again before returning it to avoid that the copy constructor during the return reads values that are currently changing. Fixes #2532
This commit is contained in:
parent
bf60e1486d
commit
b812179e82
@ -175,6 +175,7 @@ Signal Signal_receiver::pending_signal()
|
||||
throw Context_ring::Break_for_each();
|
||||
});
|
||||
if (result.context) {
|
||||
Lock::Guard lock_guard(result.context->_lock);
|
||||
if (result.num == 0)
|
||||
warning("returning signal with num == 0");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user