]> git.proxmox.com Git - mirror_qemu.git/commit
linux-user: Make sigaltstack stacks per-thread
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 25 Jul 2019 13:16:45 +0000 (14:16 +0100)
committerLaurent Vivier <laurent@vivier.eu>
Fri, 26 Jul 2019 17:24:33 +0000 (19:24 +0200)
commit5bfce0b74fbd5d53089bb866919d685c47edad9e
tree7b352053272100d776034988ef56d2241afba8db
parentfff3159900d2b95613a9cb75fc3703e67a674729
linux-user: Make sigaltstack stacks per-thread

The alternate signal stack set up by the sigaltstack syscall is
supposed to be per-thread.  We were incorrectly implementing it as
process-wide.  This causes problems for guest binaries that rely on
this.  Notably the Go runtime does, and so we were seeing crashes
caused by races where two guest threads might incorrectly both
execute on the same stack simultaneously.

Replace the global target_sigaltstack_used with a field
sigaltstack_used in the TaskState, and make all the references to the
old global instead get a pointer to the TaskState and use the field.

Fixes: https://bugs.launchpad.net/qemu/+bug/1696773
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20190725131645.19501-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/hppa/signal.c
linux-user/main.c
linux-user/qemu.h
linux-user/signal-common.h
linux-user/signal.c