From nobody Wed Feb 11 03:24:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1770730480; cv=none; d=zohomail.com; s=zohoarc; b=kOLWv2ixUpTwqjsV9fZD2GCjoVxnW4pUs/pgZHdlHNYsLn7KIqzPRueUw1P/Od7joiE3gVw/yhErYlNW77xUjuVcIwtkL4mAKzfxuPmxND6fTuwm52uF8MIrip8zw4ySfcMFM6IS2CcvRJsMUKHrTVN8i9naHnxnslYjpcxKTAo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770730480; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GPUiSXKwen3lJ7VamxwDEFzXupLyXqvuwOfovAsxzxc=; b=MunVePYgbz8/7N7gyevX1inahfp8Nhv7MFsFFQs7BjqlzbYQu0Yfh0DeCYKZRZE3PdvfkM+StZdCfGGUgthXEkUOPuyltfltgE3yu4dJOdP1TIfTAANj7KK5+j0J34p2QPAc0b4AIoPq5SQG2zg1jmpIM2f67PLK1Al+PKXCq+k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770730480507393.4681594769057; Tue, 10 Feb 2026 05:34:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vpnsn-0005e2-LN; Tue, 10 Feb 2026 08:34:25 -0500 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 1vpnsl-0005dj-QD for qemu-devel@nongnu.org; Tue, 10 Feb 2026 08:34:23 -0500 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vpnsj-0001o0-Ni for qemu-devel@nongnu.org; Tue, 10 Feb 2026 08:34:23 -0500 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61AA9CJ41172867 for ; Tue, 10 Feb 2026 13:34:20 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c7kftupev-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 10 Feb 2026 13:34:19 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2ba745f54c6so5133198eec.0 for ; Tue, 10 Feb 2026 05:34:19 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2ba7e149c58sm2716162eec.26.2026.02.10.05.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Feb 2026 05:34:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GPUiSXKwen3lJ7VamxwDEFzXupLyXqvuwOfovAsxzxc=; b=cenCmf9PEqGoI/ag n3OXdViCbmU2DoJsbzHCPUSZWSKYzEgXxX823dp3LFcP0j0ll4RBFt7kXqBsder9 G7wobdfOZpRLGpT+WWRsFat+Zp17TbiM8ln19yV4aN3N3Q5nUhMUX2RSbqrcEmBv bYNBoMp5UMnjQwoKAu2BSLFYzYjgsrBcxijXYXEfyhda/5UXttsVpeiUioqM5iuU Z9ESXM3o0gMbikeIINLx4zfcsXYhGdenWM8/4oK1p8M/6VuvYgwZBcwIuKVbMinc GM2sMse4PUf5ohiWKmC5YlErUaWpQUwOjwXLSBA3iTlL5um91HnFvmKCDxdrH65s MIWGlw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770730459; x=1771335259; 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=GPUiSXKwen3lJ7VamxwDEFzXupLyXqvuwOfovAsxzxc=; b=isNjBOHck2j2laWH7x0K+jUkjtrSyB3d9WgX/7uOeoZWJe6B3lLRw9PxiwL5pX9BB8 1PO2UwedgPFktBiVwPMXhnZy5QQwlHAanHiPVe2EOTyrS4k8cN3kJX2rqcKZECGHMy0D 1PoTYEcqKVykxqswIcjZ/YDUQ/6w1gKJ6GdUKgtNv8AJ7MMeSKZ4GfMCCJHIuHPZymwa lBXm4cRi2Qb78D5HeCrvwjMi9SV53I/FeBxf6HiorSi+rNgjSBTO2U5eqAxsTkpP9xLK qOeQf6uGgkdJZLapoC3/mwe3TwvwzNceaMGXzlF1BYqC4PkvsuPEUnDTV5nkwJebIWU+ bQaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770730459; x=1771335259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GPUiSXKwen3lJ7VamxwDEFzXupLyXqvuwOfovAsxzxc=; b=V0yDNtwedQbK2QA2S99DLbHvVS4KtMDHbub8MI82B2LZDI+/FxX6DME9AGGYNe0R1X XyvmuexcZksl90I3mUu19/6XZgn+SZSLBNXLb/hj3NUfEx0/JvhAJa/wZpuvSWIPYxd9 psg5d63t+7GEmD+RI+V+ayzi0JCEiK9QvoMg6XflMs5kc/SozdYOpfiRksiH9jfzWtkQ cos4dF8E94+tso1SzMb6SsZ9yW+SKKtJm+J/56tJQukKeFYdR8fDDNsfCnTE9bLsL0Gf 5Jsk4mSSZPL3Pg0cVBwNaOsb3oSwl2dPtW38NmakKEbqk6gcko8pHsjTjL7ffktJR29P c2gw== X-Gm-Message-State: AOJu0YzkdAvLUazRBAp539hcxlDkExIqR8+hHn5qSpkq4cZgDvrH4zuc q/OVQQgWoYYfJHsDiNKQ60XpPR5S7NFZV+M/uuHGBUiWhSfQ8AwJAYpGOtU/1nVYmSNlZ7rYWDR xLiNwZrRoblKqWgvHWa4kK5V3ENU2wMjk1ZAEXH8tSyZAMZU3BNonB5znvupuk+HCDA== X-Gm-Gg: AZuq6aLncMveOaGOWpnOGh4+8mLXzToQXC4g3CxMz9JTfX9i34k+ee6c3zUGFRSy6LD ygfGjYgVKasiZPA5ueHlb1oZaKYffFvENTkxx2ZpCjmjsvrGga48keaGgkdJr857gLuYr7oJDFe GtL5xLtE1X2sLGXNxVcZ4ZqLcsdVIf+gQYLVuTP8JdH/l8aeQaoQKL87NY09IHpgPFiv0CCsf7U KAFZADwJhMs/29Riacby46sa3dQdrl/nXobLMFBSBfulw+XP7PcV9HBERKBmdpAj040Td07br/L Y5OBDg3vqrP76P/oNiZWGSseVECsHCgTzVk0LPmUWQemOzXHnrLX8VU1nvMdPteia/fOdUp42wu 2tkNehSJOtMjBpEF1GCfOiYSOQfKO1SCmoP4Y4FCal7qEh+B9Bp3SNu1cEMOfvy5G68Df6A== X-Received: by 2002:a05:7300:c8d:b0:2ae:5bde:a5c5 with SMTP id 5a478bee46e88-2b8568311bcmr6489247eec.30.1770730458716; Tue, 10 Feb 2026 05:34:18 -0800 (PST) X-Received: by 2002:a05:7300:c8d:b0:2ae:5bde:a5c5 with SMTP id 5a478bee46e88-2b8568311bcmr6489234eec.30.1770730458161; Tue, 10 Feb 2026 05:34:18 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, alex@alexrp.com, Pierrick Bouvier Subject: [PATCH v3 3/4] tests/tcg/hexagon: Handle SIGILL internally in invalid-slots test Date: Tue, 10 Feb 2026 05:33:53 -0800 Message-Id: <20260210133355.16093-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260210133355.16093-1-brian.cain@oss.qualcomm.com> References: <20260210133355.16093-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEwMDExNCBTYWx0ZWRfX43pQALMuHlKi fxw23tZjEmryCjWAowj1BfVPApwXdCOEEC8v8LVeLRxdECWjDezftEJee+1wRwUyqTWyJup7CZT d5noqWBIEH9eZ4zo4C2lgtil8fXZzSkPHi5FQxCLnrlr5lfeQ5wi5GLC0dQOR/qwws8jSfxa/j9 x+PcJmaXbUDRcfYKUSmtcTAFRBskg8MyPvO2TMmvKxeFJT6/ObgQf33c2WRAEa2583yUpI3cC2k MzEwdn+ZXx9tC2M9yrXj2WwPCoiLgYR4RdS5D8HFRhHd72QsIgxgsU5SpS3ccJ5tOKTwJoj5zH6 iUUWavfQVyo9YnaSPyhLjsK0IyGnYf+9HSQthWyfI3DQ/m3pHoMglWL1W53i+XWfaARWiGcMGlO DUkSDdoJvp1HPMGHmZFBwJsSOIiQYZkOqwmHHpV8zdpBL/XfLXIzxl7/ek5OOpfQ5ZqHHpqL7qD OOtTT/b7+Sdsi/G99Lg== X-Proofpoint-ORIG-GUID: l8AZOrP_juWl5SIsIUZvFx-iHmr4gAj1 X-Authority-Analysis: v=2.4 cv=XfuEDY55 c=1 sm=1 tr=0 ts=698b33db cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=mDV3o1hIAAAA:8 a=pGLkceISAAAA:8 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=F0Jt1ehG-eUF7qKHwFUA:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: l8AZOrP_juWl5SIsIUZvFx-iHmr4gAj1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-10_01,2026-02-10_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602100114 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; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1770730482102158500 Rewrite invalid-slots.c to catch and verify SIGILL using a sigaction handler that modifies the ucontext, matching the pattern used by invalid-encoding.c. Reviewed-by: Taylor Simpson Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/invalid-slots.c | 76 ++++++++++++++++++++++++------- tests/tcg/hexagon/Makefile.target | 6 --- 2 files changed, 59 insertions(+), 23 deletions(-) diff --git a/tests/tcg/hexagon/invalid-slots.c b/tests/tcg/hexagon/invalid-= slots.c index 366ce4f42f..607027f314 100644 --- a/tests/tcg/hexagon/invalid-slots.c +++ b/tests/tcg/hexagon/invalid-slots.c @@ -1,29 +1,71 @@ /* - * Copyright(c) 2023 Qualcomm Innovation Center, Inc. All Rights Reserved. + * Test that invalid slot assignments are properly rejected. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later */ =20 +#include +#include +#include +#include +#include +#include + +static void *resume_pc; + +static void handle_sigill(int sig, siginfo_t *info, void *puc) +{ + ucontext_t *uc =3D (ucontext_t *)puc; + + if (sig !=3D SIGILL) { + _exit(EXIT_FAILURE); + } + + uc->uc_mcontext.r0 =3D SIGILL; + uc->uc_mcontext.pc =3D (unsigned long)resume_pc; +} + char mem[8] __attribute__((aligned(8))); =20 -int main() +/* + * Invalid packet with 2 instructions at slot 0: + * - Word 0: 0xa1804100 =3D memw(r0) =3D r1 + * - Word 1: 0x28032804 =3D { r3 =3D #0; r4 =3D #0 } + * + * This should raise SIGILL due to the invalid slot assignment. + */ +static int test_invalid_slots(void) { + int sig; + asm volatile( + "r0 =3D #0\n" + "r1 =3D ##1f\n" + "memw(%1) =3D r1\n" "r0 =3D #mem\n" - /* Invalid packet (2 instructions at slot 0): */ ".word 0xa1804100\n" /* { memw(r0) =3D r1; */ ".word 0x28032804\n" /* r3 =3D #0; r4 =3D #0 } */ - : : : "r0", "r3", "r4", "memory"); - return 0; + "1:\n" + "%0 =3D r0\n" + : "=3Dr"(sig) + : "r"(&resume_pc) + : "r0", "r1", "r3", "r4", "memory"); + + return sig; +} + +int main() +{ + struct sigaction act; + + memset(&act, 0, sizeof(act)); + act.sa_sigaction =3D handle_sigill; + act.sa_flags =3D SA_SIGINFO; + assert(sigaction(SIGILL, &act, NULL) =3D=3D 0); + + assert(test_invalid_slots() =3D=3D SIGILL); + + puts("PASS"); + return EXIT_SUCCESS; } diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index 16669e04a8..d64aeba090 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -54,12 +54,6 @@ HEX_TESTS +=3D invalid-slots HEX_TESTS +=3D invalid-encoding HEX_TESTS +=3D unaligned_pc =20 -run-and-check-exception =3D $(call run-test,$2,$3 2>$2.stderr; \ - test $$? -eq 1 && grep -q "exception $(strip $1)" $2.stderr) - -run-invalid-slots: invalid-slots - $(call run-and-check-exception, 0x15, $@, $(QEMU) $(QEMU_OPTS) $<) - HEX_TESTS +=3D test_abs HEX_TESTS +=3D test_bitcnt HEX_TESTS +=3D test_bitsplit --=20 2.34.1