summaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-09-28 18:38:27 -0400
committerRich Felker <dalias@aerifal.cx>2020-09-28 18:56:20 -0400
commit34904d830a9fd1f6fc47218f38c111698303d2fe (patch)
treec43e8b5659386f5a3ed4f5e749d389f2fb91027b /src/internal
parenta5aff1972c9e3981566414b09a28e331ccd2be5d (diff)
downloadmusl-34904d830a9fd1f6fc47218f38c111698303d2fe.tar.gz
fix fork of processes with active async io contexts
previously, if a file descriptor had aio operations pending in the parent before fork, attempting to close it in the child would attempt to cancel a thread belonging to the parent. this could deadlock, fail, or crash the whole process of the cancellation signal handler was not yet installed in the parent. in addition, further use of aio from the child could malfunction or deadlock. POSIX specifies that async io operations are not inherited by the child on fork, so clear the entire aio fd map in the child, and take the aio map lock (with signals blocked) across the fork so that the lock is kept in a consistent state.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/pthread_impl.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index 4d709bbc..358ad1ce 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -162,6 +162,8 @@ extern hidden void *__pthread_tsd_main[];
extern hidden volatile int __aio_fut;
extern hidden volatile int __eintr_valid_flag;
+extern hidden void __aio_atfork(int);
+
hidden int __clone(int (*)(void *), void *, int, void *, ...);
hidden int __set_thread_area(void *);
hidden int __libc_sigaction(int, const struct sigaction *, struct sigaction *);