From nobody Sun Apr 12 05:55:53 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=1770951426; cv=none; d=zohomail.com; s=zohoarc; b=gHrCndJ1QfTGgZ9l8iiXnKg7N+iPpSgxngDz4Eb5UlxaDOri3MBOXUQK7hq1m8Y2FlBsItzD3FdGDSdF6sNX93OdmADIxa4En0l9P5pmZIWDU4uBaf8S5pb6C2jjL3S68Q7hJ+IHO5WJ0AkjdYUalu4sRGyS0O43KuxPdhskTWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770951426; 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=DAwfI+tDK1sCPZ8/aogJ64wVx9BOCZs7URuO3nxHo8wiit8BEzh60kMcvXV5T9VxR39ChfhQVyii0PMFGlCJqX+B23IUGXCrjRNTLV9aYBiOERGY5plMoblqYnMRZE182QzTkBRqaD+WFgpdWyCadrdM+WP73ZMy8rREAdQbz/Y= 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 1770951426386946.1458080517687; Thu, 12 Feb 2026 18:57:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqjLd-0006Dv-Ar; Thu, 12 Feb 2026 21:56:01 -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 1vqjLb-0006Ci-Gr for qemu-devel@nongnu.org; Thu, 12 Feb 2026 21:55:59 -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 1vqjLY-0005E5-9k for qemu-devel@nongnu.org; Thu, 12 Feb 2026 21:55:59 -0500 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61CKRCar421513 for ; Fri, 13 Feb 2026 02:55:55 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 4c9cy4b6r2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 13 Feb 2026 02:55:55 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2ba87c0e198so476920eec.1 for ; Thu, 12 Feb 2026 18:55:54 -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-2ba9dbd5d3esm4500943eec.10.2026.02.12.18.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Feb 2026 18:55:52 -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=TyneOP3/JwCDvtjY XrDQmrNyPdyd+uAucy/5rhpdNeX20/dPnMbVuPr5nn6bqrXirP3BUmVr5iW5HH20 R444cgDVzd51yc4xScHy5wws0sg3quv41KcIaRt+g4nPHOTR9I3gCUcQgrId3H56 LEeD67hfT5A4YZuqewNHH65dJUVEY9TGQQiFCJ3/4T2mPYM5e27lO32gq9uDWA79 0y+5bm1qtlLMJzXTqAZZ7Z/q3oBvo2gUDnUvVdeFWNIsMtiZ4H4bnrufpwB+B+UQ ri7fP0tli3AdvIwqtOgNKGZOz7U3K3kfdoO+HMoZo27relf9bn7QyJuyypX5j1Du 019Yfg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770951354; x=1771556154; 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=FQafOjEiAc3aX+YmMX1RiLH9FYwPZ72fIP5uQk295ipyojHOTQlbElDuJvZLRp/hFC o0EKRJlmDC/m8HLvon6aQNRsD1+jpnE7/LcOpse3yTsXSL3cS/SLCqgaxb+O/nUIqL3W jxQAxEpwHwxEJSWrHgzSaJCtolLP30aLqd0QCh8UGcurDxapkNtOSQtG2uB1rc8g7WJI PutNYPKc+dVx7WUoxZt2u4j5HmFjRdH6y33MNNN2d9HLi7qCSXYBR8x43WDm2jn/FfsE 82K4tPEmvOtRzJJ420aya0sd5iR8zwmoMju3+lFewVaPSyCrMCMHPzSsVkddnERIBFsK wyIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770951354; x=1771556154; 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: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05:7300:5709:b0:2ab:ca55:89c8 with SMTP id 5a478bee46e88-2baba1546edmr396430eec.43.1770951353774; Thu, 12 Feb 2026 18:55:53 -0800 (PST) X-Received: by 2002:a05:7300:5709:b0:2ab:ca55:89c8 with SMTP id 5a478bee46e88-2baba1546edmr396413eec.43.1770951353212; Thu, 12 Feb 2026 18:55:53 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, Pierrick Bouvier Subject: [PULL 3/7] tests/tcg/hexagon: Handle SIGILL internally in invalid-slots test Date: Thu, 12 Feb 2026 18:55:40 -0800 Message-Id: <20260213025544.2497992-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260213025544.2497992-1-brian.cain@oss.qualcomm.com> References: <20260213025544.2497992-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: FPVU7INK1uRaG87HkUCnUe_ZxbGR3GsT X-Proofpoint-GUID: FPVU7INK1uRaG87HkUCnUe_ZxbGR3GsT X-Authority-Analysis: v=2.4 cv=XvX3+FF9 c=1 sm=1 tr=0 ts=698e92bb 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-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyMSBTYWx0ZWRfX6c1R+nnDYmRR j1GZ/JsnMg+vL0rX+7SK1N9mHJx3UOpOMQadDy5Jv26ICtq3Wm3XOJOdw/kHbYq3lDuIJ6gUnDg toDidYS6u1gGT08ZECaFl3bISvDa2vjrQWHUB1jmKxDenjhiV3wPluC5OX+A6XDzEuqrBD3xzOy 1bWokSkJ7l0F4GDFhWAQXOIny5XHttjeTbh1mqhz6IPkNmO8h8mQnXuWFFingVDT9WyKtvfpcGx P8PcieSVUGqjUYxI2TwdMXjOWh7jS5dXX4zxFf3fDx3tbVB5R+l31BRu8EEjUxzfjlJvqdJvvDv Ws+fJjJ95zpVkFT4Bm3Ki/5nHslnFB1qZFWUZ0cWOCSH1hF4Mk0Eisea9ELnat9gKc2aQaf7IJT 0elyWeoPWjoqpr8689nF+8qSmTcNSdHlDrl0k2sL5TZturpjysTK+u3s5AgEY97576ppgUoa1j+ Zs+PRh+NXoDKr1vDilQ== 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-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130021 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: 1770951428644158500 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