From nobody Mon Apr 29 01:18:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1579175916; cv=none; d=zohomail.com; s=zohoarc; b=f/c2UG1NWe0dBSEYAH0F28LXiwxD+hiOp4jpuXrDYeKz9YJKdut8wvlO3XDTv9JXi9GDTL6U5HiWgZYCD/VOx5DZM4SX735AUSd3xXXrETjiULi1vo8qOIBUhgZRVt7cv8h0NVsMxXOKVPO2+B0p1onsd8Q08VXlSqTeqVZ+XWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579175916; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject; bh=e/V5RUixj7JVHWl+tsNoDw1AffDTBrYTFKBdv/bFaEE=; b=Rf5zarcbNxX2dNXueQNOsryoPakJO7MIUYCLMNjVhWOku4p5u9VkdKhUiaFiPF2McmRy+pQ/MU0KpRPdnhiKE+4zU547Z5U2iJX7QM4CS1MYEjEFSLSZmeHb+5h7xdB/qX5uScMXR+wMpOm/BKp0qdErQCTYq35AN+58EV8/Xa4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579175916874701.9698566487086; Thu, 16 Jan 2020 03:58:36 -0800 (PST) Received: from localhost ([::1]:40558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1is3nH-0001tn-RL for importer@patchew.org; Thu, 16 Jan 2020 06:58:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58586) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1is3me-0000lj-W8 for qemu-devel@nongnu.org; Thu, 16 Jan 2020 06:57:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1is3md-0008GQ-UU for qemu-devel@nongnu.org; Thu, 16 Jan 2020 06:57:56 -0500 Received: from mail.tachyum.com ([66.160.133.170]:61530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1is3md-0008FG-PG for qemu-devel@nongnu.org; Thu, 16 Jan 2020 06:57:55 -0500 Received: from THQ-IP-EX1.tachyum.com (relayhost.tachyum.com [10.7.1.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.tachyum.com (Postfix) with ESMTPS id D4CE523B; Thu, 16 Jan 2020 03:57:55 -0800 (PST) Received: from tachyum-sk-server.tachyum.com (10.7.241.13) by THQ-IP-EX1.tachyum.com (10.7.1.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1779.2; Thu, 16 Jan 2020 03:57:44 -0800 From: Matus Kysel To: Subject: [PATCH] Handling SIGSETXID used by glibc NPTL setuid/setgid Date: Thu, 16 Jan 2020 12:57:00 +0100 Message-ID: <20200116115700.127951-1-mkysel@tachyum.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.7.241.13] X-ClientProxiedBy: THQ-IP-EX1.tachyum.com (10.7.1.6) To THQ-IP-EX1.tachyum.com (10.7.1.6) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.160.133.170 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:All patches CC here" , Riku Voipio , Laurent Vivier , Matus Kysel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Used same style to handle another glibc reserved signal SIGSETXID (33),=20 that is used by glibc NPTL setuid/setgid functions. This should fix problems with application using those functions and failing with error "qemu:handle_cpu_signal received signal outside vCPU context". Signed-off-by: Matus Kysel --- linux-user/signal.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 0128bde4d2..c59221fd0a 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -66,11 +66,16 @@ static uint8_t host_to_target_signal_table[_NSIG] =3D { [SIGPWR] =3D TARGET_SIGPWR, [SIGSYS] =3D TARGET_SIGSYS, /* next signals stay the same */ - /* Nasty hack: Reverse SIGRTMIN and SIGRTMAX to avoid overlap with - host libpthread signals. This assumes no one actually uses SIGRTMA= X :-/ - To fix this properly we need to do manual signal delivery multiplex= ed - over a single host signal. */ + /* + * Nasty hack: Swap SIGRTMIN and SIGRTMIN + 1 with SIGRTMAX and SIGRTM= AX - 1 + * to avoid overlap with host libpthread (NPTL glibc) signals. + * This assumes no one actually uses SIGRTMAX and SIGRTMAX - 1 :-/ + * To fix this properly we need to do manual signal delivery multiplex= ed + * over a single host signal. + */ [__SIGRTMIN] =3D __SIGRTMAX, + [__SIGRTMIN + 1] =3D __SIGRTMAX - 1, + [__SIGRTMAX - 1] =3D __SIGRTMIN + 1, [__SIGRTMAX] =3D __SIGRTMIN, }; static uint8_t target_to_host_signal_table[_NSIG]; --=20 2.17.1