From patchwork Wed Aug 23 05:16:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 716071 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp622198wrp; Tue, 22 Aug 2023 22:17:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+nVFAJrLaXPCvJ/Q/gyAwu2vQPDNEk+EXjuv5TqdBoOlSLokYFxOo7X9Vc1MJJ06VmEBQ X-Received: by 2002:a05:620a:120b:b0:76e:e6cb:81b4 with SMTP id u11-20020a05620a120b00b0076ee6cb81b4mr44004qkj.73.1692767849418; Tue, 22 Aug 2023 22:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692767849; cv=none; d=google.com; s=arc-20160816; b=YEFtu3FGlB++aA/gqzxSDqZws+DGMXMKE1RQFO1JVu3qr/DcpobUifuWwDIoIoCaWg mkJimHyPziW78KGmNneoa0tQFlMrlQ9bs0qbJNzuWHfKIP7Fe/Kxe9Z46vi0AcBYkoi+ 4P43SQdt9l1JyVAXKvUiBd6FgbCNbEsh1m5o/zT7uvGuKwfxkLMz0grtyFJJrwgnJR4w /btbpkRhlAkx1kSrpf5y7gjx2fO7l3MBpjlrt4ksWrAIhm1CQF3Ghjglo8aDgNYlcO0j MvV/OeK6dAblBfYHqVn3IhSrDkrVuP6mjIhPugjaOfSnUJaIXelcauPKAQcFdxb6HQg3 IsLA== 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=ONpVouFAHtBaoT5On3cpK1SzlinIIZiyWi2CcqB3oSk=; fh=uta8CuNdWwEUIsmWLQQIuZWY0GOyjYTd4DbN32nR8cE=; b=n0Vfo+mtuJMdeKq6cnngKIrMGouw6VpaVbxaii6QT6pP3HnBTtJPlP9GHyYjzIw8MS /TikzyQYLE50I7Ogbfefceuy8KTmrxbeBUpB+RyxDmAzIgdTaOvMDgUYfihlhzF2t79N SyEX0V5XUqbCzkHv4hlkkLGX5kjeHJMJ0Td+B5h5pBtN7fG3Tx5Q0Dx7gIhgutOawnZh JBvgz3D/qJBZw8JDZ4uaToEOI1tABOCpt1ADbw0ca/V/T2U83dSjmBafW44V0CWolD2L DtKH+gzEupxNKZDxumWsqQJyZryJufv6j4j4aAo5Wsg/s4mGPRTDsYTwuW5LlPKRq5BO hB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ss8u766f; 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 i25-20020a0cab59000000b0064bd48d399esi6353818qvb.325.2023.08.22.22.17.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Aug 2023 22:17:29 -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=ss8u766f; 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 1qYgEN-0004yr-F9; Wed, 23 Aug 2023 01:16:35 -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 1qYgEJ-0004y3-QK for qemu-devel@nongnu.org; Wed, 23 Aug 2023 01:16:31 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYgEH-0000u1-KY for qemu-devel@nongnu.org; Wed, 23 Aug 2023 01:16:31 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bdbf10333bso41523605ad.1 for ; Tue, 22 Aug 2023 22:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692767788; x=1693372588; 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=ONpVouFAHtBaoT5On3cpK1SzlinIIZiyWi2CcqB3oSk=; b=ss8u766f+o5EzqsSmtj8hJaYEymENBSIs2870Ow/WUjnu5HXxuCxSecokV1Wah7Izx F70tZN8+Vw06tfhV7RM+ea4qiPHPJe+Ziwr/hq6VT55A2O9VsAnn4QS76EJce67c5X/2 yKXHm4tnJKbvGqFOD1+P+DZZfPbKK7IBLK9JuaapiEVMaXpzlsVgA/s3GsW9BBkRWvhi 85mW9NSps3q+h8ftG+4r9W2uI3202Sw4FgUZ+L43Nl6HszJ0vV4zDkLGIcgBaSYwCX47 kZcl/8jJjaSWm62U6/afQ8PmXnDovDnFsFPakY6GSCPy+hyKp1UyGU3tfyXqtZMro3f/ RLNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692767788; x=1693372588; 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=ONpVouFAHtBaoT5On3cpK1SzlinIIZiyWi2CcqB3oSk=; b=B4Dm+Y6QmpggxGiMS0Lr/3ZXUsj0U1Zth9bt/mGzb0Gl0g6b5yMHiPxXYwcclQSHoD tURFcGM96nxMjM937SGS8THfDlcNKBzfNj/M/F0STvWmcxOfL9+GMaF+5D+CIGMG+1tG pHZoVjY5jQrEitQ8qIk+38trayZI51nO4oQVK2uFi9UlONtqrxQ5dNFlc6ExjqAukYqX WxzCcnrlz6GwVlu5I4u3RlrCLUON0C30aLVEeRfsehITE1634Xlt0yBPmTH87zSoGCG1 8jA1BolZSoJP1NMNrglKGOeEDaAEaspXk5XE2RtVGpQ8atT4kSbEBtAwDep650huf8zn k0aw== X-Gm-Message-State: AOJu0YwXoz2I/RbC00jhT1Kkp+leaAaaG59eDheWgA84bQysqw+8rfpY /V+cHnHFnzl+xt7YSudMLwuIyLOX2cnEHpcA2K8= X-Received: by 2002:a17:903:2344:b0:1bc:8394:daf with SMTP id c4-20020a170903234400b001bc83940dafmr15272526plh.19.1692767788392; Tue, 22 Aug 2023 22:16:28 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:4e3c:f4a4:b92a:b5ab]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c24500b001bf044dc1a6sm9969402plg.39.2023.08.22.22.16.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 22:16:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH v4 10/10] linux-user: Detect and report host SIGILL, SIGFPE, SIGTRAP Date: Tue, 22 Aug 2023 22:16:15 -0700 Message-Id: <20230823051615.1297706-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230823051615.1297706-1-richard.henderson@linaro.org> References: <20230823051615.1297706-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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 These signals, when not spoofed via kill(), are always bugs. Use die_with_backtrace to report this sensibly. Signed-off-by: Richard Henderson --- linux-user/signal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 68ceb2e4bd..6d13b5c210 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -904,7 +904,8 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) /* * Non-spoofed SIGSEGV and SIGBUS are synchronous, and need special - * handling wrt signal blocking and unwinding. + * handling wrt signal blocking and unwinding. Non-spoofed SIGILL, + * SIGFPE, SIGTRAP are always host bugs. */ if (info->si_code > 0) { switch (host_sig) { @@ -916,6 +917,10 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) host_sigbus_handler(cpu, info, uc); sync_sig = true; break; + case SIGILL: + case SIGFPE: + case SIGTRAP: + die_with_backtrace(info); } }