From patchwork Fri Oct 27 22:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 738706 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp117481wrt; Fri, 27 Oct 2023 15:12:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEG424hOQQDOtw4+EWvxR+LSxHEYeYjsT0fIwZU9tfEME/rVlx008/15KoHI4TBI7gaREZp X-Received: by 2002:a05:6808:1509:b0:3b2:e32f:fddd with SMTP id u9-20020a056808150900b003b2e32ffdddmr4689315oiw.43.1698444774947; Fri, 27 Oct 2023 15:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698444774; cv=none; d=google.com; s=arc-20160816; b=l1bCTya5WfvZPT9owD/OclwigGItqpUqfD9E7WFeUsCPW1fZ9t0CgGhYnMvDBjyEGy qQcilUyjCqX0GanbCvJGoDewLuUFj0ZrxlFKlOVNu10GTfOxpZLlcPwtBuyQgx5IxBKR 650aC7WAKFxKwlw2/xp6jIuVRnB+4o6PhPqcb1mySSzxdAnmxSejtpoQCFfx1jC/Z4GM bkQm9I4yIrdevwlB9mo7aGx7Ij3P3KJgz3nZBxsUIBIZioJbxC3+KWqvNq24msz/FnZa AABtNohYmC0fSmgRwE6osp1RM0E57JSDROl5FsW7Vz08yXWbLxywn6LkRyKKp0vnzXRD f1Yg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=sRY84Su7XMV7uRNIb1/RJ3dBq2s8KkQA/2NcctEFcXo=; fh=+RwbVpxGD43otR2KgodZemhcaWKtqPldkbNhRWOVPjs=; b=Qs1KTFuxcoibPtVWHdes9/bK3hLzaNfumGE8FWqAcFNG+rVWKMVMrbO36Rrhw4gorS KCqGmgHM8cn2OI26np/rjoapMlnPqXP3wqtG6QLBeRVrWxUtmC1BCaYXq7BXME5Exp11 NXdU2IN46aCeyYsvq/kNdLml6m0GOsIz61KdX68OnGoB9aRhd/l2sx65kiRfh90XwXx+ LuyHyugN0WWYd8Ss90EjD3NMxZoaOurxUbSlflxKG++/eL2rwSFUHDf/0MK3XDfbSwYi So5bxTMiUJcLvEr5NM/g4dnzG+s2zeOB9ThA0HUPqiRcEIQfSh9UD57QE6n2PjgI8otS sH/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CkJ3PrmO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b15-20020a05620a088f00b00777449886basi1193000qka.572.2023.10.27.15.12.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Oct 2023 15:12:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=CkJ3PrmO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwV3c-0007RL-4S; Fri, 27 Oct 2023 18:11:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwV3b-0007RD-8t for qemu-devel@nongnu.org; Fri, 27 Oct 2023 18:11:55 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qwV3Z-0003on-IW for qemu-devel@nongnu.org; Fri, 27 Oct 2023 18:11:55 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-27d3ede72f6so2172800a91.1 for ; Fri, 27 Oct 2023 15:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698444711; x=1699049511; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sRY84Su7XMV7uRNIb1/RJ3dBq2s8KkQA/2NcctEFcXo=; b=CkJ3PrmOwVwHnUHbYDQHbsZHMxxnXDLyQKZYW5bG1DDr28Pe8wHLkMaxlrFm2H6FqU jkoK8lAQkI6c/rx2vwaWps8eginno/bQDiE+TQEJFyo8puDfw3grZkjrF9TLj1F45K5E Tbotf++4YB2YGzhZVZDH3olJ2skoiYiK0+irNj3/+hzwVfEnF/LQBsoQq1q9WUG4FVIu YGsYHA3RQuLUvDcdVs80JqwFnoqTmz35gHOWerGaB+TDSla/mxsnp0gBsSE8awf/R5np XFdj7HNTnvulPpcV0gTm8njcF7gH4GfEGpMtaoMPHvm3O8vIUU97QwKmMC5U9iSq0R21 TdTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698444711; x=1699049511; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sRY84Su7XMV7uRNIb1/RJ3dBq2s8KkQA/2NcctEFcXo=; b=O37hPHEV4W4j1S+yj9uVb02EVrLHV1KQvzbYU7/0KzLUuAwLd2pM2w9ntrHQIb5yZd J7bPbAXxBLEkghOuYi8eVLHhtdP3X4s/l0HxCyvaFrM7+p0scnEgOEJX5iIFvJslmieh eggE2YAnI1I1+MoGRc0ieTQPvuSvfgCsfUt3V5WvgaCNk4oHbRkaNhDHEiDphPObYJ3p 4polCOuu+cacM59h2FNdkOvAQSs5zsY9oix/EYsaInOz1J1NLufEUDA++QCqoNCQRFhs GSAGwgyS2JBRVvMinjlOQm/KYNj7ROZLP05dOEDVP0yBKOqrVOvEZBkcXItGEGAouo4p smpw== X-Gm-Message-State: AOJu0YwS2dILzNka4YURG8oWnMqIJ3/E4zuoQcCD9TSOUUU8aj7y9aFT ea9TopU+PdlGMR9E8MkhDPoLKCpf03VjQpbK2mA= X-Received: by 2002:a17:90b:f06:b0:27d:694f:195d with SMTP id br6-20020a17090b0f0600b0027d694f195dmr3890744pjb.6.1698444711449; Fri, 27 Oct 2023 15:11:51 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id p20-20020a17090ad31400b0026cecddfc58sm3674768pju.42.2023.10.27.15.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 15:11:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: christophe.lyon@linaro.org, laurent@vivier.eu Subject: [PATCH] linux-user: Fix guest signal remapping after adjusting SIGABRT Date: Fri, 27 Oct 2023 15:11:50 -0700 Message-Id: <20231027221150.19807-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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-bounces+patch=linaro.org@nongnu.org The arithmetic within the loop was not adjusted properly after SIGRTMIN was stolen for the guest SIGABRT. The effect was that the guest libc could not send itself __SIGRTMIN to wake sleeping threads. Fixes: 38ee0a7dfb4b ("linux-user: Remap guest SIGABRT") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1967 Signed-off-by: Richard Henderson --- linux-user/signal.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 3b8efec89f..b35d1e512f 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -536,11 +536,10 @@ static void signal_table_init(void) host_to_target_signal_table[SIGABRT] = 0; host_to_target_signal_table[hsig++] = TARGET_SIGABRT; - for (; hsig <= SIGRTMAX; hsig++) { - tsig = hsig - SIGRTMIN + TARGET_SIGRTMIN; - if (tsig <= TARGET_NSIG) { - host_to_target_signal_table[hsig] = tsig; - } + for (tsig = TARGET_SIGRTMIN; + hsig <= SIGRTMAX && tsig <= TARGET_NSIG; + hsig++, tsig++) { + host_to_target_signal_table[hsig] = tsig; } /* Invert the mapping that has already been assigned. */