From patchwork Wed May 15 17:31:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 796988 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp3100764wra; Wed, 15 May 2024 10:33:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVYWrMmxlbgxemVpTTg4CRw+4dt4R8RAXj7SYcwVodupK4QRJz1CJPbU2VkG+hMhPgRkFyW6IiuKJpgNBOE1IBH X-Google-Smtp-Source: AGHT+IG89dsniIL0Yxa1EFouWGuXqhDptUSSfnVgv6t99ZUM5PL7Diq2WPs4EliJECTgtsJMq9V2 X-Received: by 2002:ac8:588d:0:b0:43a:bd5b:2558 with SMTP id d75a77b69052e-43dfdb0059amr191500451cf.36.1715794388481; Wed, 15 May 2024 10:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715794388; cv=none; d=google.com; s=arc-20160816; b=wAPR+vdwKrhiiCBS28lBq8WIQhZbqy1DaYvWJNZa29W+HHVTX/hsM5msX9nNUDwKVi YXKAGAuIt+AcPSahgNZibdP364mB+mWtkCqN34EHhtiRSjHa6M7ryJ1kfIGz9HEqF0ic HFInGrg+iOieEPiCpIvSKOwpAF0ryoSgWgVryEgBSZDwrePeGtJQr+88C27JmBD1WdcC 3GYcmS41OuVtlikM/GiU+xEt1kkw5Cmj4n2i/3XO0F2GDfyr+Uc5QH8+UKVAHQizDh80 +KTwI/ZEJQMISaFB/SZ6TbkQj3OjG/12c1NIrjfiXB5kfMk4R1tOaMnW4bbipSCfiv2c TNug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=XTFwLDtKNV9kJLHUz1V6pSQSBJq6wwvBM7AtVCdyiiQ=; fh=ZLVo7h1WCYX+mCQET83n+8bPmyNFw4pMQxFlbH8xyms=; b=IgwY/fKaybHZkZAjC6Y1kt434kaKpo4K972dHkaQU+huG1GoIa26Mvz3MMyGgcK262 EVyxvWAyo47GDFCEs72wT2v1ZOwbJgEdGACrykUaeO6p41zbdi4iX7AF0biXDLjGkbz0 rd/tYIIv3UuFdejXHUO8SO8yHPkla9o6rZk9FKH5odQs6m45fL8lSCwliFauySbOTGg7 L/56joKn0fuSH3OZqz0/kXA1EJeDzUIHGg+ZgJCQjCI4oFV1Ek0nP+O5/J32brb5ooZe HT20JonxKo9arotBveyEOg9fp+MkmF2OyBr95X+Zoa7yVEcfxIsncxzWxVoz4tgLP1Lr YH5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3Cbu7nP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-43df567014esi146982471cf.299.2024.05.15.10.33.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 10:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P3Cbu7nP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7IUO-0005Da-Ke; Wed, 15 May 2024 13:32:29 -0400 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 1s7IUJ-0005D2-Nh for qemu-devel@nongnu.org; Wed, 15 May 2024 13:32:23 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7IUH-0002Av-TA for qemu-devel@nongnu.org; Wed, 15 May 2024 13:32:23 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6f44390e328so6532511b3a.2 for ; Wed, 15 May 2024 10:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715794338; x=1716399138; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XTFwLDtKNV9kJLHUz1V6pSQSBJq6wwvBM7AtVCdyiiQ=; b=P3Cbu7nP1vRMJ0ZjVrHHQXY+lfXIUtRh+jzqQZIerDCMlzkpkRWmMHlO3jdQhuvBCi hqGpZkg7H/2jhSQ5+EVG/kpaYiTC1g2KW+OyzidWm/6phn8NroAi9chlesfeWQT4KekT AtdQDBhxA3BfYeigE/10TLSX3S7yhBlDMYIM2Igrml2POpxfgcK/TTFlgUFAAu+Ebfwl peA+PiiCQETGhjWVUIZdGSQcABI7yN6fTgLDHkDOLtsNQel9eks9xzGcokxFCi7bYHW5 Oy1JQ8WgPBv1N6wPrGBCwlPPYUnF2LqvSfylm0PslBJix7QXarIGPjVT9crdb2+sYou4 ZdyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715794338; x=1716399138; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XTFwLDtKNV9kJLHUz1V6pSQSBJq6wwvBM7AtVCdyiiQ=; b=DqBw7pVhPvL6vSjKDkKSCRSOoDTk32L+xUg2xXnZTWmEdylV2voKozHMXYE0Dwwgha Zv9cHlxi1sU8gQB+dpDhZuQsSvJvFC7sBk0yUNeGo+A+IiKknnvwG0+9qVn4MqyQXFM1 E9+bkph6B7VC0BCFJfiAebpdfKeT5DxXSEa3rqtw6sSphYzCEB5TlMDYN/axoTu0J0iU lRm6DOQcuYz8hXDW+IupP8I9vEZ+FNSCZwIpSQletp0HHIbm7mnEhQQfILDP1da0/snF 6I5Yaa+54oakPIs/jF0pFn0TgVHs7CblIWwbYDkL/7rWoZznXzRtCyxISclhhy99Ya9C 8rHQ== X-Gm-Message-State: AOJu0YyyI9XOraJpuohP0v3KNNFL8Wh3PTCtHY1sW0MyCROelwcVZo7p N3ySK7CIAT5f5C97VqDrJTE6iNsl/Oh13WdPpZmVK2RcbY5Q+PHDMcpIuozQWXb4o13YixDhmpA X X-Received: by 2002:a05:6a21:35c6:b0:1af:63fc:4125 with SMTP id adf61e73a8af0-1afde1df6c2mr17943627637.62.1715794337734; Wed, 15 May 2024 10:32:17 -0700 (PDT) Received: from amd.. ([2804:7f0:b401:224b:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a66c6asm11365133b3a.6.2024.05.15.10.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 10:32:17 -0700 (PDT) From: Gustavo Romero To: qemu-devel@nongnu.org, philmd@linaro.org, peter.maydell@linaro.org, alex.bennee@linaro.org, richard.henderson@linaro.org Cc: gustavo.romero@linaro.org Subject: [PATCH 0/4] Add MTE stubs for aarch64 user mode Date: Wed, 15 May 2024 17:31:28 +0000 Message-Id: <20240515173132.2462201-1-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=gustavo.romero@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This patchset adds the stubs necessary to support GDB memory tagging commands on QEMU aarch64 user mode. These new stubs handle the qIsAddressTagged, qMemTag, and QMemTag packets, which allow GDB memory tagging subcommands 'check', 'print-allocation-tag', and 'set-allocation-tag' to work. The remaining memory tagging commands ('print-logical-tag' and 'with-logical-tag') will also work, but they don't rely on any stub because they perform local operations. Since the memory tagging stubs are not common to all architectures, this patchset also introduces three functions: set_query_supported_arch, set_gdb_gen_query_table_arch, and set_gdb_gen_set_table_arch. These functions can be used to extend the target-specific 'qSupported' feature string and the handlers for the 'q' (query) and 'Q' (set) packets. These new functions are used to add the MTE stubs for the aarch64 gdbstub. Note that this patchset requires a GDB that supports the qIsAddressTagged packet (recently added to GDB), so the gdbstub MTE tests introduced by it must be run using GDB's master branch, since the GDB in the distros hasn't picked up the change yet. Once GDB is built and installed locally, the tests can be exercised, for example, this way: make GDB=~/.local/bin/gdb run-tcg-tests-aarch64-linux-user -j 32 Cheers, Gustavo Gustavo Romero (4): gdbstub: Add support for target-specific stubs gdbstub: Add support for MTE in user mode tests: Gently exit from GDB when tests complete tests/tcg/aarch64: Add MTE gdbstub tests configs/targets/aarch64-linux-user.mak | 2 +- gdbstub/gdbstub.c | 108 +++++---- gdbstub/internals.h | 22 -- gdbstub/syscalls.c | 1 + include/exec/gdbstub.h | 86 ++++++- target/arm/cpu.c | 1 + target/arm/gdbstub.c | 321 +++++++++++++++++++++++++ target/arm/internals.h | 2 + tests/guest-debug/test_gdbstub.py | 2 +- tests/tcg/aarch64/Makefile.target | 11 +- tests/tcg/aarch64/gdbstub/test-mte.py | 86 +++++++ tests/tcg/aarch64/mte-8.c | 102 ++++++++ 12 files changed, 670 insertions(+), 74 deletions(-) create mode 100644 tests/tcg/aarch64/gdbstub/test-mte.py create mode 100644 tests/tcg/aarch64/mte-8.c