From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id LMU6F2BqDWZRiSEAWB0awg (envelope-from ) for ; Wed, 03 Apr 2024 10:40:32 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Cf2kJhls; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=Cf2kJhls; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4E8DF1E0C0; Wed, 3 Apr 2024 10:40:32 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C72EB1E030 for ; Wed, 3 Apr 2024 10:40:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B8EE3846059 for ; Wed, 3 Apr 2024 14:40:28 +0000 (GMT) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2057.outbound.protection.outlook.com [40.107.20.57]) by sourceware.org (Postfix) with ESMTPS id 730543847718 for ; Wed, 3 Apr 2024 14:40:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 730543847718 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 730543847718 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.20.57 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712155207; cv=pass; b=sz1M++bVOoEGRl1Axqa+lLCAuRZs9msU+kwlhqY05GkX+LL5oZ8ggVc/yG6sl5PCg0O8k+OVWNsd8SAXLUcZkVcPNV6ChhuNrWVZDXqs6OMn/7Qnbwge4hx9B5rurh39UufygbZmsDhq+04kFUvnTkNwLunOtD7oWS5iD+oUjQw= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1712155207; c=relaxed/simple; bh=Hfdz31rnwAAHsXxRxmBqwbgEOpOrnmBRZBJRxfwn4jM=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=DUzaW6OBpNQFjT7IqbWoMxZiIJYgESBxZCFjFxXy31sokcdqSKHUpCnXjksWT7m7bEaBLTjsjTbu89uHdvP1cDUvk9/2Pls282xmLSGkz7CLveE3okCsPDmCu8BtHfLD1pHHAN38jcYGAEs+uBHja2DHOg/4CJOn1s3JFxpPbtg= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=DDzTrFjh+Er23n+JH1tpsX41z4mlCwMTl61FdJLIEjHK5yFzpbiZBKFHWAQrc3LIf/HCiju8yDzNaFyLiPN226a5is29se4ZY4iQqH81uyXPfwJHMOU/OqQsEpb2+DZbGGYiLHyZTuUlxDD21hDfGJKeH37Itnzx0Co8Jl4XpOv8xcKSvhWd5cTGshLHFn/EjOvkJ8/vJSLPuNH0TYACsAQxOZW/pBONxsyHCMolIG9fJHLr9wecKGsa167T0qHWTP9z7XpG6BpFAmnT/VcuhDuIiKhYyrBoXrmJaPcz3DIg0rKjifSfQpGqCqYUeATYLkyaYB4cp3Tyn/YCpuku7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=36BzIBXUiu3gbL/RFddheZKWbKJVFPHlfaNTGShMlBo=; b=UB7Pdy/dNqFheGT2OJWlSaFdZ/mOAk/UdRdk+O/usB/lrLpO/asOAD86cTfSjo4GX3xUoP3pc1v82z1ZAXser22a9itzo1vSxBVCiT605tTxpToQSMJjlpzh4d+1fjfX9/DshpZkIPzQDq8Vgwn1CSIEqIwrIoZBDT0dbkF74wJFLtt/WqVsfeXgSTJAvY1c+jbOUs8Rh3y4CV13rY/jALhJfmMuZOVn46FYoeprv3qZXZbgf5NjmNRz5wV95OyiZ/FGFV6lmh2DF77s2x4RvW+cx1jDAOB1dHtwWqz2hqlbcqGOV2JvG4yfk/hXwQNriI1509aiXekTb8pvvQnu3g== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36BzIBXUiu3gbL/RFddheZKWbKJVFPHlfaNTGShMlBo=; b=Cf2kJhlsbVIvs6XnFRu4k3wtzPWsdL7JzPtKbJDtcQ7BhoZDvpk5hr4a9LxmKibaV/g0Ph05Z6w7H2qXtef3HXhwPFuQUQ6dRnF3lsxxzyKxvltfze6CHQLXrInMa9+XxX/3Nyauw4VNIg87QOV1lAPv0iH1L4lNDabULkImPxw= Received: from DB9PR01CA0012.eurprd01.prod.exchangelabs.com (2603:10a6:10:1d8::17) by AS8PR08MB6581.eurprd08.prod.outlook.com (2603:10a6:20b:33a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 14:40:01 +0000 Received: from DB1PEPF0003922D.eurprd03.prod.outlook.com (2603:10a6:10:1d8:cafe::19) by DB9PR01CA0012.outlook.office365.com (2603:10a6:10:1d8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Wed, 3 Apr 2024 14:40:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB1PEPF0003922D.mail.protection.outlook.com (10.167.8.100) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Wed, 3 Apr 2024 14:40:01 +0000 Received: ("Tessian outbound dc0a9029eb2c:v300"); Wed, 03 Apr 2024 14:40:01 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6908e4b04cd5a08d X-CR-MTA-TID: 64aa7808 Received: from 325abb7b683b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 684C8EE2-9DFD-417D-B6BA-24530716F602.1; Wed, 03 Apr 2024 14:39:54 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 325abb7b683b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 03 Apr 2024 14:39:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpB3Hd8Ia33RiVdgFFILpC9Jh89Iavz7AJeTc6uLKHIFkt2LiC9LAPxASIJkXSKnt4+DwN0B++VRpS2vdIxEL8K+wq1JXmGTK5N+lm8Ja8jjdYmkNGxLD7nyxvIxlOvEJ0kZyUx45uAG+1erYTamSLJFo8V1umDHvTUoLqoNVRs1Qvk0O76Jrux66n96LjPq1JEDYJUoa9J+qsEMS2vbxR6R9Os9+8YOUgF5IH6YkzKze7vpPKha84Suxweh6ozcwgmks5Nd7Ro+RH0IjlXbgXxXbK9CfkCLNxTqIgnfkbzpobkl2aFPJdXvLqA9oRI3YWCiVRIiy1gSYDcDEGtJMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=36BzIBXUiu3gbL/RFddheZKWbKJVFPHlfaNTGShMlBo=; b=jlcHpsrpkG2WudWWiA4NBWITlkAVBalfCh0V5ORwDy1ydMfJGhnOysYy6Bxbfzdqm84xDBQfXZzLDjcHFEDDU2jRJ7cdXBuNblEETwOV1T7BNk/4lHHokxsM+NbabbjuJH1f+67jysVnAwOkoAqIhUjEExXlRVXXRncjLThFlMWVsLaBozDMZBPPZkgkk2vDexeaXGmQvlkyO02Q0/lQNnwu/7OhEe4GJZyMmb+c+ZXEHiKH8ZV+hkDCvS0F9jJzup9S9ZqjMuarx4eISvE9ho33p6qr8IVMNFuu7pb84m1asxeifwU526KWJoG1bZGztrWbHRPlLLeZZMIH0bMfEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36BzIBXUiu3gbL/RFddheZKWbKJVFPHlfaNTGShMlBo=; b=Cf2kJhlsbVIvs6XnFRu4k3wtzPWsdL7JzPtKbJDtcQ7BhoZDvpk5hr4a9LxmKibaV/g0Ph05Z6w7H2qXtef3HXhwPFuQUQ6dRnF3lsxxzyKxvltfze6CHQLXrInMa9+XxX/3Nyauw4VNIg87QOV1lAPv0iH1L4lNDabULkImPxw= Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by GV2PR08MB7929.eurprd08.prod.outlook.com (2603:10a6:150:ac::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 3 Apr 2024 14:39:51 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::363f:3fc8:fc36:58ed]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::363f:3fc8:fc36:58ed%5]) with mapi id 15.20.7409.042; Wed, 3 Apr 2024 14:39:51 +0000 Message-ID: <68dbd5f3-d303-4be6-90a5-b9b3aacb8928@arm.com> Date: Wed, 3 Apr 2024 15:39:48 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 0/4] Add another way to check for MTE-tagged addresses on remote targets Content-Language: en-US To: Gustavo Romero , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20240328224850.2785280-1-gustavo.romero@linaro.org> <3d9dfd09-739d-45c9-a16c-9459734a4685@arm.com> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0138.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2c4::9) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|GV2PR08MB7929:EE_|DB1PEPF0003922D:EE_|AS8PR08MB6581:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: CKsvcsVt3YGGUzNaxSGnbKaqwWQmZxGg5pnF2iqQbOGxU8nXzKsGTl//rSWZsr+9QmXmSqiDObFtaUo86VfByqPQNr8rSCB5Se79ERWr2UjAsURxbeyHqyMTgBTCggXlnES8xQ4Wa6XiPbf8hfd9G0Op0JgxRzRyB5/Q+r7BgohP1/roOT2uxv2avbMxW+kNmjOOcRw85MdmmM1FjEOQoFXh9LUOW9IfK9GJALVvcb8gQz2l1gKCf5mTWis7qs6LlUd56E6fHhf+z3jCUF9IVlslkw8cTBsGNgiq0WMcM0qNE/ucXf2XkteFqqHTU9nhUJYEpWTVKODsb7uPaOw5OXXAkcwZdBLWQnQZz4vgbJ3S9o/Y6OFQ0PZyK8CG+jGSXAM2GS062Xt/Wh95kBRyC+smU6+JnqT/rBh3U+mxUCUeRdwIhiKJJz1p6hYWh/9ncgo2qXn7caQX2AnBnFb5GDEv4eHl0PCSDr2TmCMRL1Ny4kE6+9NNNGyhPKh0ATettJmv4/8M1bZ3r4JKQuDyHIkbubLCAtZRLL1TrbaGjHNzykJTj+Eiht5CALu2d17TRHIaJ3246PLB/JMhQbEr3GMaSBcz6UIPp4a+OL6yesw= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005); DIR:OUT; SFP:1102; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB7929 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF0003922D.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10bea388-68fe-42fb-e5d9-08dc53ebf174 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lgd13GmtHDv69K3rohMqYm0io+MutOC3TT8cuFsAaBZajHGfEPNCNxYioEZsfZVAM5+E7VVggdP8ykIM8TBtXuE1NnS5A9OnysCAoAXGgVwmFFcbHmMXOwsyDLzQOElwDNGkXFJHgP3MfqT1asJCMww1a7ZSGWHIKyKSg04jGe4iClvxMbQJ7d6ms10g6lOq4Yrk35XnT9114pNKgqxFfdH/fMf8BDKiq7PSpFI+B1pdkzWtY52qeJ9n+9n1G9idJR4TDsrVzAoz7OjVl4dPRTwnIUJoySU/e+7sKobZfH2kLt1KUuEB4tk0SixUWaLDA6vtZ61/kBHoh7pHrCsUjA6VwkkEqC/H7us99CRe1iY7UASvszce3zhif5PAGnx48SG3e8/a7y0Me9QkIHQJ+h9sDx/EQZv0Hi1wX28m1YUp5Hcu5WAYYuAaXNf4XC/ZJ9fwq4XxX2T8kwN0U9HNNYq2mcmRV2Er7npC/QLlDSFEiIQwN2n5HQwlSimr5ZOFim3WCkGKdiYfz6F6XUkcoFqanU0Fxm6YRRkqvoD09qKPIqjTqAO6y7LECJ4hMnrU70/Ybplt1yMTjmgTGrp3KpDU+rb92R0E0WTZR9UYJzl4REJIR1Rv5MeuGIKutNuh6v/VKXWG+7ZWw/eYXCFTXBXHo8KQqtfG77WsoH8bQE+hCkJDjiQD8kTWQ/Lag3o3616t8i5pgb3Ul0QjS/QkMA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(82310400014)(376005)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2024 14:40:01.3001 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 10bea388-68fe-42fb-e5d9-08dc53ebf174 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF0003922D.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6581 X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, KAM_DMARC_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org On 4/3/24 15:29, Gustavo Romero wrote: > Hi Luis, > > On 4/3/24 8:51 AM, Luis Machado wrote: >> Hi, >> >> On 3/28/24 22:48, Gustavo Romero wrote: >>> This series introduces a new method to check for MTE-tagged addresses on >>> remote targets. >>> >>> A new remote packet, qMemTagAddrCheck, is introduced, along with a new >>> remote feature associated with it, 'memory-tagging-check-add+'. Only >>> when 'memory-tagging-check-add+' feature is advertised GDB will use the >>> new packet to query if an address is tagged. >>> >>> This new mechanism allows for checking MTE addresses in an OS-agnostic >>> way, which is necessary when debugging targets that do not support >>> '/proc//smaps', as the current method of reading the smaps contents >>> fails in such cases. >>> >>> Since v1: >>>   - Fixed build error "no match for ‘operator!=’ (operand types are ‘packet_result’ and ‘packet_status’)" >>>     reported by Linaro CI bot, caused by a last-minute rebase; >>>   - Added instructions on how to test the series on a remote target using >>>     QEMU gdbstub (-g option) -- see below. >>>   ---- >>> >>> This series can be tested with the 'mte_t' binary found in: >>> https://people.linaro.org/~gustavo.romero/gdb, using the GDB >>> 'memory-tag print-allocation-tag' command to show the allocation >>> tag for array pointer 'a'. To download mte_t: >>> >>> $ wget https://people.linaro.org/~gustavo.romero/gdb/mte_t >>> $ chmod +x ./mte_t >>> >>> ... or build it from source: >>> >>> $ wget https://people.linaro.org/~gustavo.romero/gdb/mte_t.c >>> $ gcc -march=armv8.5-a+memtag -static -g3 -O0 mte_t.c -o mte_t >>> >>> For example, testing the address check for the aarch64_linux_nat.c >>> target: >>> >>> gromero@arm64:~/code$ ~/git/binutils-gdb_remote/build/gdb/gdb -q ./mte_t >>> Reading symbols from ./mte_t... >>> (gdb) run >>> Starting program: /home/gromero/code/mte_t >>> a[] address is 0xfffff7ffc000 >>> a[0] = 1 a[1] = 2 >>> 0x100fffff7ffc000 >>> a[0] = 3 a[1] = 2 >>> Expecting SIGSEGV... >>> >>> Program received signal SIGSEGV, Segmentation fault >>> Memory tag violation >>> Fault address unavailable. >>> 0x0000000000418658 in write () >>> (gdb) bt >>> #0  0x0000000000418658 in write () >>> #1  0x000000000040a3bc in _IO_new_file_write () >>> #2  0x0000000000409574 in new_do_write () >>> #3  0x000000000040ae20 in _IO_new_do_write () >>> #4  0x000000000040b55c in _IO_new_file_overflow () >>> #5  0x0000000000407414 in puts () >>> #6  0x000000000040088c in main () at mte_t.c:119 >>> (gdb) frame 6 >>> #6  0x000000000040088c in main () at mte_t.c:119 >>> 119                printf("...haven't got one\n"); >>> (gdb) memory-tag print-logical-tag a >>> $1 = 0x1 >>> (gdb) memory-tag print-allocation-tag &a[16] >>> $2 = 0x0 >>> (gdb)  # Tag mismatch >>> (gdb) >>> >>> >>> Testing address check on a core file: >>> >>> gromero@arm64:~/code$ ulimit -c unlimited >>> gromero@arm64:~/code$ ./mte_t >>> a[] address is 0xffffb3bcc000 >>> a[0] = 1 a[1] = 2 >>> 0x900ffffb3bcc000 >>> a[0] = 3 a[1] = 2 >>> Expecting SIGSEGV... >>> Segmentation fault (core dumped) >>> gromero@arm64:~/code$ ~/git/binutils-gdb_remote/build/gdb/gdb -q ./mte_t ./core >>> Reading symbols from ./mte_t... >>> [New LWP 256036] >>> Core was generated by `./mte_t'. >>> Program terminated with signal SIGSEGV, Segmentation fault >>> Memory tag violation >>> Fault address unavailable. >>> #0  0x0000000000418658 in write () >>> (gdb) bt >>> #0  0x0000000000418658 in write () >>> #1  0x000000000040a3bc in _IO_new_file_write () >>> #2  0x0000000000409574 in new_do_write () >>> #3  0x000000000040ae20 in _IO_new_do_write () >>> #4  0x000000000040b55c in _IO_new_file_overflow () >>> #5  0x0000000000407414 in puts () >>> #6  0x000000000040088c in main () at mte_t.c:119 >>> (gdb) frame 6 >>> #6  0x000000000040088c in main () at mte_t.c:119 >>> 119                printf("...haven't got one\n"); >>> (gdb) memory-tag print-logical-tag a >>> $1 = 0x9 >>> (gdb) memory-tag print-allocation-tag &a[16] >>> $2 = 0x0 >>> (gdb) # Tag mismatch >>> (gdb) >>> >>> >>> And, finally, testing it on a remote target using QEMU gdbstub >>> which supports the new 'memory-tagging-check-add+' feature (WIP). >>> >>> Clone and build QEMU: >>> >>> $ git clone --depth=1 --single-branch -b mte https://github.com/gromero/qemu.git >>> $ mkdir qemu/build && cd qemu/build >>> $ ../configure --target-list=aarch64-linux-user --disable-docs >>> $ make -j >>> $ wget https://people.linaro.org/~gustavo.romero/gdb/mte_t >>> $ chmod +x ./mte_t >>> $ ./qemu-aarch64 -g 1234 ./mte_t >>> >>> ... and connect to QEMU gdbstub from GDB: >>> >>> gromero@amd:~/git/binutils-gdb/build$ ./gdb/gdb -q >>> (gdb) target remote localhost:1234 >>> Remote debugging using localhost:1234 >>> Reading /tmp/qemu/build/mte_t from remote target... >>> warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. >>> Reading /tmp/qemu/build/mte_t from remote target... >>> Reading symbols from target:/tmp/qemu/build/mte_t... >>> (gdb) c >>> Continuing. >>> >>> Program received signal SIGSEGV, Segmentation fault >>> Memory tag violation >>> Fault address unavailable. >>> 0x0000000000407290 in puts () >>> (gdb) bt >>> #0  0x0000000000407290 in puts () >>> #1  0x000000000040088c in main () at mte_t.c:119 >>> (gdb) frame 1 >>> #1  0x000000000040088c in main () at mte_t.c:119 >>> 119    >>> (gdb) memory-tag print-allocation-tag a >>> $1 = 0x2 >>> (gdb) set debug remote on >>> (gdb) memory-tag print-allocation-tag a >>> [remote] Sending packet: $qMemTagAddrCheck:200400000802000#1f >>> [remote] Received Ack >>> [remote] Packet received: 01 >>> [remote] Sending packet: $qMemTags:400000802000,1:1#6f >>> [remote] Received Ack >>> [remote] Packet received: m02 >>> $2 = 0x2 >>> (gdb) >> >> Out of curiosity, I see you exercised native, core and QEMU-based remote debugging. Did you give the gdbserver-based remote debugging a try? >> >> I think that is an important check given a gdb + gdbserver debugging session will also use the remote target, but will instead rely on accessing the remote smaps file. > > Nope. I'll give it a try before sending v3 today. Awesome. Thanks. I'll do some checking locally with system emulation.