From nobody Mon Feb 9 14:50:29 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=1770487688; cv=none; d=zohomail.com; s=zohoarc; b=a6zYE8pl7tstJ8xbwB2SI6vZpdhKYVIGBhGUxt18PUrk107eqLPyjcJ02Iappa/b0AtR49HrgwbSrRHre4XS1yOH9b3KLC0rimGM7NO42deN0ng9UNSoD94SZ7at5YlQRZOXPtlSELuo4ilEiIqe2kUQsDP6oowaQHTYbACKw4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770487688; 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=JHhQq6zjjk1gW27nuetaXaeVBGetUzLOuDVqFptfOCA=; b=Iy/FAaUZ4nRJl+5DC/v1CFu/uY0eGrtg1Kc+LRjc/raztoR0voUZky+x9DDfP/Mv3VnpgMMPhbfyPTZf1TWihUNW9jA0+uulEQJSYowFfw8QoVHhU53jpUI3N1KhFPyJy5Qpv9q4p6Uh3uUsATiR/4B0wLrNm3GM43Th0oDMgyY= 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 1770487688461942.8981220086552; Sat, 7 Feb 2026 10:08:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vomi5-0001UK-BB; Sat, 07 Feb 2026 13:07:09 -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 1vomi1-0001U8-6l for qemu-devel@nongnu.org; Sat, 07 Feb 2026 13:07:06 -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 1vomhv-0005Lq-5p for qemu-devel@nongnu.org; Sat, 07 Feb 2026 13:07:04 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6174dYmK1051289 for ; Sat, 7 Feb 2026 18:06:55 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c5xj1938w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 07 Feb 2026 18:06:54 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2b866e72c00so474811eec.1 for ; Sat, 07 Feb 2026 10:06: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-2b855c63152sm4002328eec.25.2026.02.07.10.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Feb 2026 10:06: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= JHhQq6zjjk1gW27nuetaXaeVBGetUzLOuDVqFptfOCA=; b=jnun3aeCuruGz43+ DQwgtUbeeSfGO7/Iry86yDsCLhZE8GXeeO3ysXc0EilyAqwFfqG2+sW18oqvNZAW 1+vCq8RL/06yozCpZZ2SbcPEvhJB6kEoli1Qz4nIWU6vFQvsLByRUtQVqYHqgofF ebiIGwVvEaIc3LRZ4zYJx1BievKGXNI674peLq7e2LRmYB0LW/ZREvJwIuvo8hwS vRszy91wV1gO5TAx1BRL//b+GpPR6CcTX+wqiEPQK/TQU/I8Do6s0lR8IUSPgWzm rPn/epH48NFUKWglJ/8IbIbD5hZ82z+G7OEAvVBxEtHfrDfDlFAGOdQ0hIbRNvOy 5EU6UQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1770487614; x=1771092414; 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=JHhQq6zjjk1gW27nuetaXaeVBGetUzLOuDVqFptfOCA=; b=YS3/MiTI53lHOSdnlUKIFPTpZZCQndLwckQbbqT+h+xRRCa2SO2qWJmcqcIQLurUKq i8vG59g1lhNrpiyMAa+MVfxjhzOzSKYIIBlRIjgThFDWlC8g63F/0FmKwXZ6d0wN+vQW 9TLtXklrxrqOws8T1uaCX4w23Bel8uF25lBVMTEpGHBINbvKwGAf5Qk+HppZRFRL4tdO fiCgY9CMjLT4LtDAKI+Rvre+D+ZM4eof6cXpcP3ktH6tzE4VcTmzQw7gwsH6nEbY4hx2 /OaoisbeueSfbcD0qr7bnLzMK7BqyJtiwJpV5s4rdQvQe8foANFpa3QPRyeYSStr309s 9oYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770487614; x=1771092414; 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;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7:f0a0:c195 with SMTP id 5a478bee46e88-2b856830522mr3218967eec.31.1770487613791; Sat, 07 Feb 2026 10:06:53 -0800 (PST) X-Received: by 2002:a05:7301:9bc6:b0:2b7:f0a0:c195 with SMTP id 5a478bee46e88-2b856830522mr3218960eec.31.1770487613209; Sat, 07 Feb 2026 10:06:53 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, alex@alexrp.com Subject: [PATCH v2 4/4] tests/tcg/hexagon: Handle SIGILL internally in invalid-slots test Date: Sat, 7 Feb 2026 10:06:32 -0800 Message-Id: <20260207180632.1042754-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260207180632.1042754-1-brian.cain@oss.qualcomm.com> References: <20260207180632.1042754-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: Ge683moFqg7ndnEpiMF54ybC7JcldLZQ X-Proofpoint-ORIG-GUID: Ge683moFqg7ndnEpiMF54ybC7JcldLZQ X-Authority-Analysis: v=2.4 cv=F/tat6hN c=1 sm=1 tr=0 ts=69877f3e cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==: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=EUspDBNiAAAA:8 a=F0Jt1ehG-eUF7qKHwFUA:9 a=QEXdDO2ut3YA:10 a=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA3MDE0OSBTYWx0ZWRfXyMW4wHKFd8Uu jkq8gjUWcOhMWifYIOZxHkRkEHsFWmKqsMf5xF36Y5LK8qCWeC49AOnKIw2xQDJ6r3qz0YV5vYM H9jOeXvPpsLIoZbQ5Gq2S6oTk3dl4o8jVWzilfPqffTldj2CuiDLA5LFdY9kf3TMt3MpNeghyh/ iou5MnI5lMKltdZ3ut4qq8otvCbZVhxd+xDUa38M2kFg+/HZZdkwABKI71tFnWw3uqeaTozO8tc UFGKRcR5+e/Oz7A0HKXDlLhvUHg+Iz/YZv5/LQGnSwBMiGfPRblYPmHacpzbKE+lSPmeoxJf+Rj nwpbNRhscGO8DZKdD3WadTzb5htaQ2VIxMxotVWpVjt5vMMHD3orQQp4AqrWrsT9CKHrhfJVV7z w0MBm1/j3BN6aGbIs0yDkDt5tf+mUlnXBvrutQK1HxUCMb8/poeXADXr8bDeBQShaDMBXlxVyvt Z9OLGUojPNiHGDblGsg== 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-06_05,2026-02-05_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602070149 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: 1770487689305154100 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. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier Reviewed-by: Taylor Simpson --- 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