summaryrefslogtreecommitdiff
path: root/src/signal/restore.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2023-02-10 11:22:45 -0500
committerRich Felker <dalias@aerifal.cx>2023-02-12 15:05:38 -0500
commit8c0c9c69a12acc0a82590d4fd64cf633ff1dedd2 (patch)
treef149f332cd257e79275d1df8d975807a1ae03f75 /src/signal/restore.c
parentfde6891e59c315e4a0ec7e69182e1d6314e3795e (diff)
downloadmusl-8c0c9c69a12acc0a82590d4fd64cf633ff1dedd2.tar.gz
musl-8c0c9c69a12acc0a82590d4fd64cf633ff1dedd2.tar.bz2
musl-8c0c9c69a12acc0a82590d4fd64cf633ff1dedd2.tar.xz
musl-8c0c9c69a12acc0a82590d4fd64cf633ff1dedd2.zip
mq_notify: rework to fix use-after-close/double-close bugs
in the error path where the mq_notify syscall fails, the initiating thread may have closed the socket before the worker thread calls recv on it. even in the absence of such a race, if the recv call failed, e.g. due to seccomp policy blocking it, the worker thread could proceed to close, producing a double-close condition. this can all be simplified by moving the mq_notify syscall into the new thread, so that the error case does not require pthread_cancel. now, the initiating thread only needs to read back the error status after waiting for the worker thread to consume its arguments.
Diffstat (limited to 'src/signal/restore.c')
0 files changed, 0 insertions, 0 deletions