From patchwork Thu Apr 18 20:10:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 789867 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp750571wrm; Thu, 18 Apr 2024 13:11:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW0S8l3IklaUVyD5DckkJU5mulA4mjkI8l1TMyJ/t4uV8CszCn646dy+RnF5BJ+dOWNBd4tkpUs3I4QKcFtZAHB X-Google-Smtp-Source: AGHT+IEVMvSCA9MIpnsO/Vx/Cq9y4OtukMzzzL11z51BRkw/SYb2L5kIcbCSc4lkWwUdGDRPTaYy X-Received: by 2002:a9d:6288:0:b0:6eb:7ff8:5270 with SMTP id x8-20020a9d6288000000b006eb7ff85270mr60915otk.18.1713471095812; Thu, 18 Apr 2024 13:11:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713471095; cv=pass; d=google.com; s=arc-20160816; b=rrhxalPs1Vv/oEFqagYbGFyNi5cz3nnrgiR/ZbF2VQqSRy90/AIMP6c3ZXlvj43qzp sfXyQ3Ol1wf3G8l96supxdA1BDiB0v2auFnlYgDerDoRMsI9zBgXwf5knEuPFRp4vqof CPYyb6tLsrJVoEHpyNZ4OJTQlk/Ed6sCC+Rq30SYgQFLIPee9VZIv45tNmWOTIbEb+wq 4+ek2b3Lwjs7LxMtc34uaB4EFB/mOpO+elbhudH+5yBV2YOe0lJccw6VZAp/27ASSDnZ 3iwEHiN9zS6JW33NY4FkwuoyLEBD+jtnv24/z5j7Cyvko2KaZQlLqs8AE1bz7qgKwn6w 7frQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=tYCk/P1xjalYBJuMqLUvPVXaT9Bbd2Fw6xG3npnM6gg=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=iwOEOCZnC2okBqdlu5mxEFrPhJLmto0OOWd3OLViNlee+14/KU83u+e49fIbE7tO5E JNNhmAvWwC0ISx9QeIpJoIaEKTCPDIMDysqU9+u8idzDQBBXFvyzVhTiM5t56qCh4ABK G81118u/4Eq39Znq6AWfCYyDA0sNi0ZpXbAzaQl7vCBON0rrsLO+X9GcgEN7085/lje7 oW8muR/Du8ZbobLSCOBVt/nwHXFKxaBBDZIUJvlAFlIJz9BrWlyfHvCouj1+KSeFPDJK 2Ls+FD8AhvYvZbgQBcUZ0I/n9zJ+3HnA9B9NLd0HvkpWvSsHLEppXOrqIOcBYKrqlzwD wtQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBez6f7J; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id pi4-20020a05620a378400b0078bcbec867esi2115141qkn.597.2024.04.18.13.11.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 13:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBez6f7J; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gdb-patches-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 655CF3858C35 for ; Thu, 18 Apr 2024 20:11:35 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 115153858D3C for ; Thu, 18 Apr 2024 20:10:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 115153858D3C 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 115153858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713471061; cv=none; b=jkw90a7h4eltISzwABjFdHMkUNLtAfqwcLLBTOUpj9iocxkmN/fCa2Fofzf5ZhF7DnqovQWgMwQRftIMA/gqnUaVAhV3baffvvAZRUDaP1uBu7VQ75cmVpVVhMRQwuV8K3SajaA3mG31TY93kPzIaOAIYVi9t1vYcxo9Oh89NvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713471061; c=relaxed/simple; bh=zn4DbmTot8VHmhi87qT4JPigPp9gYVtGLVN1Tzseteg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=x68cJ9mXBMeaR33HHLYNAF3PLJmZOtPvRY8lflrnNBfpRdVvycoAGtGV2aWZx4h9xAABoMYPHIt3dvrYcw+M/hP37zNB8o+P9ctruD+/SLO40E4JUumlIpmSFi398SkazSIo9yKN+6tGY3YMVAbAO5/c/v1P0HJSpF9N7VtnNdk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e3f6f03594so11065825ad.0 for ; Thu, 18 Apr 2024 13:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713471055; x=1714075855; 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=tYCk/P1xjalYBJuMqLUvPVXaT9Bbd2Fw6xG3npnM6gg=; b=SBez6f7Jhqj0Jz5dyGKXaZUoWAX7O8SeM0MAEjgvyASnGtdMZrUL1y02toyHOVWudB t5TbZVPFuQ62b2dn2cnxW6D8dYrbTFF3qQksD2cNu5MDmcUVNId1GHa+T6rROdjL8lvH Ly/5jVOp0cMkzN3uATkOponSODIMqMml9MFy5GKQyLuif3bFcg4ihxWwkj8lZ0VWNdVT 1kQhvZneSed3gpYswt2SepCfWn3LHfovSJwMg1sZe8WtiPxLA8v5QBcO9JPl28MdWq+R i1NLPM2Fb2gk7v1Ny7m4lcHxnpQ+7lb9awK5vBO4GkU5poijNa+ZOb4+ZZ62f4gRwshV aB5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713471055; x=1714075855; 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=tYCk/P1xjalYBJuMqLUvPVXaT9Bbd2Fw6xG3npnM6gg=; b=AITMxVEeZZf6vRC5s4TT33Z/XyRUfZ+6qWHDefGb8Tj4vZTvsXySXZTz+TPWTuIC+4 mLVewQNFxauB7byWfSpaJc7pCtH3tMIOy0vLIwU+0MMrjEBEnghs2nlEHaTmr4lsn8q1 WYkJey02pDSUoFAv36MdK5cZyRfrg947B0rAPKh3zVc/9C9jNNfzOt91a7Ojzf2yKYgK zf+wVjySL6VfGKzdYBlbLLTsMhZyOu9nC7F5PL8lIw1ejmI5BPGJtitnuf1MB7az1frT fULCAfEOFzUmLsnLMriDhsVZY+LNzdqh1DdP0RCNa1tD9s5sAvYLlwejAEk/ZWD6kFCh vpuw== X-Gm-Message-State: AOJu0Yy6kM7TBgfeBXN8Muz4TjjH/ZUPGLQt8LzmMJzqyFjPCUrpc6Qn U/OP1JC3PRDn6AFE6l5LbUcebranvUb7FjDpvVMnU8JVJiihNqEFnvx/msEtxXlBF/dlkjaE4ax P X-Received: by 2002:a17:902:da87:b0:1e4:6243:8543 with SMTP id j7-20020a170902da8700b001e462438543mr213798plx.5.1713471055453; Thu, 18 Apr 2024 13:10:55 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id n18-20020a170903111200b001e0b5eee802sm1925524plh.123.2024.04.18.13.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 13:10:54 -0700 (PDT) From: Gustavo Romero To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, eliz@gnu.org, tom@tromey.com, gustavo.romero@linaro.org Subject: [PATCH v6 1/8] gdb: aarch64: Remove MTE address checking from get_memtag Date: Thu, 18 Apr 2024 20:10:32 +0000 Message-Id: <20240418201039.236867-2-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240418201039.236867-1-gustavo.romero@linaro.org> References: <20240418201039.236867-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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+patch=linaro.org@sourceware.org This commit removes aarch64_linux_tagged_address_p from aarch64_linux_get_memtag. aarch64_linux_tagged_address_p checks if an address is tagged (MTE) or not. The check is redundant because aarch64_linux_get_memtag is always called from the upper layers (i.e. from printcmd.c via gdbarch hook gdbarch_get_memtag) after either gdbarch_tagged_address_p (that already points to aarch64_linux_tagged_address_p) has been called or after should_validate_memtags (that calls gdbarch_tagged_address_p at the end) has been called, so the address is already checked. Hence: a) in print_command_1, aarch64_linux_get_memtag (via gdbarch_get_memtag hook) is called but only after should_validate_memtags, which calls gdbarch_tagged_address_p; b) in do_examine, aarch64_linux_get_memtag is also called only after gdbarch_tagged_address_p is directly called; c) in memory_tag_check_command, gdbarch_get_memtag is called -- tags matching or not -- after the initial check via direct call to gdbarch_tagged_address_p; d) in memory_tag_print_tag_command, address is checked directly via gdbarch_tagged_address_p before gdbarch_get_memtag is called. Also, because after this change the address checking only happens at the upper layer it now allows the address checking to be specialized easily per target, via a target hook. Signed-off-by: Gustavo Romero Reviewed-by: Thiago Jung Bauermann Approved-By: Luis Machado Tested-By: Luis Machado --- gdb/aarch64-linux-tdep.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 0b9784f38e4..50055ac3f48 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2575,10 +2575,6 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address, tag = aarch64_mte_get_ltag (addr); else { - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return nullptr; - /* Remove the top byte. */ addr = gdbarch_remove_non_address_bits (gdbarch, addr); std::optional atag = aarch64_mte_get_atag (addr);