From nobody Sun Apr 12 07:21:20 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=1770848458; cv=none; d=zohomail.com; s=zohoarc; b=RqFLKBnphrmF7d29iKlAu1JuveTrAwsYBbP45rYbi9C/hyzklFfqVwvUM4Swx5NncXw+zP93sFrhwtoh0UrYsgBQay7zJeLk5KHo19LvTxSQvGSRCjqK+t4Z3VSIuEyHmA2MHU+LPYV4aqQuizSdgQH4UZI+6M9myzwZG9YAtxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770848458; 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=fnuus0A3VAM9HdlEwrG5U3dQzgzrHcUo5c/GhwFD6VI=; b=cC2d5HELExuOfQw/FOjxXQXkSijIGjGWAOHxKhqnrsT93lAi5egR78tFLy8z0JnkydAWVf9dYZmbXuyEJeRxtI9RiyADiktEplIgLfGeKYP06nVcrSDiRZks5K1TeGfqtHfeijzhJaiie73UK/9j3FAAkpOfEOMDiUL286ZRJu8= 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 1770848458796593.1259247883113; Wed, 11 Feb 2026 14:20:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqIZG-0005Mk-9l; Wed, 11 Feb 2026 17:20:18 -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 1vqIZ6-0005LN-Io for qemu-devel@nongnu.org; Wed, 11 Feb 2026 17:20:08 -0500 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vqIZ2-00051K-9c for qemu-devel@nongnu.org; Wed, 11 Feb 2026 17:20:07 -0500 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61BIp5ic2546650 for ; Wed, 11 Feb 2026 22:20:03 GMT Received: from mail-dl1-f70.google.com (mail-dl1-f70.google.com [74.125.82.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c8ydn0hv5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 11 Feb 2026 22:20:02 +0000 (GMT) Received: by mail-dl1-f70.google.com with SMTP id a92af1059eb24-1247bb4db53so3588600c88.1 for ; Wed, 11 Feb 2026 14:20:02 -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-2ba9dbe123asm2588379eec.13.2026.02.11.14.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Feb 2026 14:20:00 -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= fnuus0A3VAM9HdlEwrG5U3dQzgzrHcUo5c/GhwFD6VI=; b=S/EZlsueSpOz/waY z9/z+5ht20op4svbsS5QqouUhGg3BvjZk51Pv+UK57RW6mItGWazPgAjknpcr/ZK HJxiNjAFIGEc7VO/HP8fBpB05AqQ4Ds3mXi41lgCdPPnc5/zIySccWmpjp5uOLLK iMrlmSv/lpgMs/MJ41ZZGE/jYHqyv/2D2ykYv9b33orgI9cOoGZJjYZwbiIm/RYl QknZ+1B+g+/Jb5zZuPcg9wLzr2nJo/2tXnliVlblCnon2Ed7eEVI9Xk5wCfmYFxn z4KOOh7TC1cHKRdyZUO1/XWn+irRDwoRw3wrId2V0SkXWErCYjgjDpOsh6CoKlDK tSHHuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770848402; x=1771453202; 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=fnuus0A3VAM9HdlEwrG5U3dQzgzrHcUo5c/GhwFD6VI=; b=aNwKV2f9ZFt24NL6ANNfbX2xL1q7oU9OPsOTtlvRgqwgaVSL8ASH8COBEiy6mqi6VU CU8Kf+wzU3Dtoi3naEJxZp+q2ig0vUXYvPqF8YGs4aD1DkFE/8z0AnfosZ70RjWhkyRr FtHm3zJb35p/bIqlb6/OvCEKV9wyJ902GsS6W/ahapD79KQW8Xp0FfHSUM09Ih1u5cnb ci96sV8ablDCN2zVEfbbljXTr4KTsGvnBygscKHFyhZkRLPIOoBTh+9MouHoIMJyb/KC 7cOFwskvPHJmIVT+ePCvoFR9+34gowu4pNPwczAUUnpZPV94eA8XC8FlTvQnS1H4WLSu O9bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770848402; x=1771453202; 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-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a05:7022:2399:b0:123:361e:e87c with SMTP id a92af1059eb24-1273052046dmr114404c88.11.1770848402043; Wed, 11 Feb 2026 14:20:02 -0800 (PST) X-Received: by 2002:a05:7022:2399:b0:123:361e:e87c with SMTP id a92af1059eb24-1273052046dmr114389c88.11.1770848401094; Wed, 11 Feb 2026 14:20:01 -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 v4 3/4] tests/tcg/hexagon: Handle SIGILL internally in invalid-slots test Date: Wed, 11 Feb 2026 14:19:52 -0800 Message-Id: <20260211221953.4099441-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260211221953.4099441-1-brian.cain@oss.qualcomm.com> References: <20260211221953.4099441-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=NLHYOk6g c=1 sm=1 tr=0 ts=698d0092 cx=c_pps a=SvEPeNj+VMjHSW//kvnxuw==: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=Kq8ClHjjuc5pcCNDwlU0:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: eUdjd3xrhrwBnTAI7vzYC-dAfZtjIMgq X-Proofpoint-ORIG-GUID: eUdjd3xrhrwBnTAI7vzYC-dAfZtjIMgq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjExMDE3MSBTYWx0ZWRfX9ln2Qxw4jXVt lmJFQiKlAKyRq9+bRrHDUQSMnTjsrGq5DB2hyRZQhqrfdIWRqFFcpVtzD3s8PUVJ72UycayZfUB EwfnXzwhyWOBbpf9ljOBWLM7imh8XjThJag+gy7NdPimgermIOB/iVebDiQ6xwOg2f0yO6PCZrF V147SU8YCqV4nm9j9c36pw7JPSBlP9SmUaf/udxx8gUpLdaPGEjV0qF76qSiubmVJZhMu6rtU+e kaaKfsm+eBbpG8G5KVRtYwQfGAajuPOtsFfPCrFv6/lGA5MqT8Y+zozoqMrU6PFcPJ8Nxlw6cp5 s5Dvvn5aHMDwx5p7HoDBylfF6iP9H5PaNpVWTOOcJfzDwywSDA7n7rhufEq41wlumH8tbvGdGha xyFoMl+E5Vd/vikgE1rLn3P7FXw8iwGiOotsFImkIV0hr7Z8FSamcgmLvCxfryGnclH1DV0hIyw JSKz3og+zNEcoAoOqLQ== 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-11_03,2026-02-11_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602110171 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.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-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: 1770848461618154100 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/Makefile.target | 6 --- tests/tcg/hexagon/invalid-slots.c | 76 ++++++++++++++++++++++++------- 2 files changed, 59 insertions(+), 23 deletions(-) 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 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; } --=20 2.34.1