From patchwork Wed Sep 28 20:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 610100 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp510690pvb; Wed, 28 Sep 2022 14:14:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49Fz9q8v23OiA4YAQORkJVFwGPIP2jIUrsxGJqild3Yt8YyYvCjmFgCOb1Y+WmX4xUcrbZ X-Received: by 2002:a05:6214:5e89:b0:4ad:77be:92d2 with SMTP id mm9-20020a0562145e8900b004ad77be92d2mr46116qvb.44.1664399656951; Wed, 28 Sep 2022 14:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664399656; cv=none; d=google.com; s=arc-20160816; b=QIAFt2LESDa7dKHZXpORGtYzqluVs2DI6EQ4yVKQ6mdtdoENqsTjyfENjeU5iHjX6d aZIPolAdfH7vhZb3trVo+TrV2aMPFp1dZ2xGBoW2XNVEMgpM1KrPaMqvP7FBqiY5k9j4 HZ9reubNlwsWG3SlNoHzmN6JVDsEHEMaSrwojKGysjcoOidPhh1B7LizcioUDCW0wIs2 EbV10r7XzEVAt1yIvAkaaIMUcREV+Ac8+48EYkqUI+idf15+mO7mv9GDAateqRHQ/hrk mmOFDdFDn6EB8+1ZTdEbuFB6FcTCq62gyKmkY405q63+Jf0N3QBaWFK/bfngPCFCzj6r INqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=c2yVu58Igc/rF97GdGSBnNGv+o/zkcCaimjjWk4smDs=; b=vhAEAC1vr9YTMth7hKR4pIIZ9saD1kHUj+Wx/1v7leuF88Q4T2ef2BhmI8tcnJaTzB JHsUKdkzpib2iQ36vdgXPjN9wHjOMR1btwOdhqwHpNkNcOEOZAVPePCgMhx1ui1ABhem d1K0AJieY0NIRv+mNEGw9YcFZ2tfckBpSf5zht80yeQKiIcXLE59UsyR59RJoZN78vf5 10sP26o/2liv1gRZY+6Uu/m1IEFIMIJg5OBV28936BUVrFp9oJMKi2m76V6DZMr4xFTc 3AepYg34NTBny5Z8oW3ANjW2dOIIO20IBw3dJyzxC8PN8YEeXx1ZQc0w4p6RVvk62BwK duyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f4-20020a05620a408400b006b8ef971f17si285199qko.420.2022.09.28.14.14.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Sep 2022 14:14:16 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:36224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odeNk-0007mr-H6 for patch@linaro.org; Wed, 28 Sep 2022 17:14:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oddf7-0000nr-S3 for qemu-devel@nongnu.org; Wed, 28 Sep 2022 16:28:09 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:40413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oddf5-0006Yq-9u for qemu-devel@nongnu.org; Wed, 28 Sep 2022 16:28:09 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MaInF-1ohGHQ0IwX-00WAlb; Wed, 28 Sep 2022 22:28:05 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Richard Henderson , Laurent Vivier Subject: [PULL 36/37] linux-user: Lock log around strace Date: Wed, 28 Sep 2022 22:27:36 +0200 Message-Id: <20220928202737.793171-37-laurent@vivier.eu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928202737.793171-1-laurent@vivier.eu> References: <20220928202737.793171-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:ICkfNbLA3GARt9rmqMcZa7OiDge8auiR8jnvWVpmopwJz/D8/G7 o/kKuoe6V5kEysrqjZNXg8YP9SHUo2H84wQvCpMwu/EXAOIsyyeDcycXFAYuGGBMBWSMswU Fw9eO2RsOGg+E+KdRfutSOF50zVMhix/+BLwNtMqklSbd94weXAC+hvV9M9zKbXx3bFGTfD e6mi95iZcSruNwJvqi7zw== X-UI-Out-Filterresults: notjunk:1;V03:K0:7hhY9wMUQAU=:VEuOuG2sExr9lbVtUeJJrU 8g1PnfZfby/8Waq60zgT+I6+R6c8VXxAg2n1TNtSgmLDnhemSNG/LvS0pZBfrlPqpfRHkjwJd F6RSNWdoiQtEFbVgrmFxLyQYzymi5t8XU1MiHsdliaVhkil3u/SH5tXaL6LgufessOma167m1 ENEuq58Q8tuLegW3afDtm4ASNO79Y9BGJP9KqGuo1JfXy9IFRmG7hFHa8gEstEUD+PE3Zuyw2 ERlaKuCU0jaU+fXrZUvyOMISeVN6q7xMoiQKCUmbtnkAjtgCabm7q7od/g/8FY7eudIY+OcsD N21zVr/pdl4R5Vzwy/qBuSMSa5/LCr14+t6VgrmuwuRrXIj+grjKXqDZpKcqAHR/qM6OMYLMQ Ep3zVP83BW0tARegEjdJeFR9wLexTUgQWXFYk2l+6WlztOpAFxo0gRQQ4OVzJDl6AkRFDZahc 8nKJbqwljfyoY7kuwnyWm8o//dwqkbk9elH5H956W40/U51Hj0D6Lr6KXlk3kjyEf54bpaTJ0 JE3L/D56pxnyVfr3SJb8NiRmLfhr3Nm4nSR4lTKHh8JsObT7gB607IF3D5Ie9x7b3QKbqj30A KcF29xicxnQKM432tVj6zG3+uYl4sIIMREbUHVMoWfeq/MHQwSb/YsNhtrw3+sGgymUF78peL kfFFwuzBbftjChtPsmeJWfvTMfsSO0jZ6GY+bWQXN0ScbBWM99G6kJRlayYJCZ+zEq+x4jDEJ aot48RX84LN294U9N1pz0yiprz35hS4JvmI0v/8PIie3CCH/czmJFaOASPkDBjt6Okefqt5/1 yLt04ko Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 --- linux-user/strace.c | 65 ++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index faa733125624..37bc96df9bb6 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