diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-03-31 13:01:05 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-04-01 10:06:38 +0200 |
commit | a59629fcc6f603e19b516dc08f75334e5c480bd0 (patch) | |
tree | 4c663417db01a79eedc121f83e176dfb7c503b93 /linux-user/syscall.c | |
parent | e65bef6954415b24ee17184b959333d9456bece8 (diff) |
rcu: do not create thread in pthread_atfork callback
If QEMU forks after the CPU threads have been created, qemu_mutex_lock_iothread
will not be able to do qemu_cpu_kick_thread. There is no solution other than
assuming that forks after the CPU threads have been created will end up in an
exec. Forks before the CPU threads have been created (such as -daemonize)
have to call rcu_after_fork manually.
Notably, the oxygen theme for GTK+ forks and shows a "No such process" error
without this patch.
This patch can be reverted once the iothread loses the "kick the TCG thread"
magic.
User-mode emulation does not use the iothread, so it can also call
rcu_after_fork.
Reported by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Tested by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r-- | linux-user/syscall.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4bd954375e..1622ad6490 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4572,6 +4572,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, ret = fork(); if (ret == 0) { /* Child Process. */ + rcu_after_fork(); cpu_clone_regs(env, newsp); fork_end(1); /* There is a race condition here. The parent process could |