Le 25/07/2019 à 15:16, Peter Maydell a écrit : > 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.mayd...@linaro.org> > --- > I've marked this as "for-4.1" but it is quite late in the release > cycle and I think this could use more testing than I have given it... > > Thanks are due to: > * the original bug reporter, for providing a nice simple test case > * rr, for allowing me to capture and forensically examine a single > example of the failure > * the Go project for having a good clear HACKING.md that explained > their stack usage and mentioned specifically that signal stacks > are per-thread (per-M, in their terms) > * a colleague, for prodding me into actually spending the necessary > two days grovelling through gdb sessions and logs to figure out > what was actually going wrong > --- > linux-user/qemu.h | 2 ++ > linux-user/signal-common.h | 1 - > linux-user/hppa/signal.c | 3 ++- > linux-user/main.c | 5 +++++ > linux-user/signal.c | 35 +++++++++++++++++++---------------- > 5 files changed, 28 insertions(+), 18 deletions(-)
Tested-by: Laurent Vivier <laur...@vivier.eu> Reviewed-by: Laurent Vivier <laur...@vivier.eu> This patch seems also to fix failure of LTP test waitpid02. Thanks, Laurent