From patchwork Mon Oct 30 21:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 739284 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c47:0:b0:32d:baff:b0ca with SMTP id n7csp1337118wrt; Mon, 30 Oct 2023 14:20:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4KW3E6N7s1dJ25qQgxgLlXt5YcL6CqLja0zUO6OsFN/6naKfsFi1QsP53UUsjmvGwxWC9 X-Received: by 2002:a05:6808:4c:b0:3a8:7c67:7cd with SMTP id v12-20020a056808004c00b003a87c6707cdmr10326634oic.24.1698700815707; Mon, 30 Oct 2023 14:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698700815; cv=none; d=google.com; s=arc-20160816; b=foyHZM7kqiZa9rxPAUw8KHrT+G9vyTLJGmWfkowm2Di/Ik92EGVejiIHDdDWrwxJ/l ks7S5aHvqCOFziKf5epTiAbY9IPIUEEUom/9kjYpwllE/aMYXfid6X8JL45rfG9klK2/ gsgbflCclWHgbL3veM7QRJRgJhR3zntHrx0WbXMSozKcFYMfdXnZJQEjybjJ0lLAsvEy DNzfdlKR3Ph+LsPhhPQQO6T51vqiTmBFfRny4RfG/9izo5ef96jJmoKIcxyVw+lt3GTJ NVcUKeW2otSC8q+97XTNiS+/NUmfg8ch1AKtw6sqAQtMKASF5poAlVXCa1umP94MvrvE TPCw== 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:dkim-signature; bh=DJYOGFevT1c73O/W4pBjxGvOP2r/M3Vo19QIR1W5oz0=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=kU9dlBpScQCda1cTQxVW2018MtwNUZ1YBmGKxXSU/g7DuCOoHcIJhrlJ64L7e4XuMv bYpZkS6M+Ptc5CNeswWdfxQ5B0tTQwBG1+W1zc3D6q77bfue2if2uxYiZYO+FvFjlt2x WYgYNHSyaePbJWgaMp8xVNB8bFn78yLIrnfoq+S58SYnJH9K+dqg/wODrThMJihZbBv/ ZdfCPIAO7NXx4wXgWHiN0CdQcRXrr4oqCAQhGdqjIlohU/kvIEmPH73OE4Rb/77GCBCd IWNXRXdULNPEyajlq2uY02pfQOzRlwLwNNluhCHeHeAKgtdFICvvL1og5Dg75siFt/NQ JcXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3sO90mN; 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 t20-20020a05620a451400b00779ab3d4204si6472326qkp.648.2023.10.30.14.20.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Oct 2023 14:20:15 -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=P3sO90mN; 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 1qxZeK-0001Ll-U8; Mon, 30 Oct 2023 17:18:16 -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 1qxZdf-0000yn-N6 for qemu-devel@nongnu.org; Mon, 30 Oct 2023 17:17:38 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxZda-0006TW-KM for qemu-devel@nongnu.org; Mon, 30 Oct 2023 17:17:33 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cc5fa0e4d5so6033385ad.0 for ; Mon, 30 Oct 2023 14:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698700649; x=1699305449; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DJYOGFevT1c73O/W4pBjxGvOP2r/M3Vo19QIR1W5oz0=; b=P3sO90mNgq42Zz67d72qsug/RpH+FJbh4I4Pghaxum+ipOKr801MEEBxGKVlhOe8hO D/Eqt8PiMDbNGg8L5x87/DmlgDN8rYjXoUIEqqhcu58Lew/G7cjVMCq90uBAs57XxT6F QSXIjzJrpgaccqk+8gPNf2VlCHTJYUM5A9jPb/TvLhe0BIWQoveCAzpC/JOixHMIwYMy BzL+IIMdXUpp4CLsm6hb3tfFFWK3J9WLilkE+JAQMV2WNSEkLM/xVIcFo+9tsl8f52Qm ez3FqlPZTcPtpvwgDAeHuoNBi7IJj4PscrZh6yn3hNezIkdX85yyzs1xhyXHPd8LVE8H MMjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698700649; x=1699305449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJYOGFevT1c73O/W4pBjxGvOP2r/M3Vo19QIR1W5oz0=; b=mKSsZWYUshnw9VhqUNEU/IdsSeuwHYqyyBwVpCsXNOydZFNM61LcXdIrfdcTuLPc1N tVFmk469m73iUeJDKTzgEmrGihuKeQVkhbAV6ZHBbCXvwI/ZNs/OlPbx5HS7H9wnKY4z QgR6GqqENEMmPIKVcXblFIQIeKEISqsdsYtYsngrL7OOkCrgtZ7luzcB146FkUwKwjmc 6VpA/CWWLk/Gc8HPXgoY2jjYyyzdk/kIVVoWC2RrLP+MmcH9OBWJFCYAegvVM7hlL0F0 UgI7PNb+9lcYi6621KN699mMk+nVRyJGWHjvN6Hnp5m0lMFeINZDzjO87Wbb4l0EbYGO cMyA== X-Gm-Message-State: AOJu0YyCRgBhjJqalKF18gpcPk0pXz7Jk7b5uG8vAFxnlJwo+KBQhv2O DR85I91U1sp7wx8j+JkLF2ncih6np4E83PSc5SY= X-Received: by 2002:a17:903:228f:b0:1cc:543b:b361 with SMTP id b15-20020a170903228f00b001cc543bb361mr2327939plh.43.1698700649052; Mon, 30 Oct 2023 14:17:29 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id jf2-20020a170903268200b001cc32261bdfsm4670350plb.38.2023.10.30.14.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 14:17:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 01/21] linux-user: Fix guest signal remapping after adjusting SIGABRT Date: Mon, 30 Oct 2023 14:17:07 -0700 Message-Id: <20231030211727.165090-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030211727.165090-1-richard.henderson@linaro.org> References: <20231030211727.165090-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Reviewed-by: Alex Bennée 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. */