From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8IoXEzD0BWZrCBoAWB0awg (envelope-from ) for ; Thu, 28 Mar 2024 18:50:24 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=w3tdlu0O; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4930A1E0C0; Thu, 28 Mar 2024 18:50:24 -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 295E41E08C for ; Thu, 28 Mar 2024 18:50:22 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83AC5385E450 for ; Thu, 28 Mar 2024 22:50:21 +0000 (GMT) Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 4E2523858D3C for ; Thu, 28 Mar 2024 22:49:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E2523858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4E2523858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::636 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666188; cv=none; b=EVRN9BfGEpFGGvCQsoDbdJnDA68yrqbTuxcupdNpMEv35HuCyRlncVuQk6hODBj4GiY+ffEeonL21lYKyo4ZG4uNCKC1tPc8ks5GpCSUix/7Y5TLjzJTQd3SgbVuyG9aXHniLvhI7qGEat2JUZhtJtVOnGimMl97GXJAuESowhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666188; c=relaxed/simple; bh=Ot07zx98/HzRqfFiuW6mucw3t+ApYoI7a9eYGtpH+b0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=wHLlX8Rv6kwgdCHrwztGJZ+kBqqX79o3clZYiEBlVMpy28NslzsPMFWOtXaN9YZeOINESVa4o/CFtUhi8RdbA7JNbkwKFoFp4KSxVheUPKeuBTx3UdnFuIiibFT8NBdQRFGQ8Y/JDgXu6WQ1CGTI5hR2L0NMIaYXob9gmx3Q43M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e0f0398553so14662725ad.3 for ; Thu, 28 Mar 2024 15:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711666185; x=1712270985; darn=sourceware.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=ilag/Jr+6TNnOGN02ZgOKlgSmIgtYGupLlm4g6mhHbQ=; b=w3tdlu0OvciO8p8Ubr2Gtoy2C0Jd+GCWQM8JKplflsMiR4frmS+OpdQMgAH+4GB8AD JujasGYs/cC/MvE2NAw+Z+TLKqVaALUO32G5WIc1yXl+DOeRur7dy5GJkRuY9F8E6Bj7 9EfQEIw3pA8fdfWTXcnLHxwQ70mriWZ75X+LtHALSX/g4JJ9IRf2LDpcbNFk8r0kZESp zNSGEAU8xO43+hlKcRTqe79PPL8qWeORvYfMUj+dNi/CWq5UGpFxJABI1wZfhUSR7Zrf 25NEnvbacboHKf5m0Tywp4xOzY2Z4YHG80jYK8r89iFbMaZAvksFxgeumfO5kbHCMmcq J/eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711666185; x=1712270985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ilag/Jr+6TNnOGN02ZgOKlgSmIgtYGupLlm4g6mhHbQ=; b=ml8xVvfCl6VwVhqUPkjinyohT8U1XW5xsXXtrbTn9qsDV8wuiTvJKPSkg47Y5221bt Xa1Ip3474kcrXAPMBxOCBX3N7g17x+LFkz7KCS4qe1rb1cDUC5pT+T1w5O5scgHC+/2F ZttgTNsMHN+toJ2KinSxWayJTL/ZNMatnOlxXPwz5bXAsRG89f1riLXaOlpdxTZ0x6SC lLxAMyHE0ND4J6aCEl/7cPw2KxxWYyUUWJIPcltaVIbUznSoxx9MzOOwcNu1LqTUxsjP meM1nk+dl1oUfbnARxjPjDTfJjHRFHqn6OMGa/nnQrs1y/LL6TJmeT1fh11TLGoLN0r1 7IPQ== X-Gm-Message-State: AOJu0YwSO8vOmBKxdRhFzY9i6gAp57+aMSR7tXsClOwfbvJpQ1KI7/df gNaL+qai8DjgMDzlCtw/18uO9ka2xlyJga/O+0d94hqeptKEXHuphA4aLG5a5zwkP34Cq2n1gyF w X-Google-Smtp-Source: AGHT+IFEqQeL98yVcGr6isu8TjFZPIGDexp28qW5K6Lhcvgim/nSk4Wu9Z34aBHdV4dyZvgxDoUTIw== X-Received: by 2002:a17:903:22cb:b0:1e0:b1e9:afb2 with SMTP id y11-20020a17090322cb00b001e0b1e9afb2mr1119745plg.7.1711666184830; Thu, 28 Mar 2024 15:49:44 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:d0dc:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id t4-20020a170902e84400b001d8be6d1ec4sm2162999plg.39.2024.03.28.15.49.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:49:44 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v2 2/4] gdb: aarch64: Move MTE address check out of set_memtag Date: Thu, 28 Mar 2024 22:48:48 +0000 Message-Id: <20240328224850.2785280-3-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328224850.2785280-1-gustavo.romero@linaro.org> References: <20240328224850.2785280-1-gustavo.romero@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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 Move MTE address check out of set_memtag and add this check to the upper layer, before set_memtag is called. This is a preparation for using a target hook instead of a gdbarch hook MTE address checks. Signed-off-by: Gustavo Romero --- gdb/aarch64-linux-tdep.c | 4 ---- gdb/printcmd.c | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 50055ac3f48..8e6e63d4dcb 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2525,10 +2525,6 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address, /* Remove the top byte. */ addr = gdbarch_remove_non_address_bits (gdbarch, addr); - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return false; - /* With G being the number of tag granules and N the number of tags passed in, we can have the following cases: diff --git a/gdb/printcmd.c b/gdb/printcmd.c index cb0d32aa4bc..ae4d640ccf2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -3127,6 +3127,12 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty) /* Parse the input. */ parse_set_allocation_tag_input (args, &val, &length, tags); + /* If the address is not in a region memory mapped with a memory tagging + flag, it is no use trying to manipulate its allocation tag. */ + if (!gdbarch_tagged_address_p (current_inferior ()->arch (), val)) { + show_addr_not_tagged (value_as_address(val)); + } + if (!gdbarch_set_memtags (current_inferior ()->arch (), val, length, tags, memtag_type::allocation)) gdb_printf (_("Could not update the allocation tag(s).\n")); -- 2.34.1