From patchwork Tue Mar 8 15:02:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 549290 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp2716596mag; Tue, 8 Mar 2022 07:12:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK+MtIG76dTxmyimrdV9PsmqHyECDGk7KT2+8xEM75ZBLdzEQ8uneQgw1dWErh/aWOxIWq X-Received: by 2002:a0d:d244:0:b0:2d7:9fa7:fc26 with SMTP id u65-20020a0dd244000000b002d79fa7fc26mr13482567ywd.478.1646752333965; Tue, 08 Mar 2022 07:12:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646752333; cv=none; d=google.com; s=arc-20160816; b=XHfq2SFqF1FfiOW8FPRRo39TWame4G71o0sBJfp64jVq4t7ZmOMQi2x9llgzsQ0bVR DuR+UXgbrRtwRszRX7BD6q9a54c2IOIOASGVA49AWDNtsec4qmU9Oev9VQI/Xz6S4fGB o9gMm75wFgeKDmD/KQ0gFf8NdMfrAr0DULgcuLY9c4sCU3BuxchcCKVfrO3PEdjjhP6+ LNX8cD1XtlB2ApX0P5lTjmHm7Wox4EFIDrDOK0+7RP27QboimHF0XjQ8XzEQgiTDWOt3 VIIOyXa8ec9YiFRbe4caTg67m8ibpfb6ipcSDruFhjxJpXmJAQTOXsFtQbbeVHb6fop8 2nag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from; bh=XpB1kQI1MSgGiMZ1JQBqtyMA6WatlU5MGZp1x5Y6w9k=; b=MIJJ5Q2cxVYDMYV/wEFEkABZfWzZRl7PXE6pCRiPuBsAQvJ0NlI6oeHRN+l+GY03K3 au8JDKLCOeEtYkasZHuPM1lPZRO3Tdl5iEW/UTiuddUbdmb0y8GMbxBmn4hRioIAqeSN 5wGJQP9v5aUWC9gR0rgVhVdhyMdWQq86tCCB7a3IBzMhR1+23QfUirk0C77CpYhv2nhs d47TpMoSzX3u9NkiadPIXpsOEzddPGrwUEqqKJfTcsxB61IQalBv0FkPzz4NGUFkMzON F720vtmb6RFqrV+paS1nDO1YgwaziloBtmj9lSvur4OWZNBoNbfEP+5Pnhj1tWo62qMh IP8g== 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 n63-20020a25da42000000b00628644f10e0si13102480ybf.570.2022.03.08.07.12.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Mar 2022 07:12:13 -0800 (PST) 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]:51176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRbVV-00046B-Hf for patch@linaro.org; Tue, 08 Mar 2022 10:12:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRbMJ-0006p9-2O for qemu-devel@nongnu.org; Tue, 08 Mar 2022 10:02:43 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:34081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRbMB-0001P5-7i for qemu-devel@nongnu.org; Tue, 08 Mar 2022 10:02:40 -0500 Received: from quad ([82.142.8.122]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mc0Aj-1o1EDo0rNf-00dVc1; Tue, 08 Mar 2022 16:02:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/3] linux-user: Remove stale "not threadsafe" comments Date: Tue, 8 Mar 2022 16:02:26 +0100 Message-Id: <20220308150228.1616561-2-laurent@vivier.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220308150228.1616561-1-laurent@vivier.eu> References: <20220308150228.1616561-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:g0/m7rk5vgMpUu+DmJ4kO/QPFY6DXLwcCyecfVQ7Aih7NFunlJ7 s/O7n8B+yKXrg2nIZp+nPxOsPhDCv604zMxlHYrhwkJ1GupY6iTy0GGmAP4UZkK0AZNxH1y PTpbEy7eMbmRFCpoviCEfEJmLakupxT9VOXxHADxP33pBVxFvKpn1O9m6jip8rlEZMtun9N XE9bjAF1VB/KG+NpFKIhg== X-UI-Out-Filterresults: notjunk:1;V03:K0:LzK3DYsLtJw=:YqFSzsJcTivoiku3HaGCwJ ke9x4+iNcNvOKtcGcG4E7Sxvt9vDlmAAVtltHAlaJT+NdhtM15T9KznXoCZRN9WIQ65xtMXSO FSmriWdqMN7HXPla6m8VMDJT8yafXheGzgndNVbxt3H2wc+/vexWJMbf2fT/WP0u+BkLuTD8q UZ6358R0QryLQIHZS9m4rkApn1mgiFcGi7DOVAut8RDIpPR+kI/cWEJt2tiD1kkOiKtuwN2MU jGu76TD4ChVSKb3JKRG5Znp/MffwoNtrGQLkOnjBuw8DWGsaTce6RtHiehMhYvsyex3qH9Ogu aylY3XVWD7qEAPFcEqta/DSm1LnfsdsBBpW7JqddvKlBya8bGeQcPQSK36Ltnd2GfwY7GQ4s8 5ie2ENPIAHyWNnABRkXdmI1kAus34KQlbKSOyqnuHNAUlLzNZiKdGcz+EpYaluJjMoUPYr1hp O7k08BlpooPvFTiWAnM1+S5DUFO/44YjbGPExKrysW2xTpxazbN/oPVkH6tE97Z4ti/25y84o 2VPiD7Ay3kKdN7wnrwtn1VScSx1qcY/uAf12adgwOgfLMpVgWJ0SUPfUDqJEELLXKvM19UFCH sG15PkBmp2LMFGMqQVcqr9wFoIrnK/yDO4Rc2fNchug7EyCbWS2Ti48O6L6j6h7cLxURVyTKl ooHfyQc7LBs+Mu95rv47U4RHuVwel5nFzKA1/CGC+Yi6/3NuL/7+12tmBk3Cj/DHq4sM= Received-SPF: none client-ip=212.227.17.13; 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_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In linux-user/signal.c we have two FIXME comments claiming that parts of the signal-handling code are not threadsafe. These are very old, as they were first introduced in commit 624f7979058 in 2008. Since then we've radically overhauled the signal-handling logic, while carefully preserving these FIXME comments. It's unclear exactly what thread-safety issue the original author was trying to point out -- the relevant data structures are in the TaskStruct, which makes them per-thread and only operated on by that thread. The old code at the time of that commit did have various races involving signal handlers being invoked at awkward times; possibly this was what was meant. Delete these FIXME comments: * they were written at a time when the way we handled signals was completely different * the code today appears to us to not have thread-safety issues * nobody knows what the problem the comments were trying to point out was so they are serving no useful purpose for us today. Signed-off-by: Peter Maydell Reviewed-by: Alex Bennée Reviewed-by: Warner Losh Message-Id: <20220114155032.3767771-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/signal.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 27a0ff30e971..2a3f3cc23f92 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -999,7 +999,6 @@ int do_sigaction(int sig, const struct target_sigaction *act, oact->sa_mask = k->sa_mask; } if (act) { - /* FIXME: This is not threadsafe. */ __get_user(k->_sa_handler, &act->_sa_handler); __get_user(k->sa_flags, &act->sa_flags); #ifdef TARGET_ARCH_HAS_SA_RESTORER @@ -1149,7 +1148,6 @@ void process_pending_signals(CPUArchState *cpu_env) sigset_t *blocked_set; while (qatomic_read(&ts->signal_pending)) { - /* FIXME: This is not threadsafe. */ sigfillset(&set); sigprocmask(SIG_SETMASK, &set, 0);