From: Richard Henderson Date: Mon, 29 Aug 2022 02:10:05 +0000 (-0700) Subject: linux-user: Lock log around strace X-Git-Tag: v7.2.0-rc0~69^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5a1c6b88cad2e8c4d81b03dda48d49ea0be9cca;p=thirdparty%2Fqemu.git linux-user: Lock log around strace Do not allow syscall arguments to be interleaved between threads. Signed-off-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <20220829021006.67305-8-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- diff --git a/linux-user/strace.c b/linux-user/strace.c index faa73312562..37bc96df9bb 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -3919,26 +3919,37 @@ print_syscall(CPUArchState *cpu_env, int num, abi_long arg4, abi_long arg5, abi_long arg6) { int i; - const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")"; + FILE *f; + const char *format = "%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," + TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," + TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")"; - qemu_log("%d ", getpid()); + f = qemu_log_trylock(); + if (!f) { + return; + } + fprintf(f, "%d ", getpid()); - for(i=0;i