From patchwork Thu Mar 28 22:48:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 783638 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2965886wrt; Thu, 28 Mar 2024 15:49:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZR9hghkZ2ujW9GE1uLsrTU7Npf8NkfnDB8+ro6ektVVVgMStnTCDO3uW07kMjlod2JYbFiIvX/LT9yvVz+wBs X-Google-Smtp-Source: AGHT+IFF9jvmygMlCBBgGQGLGN2s2WeRnP+62tdCdKl/g9RM3/z59XpSl3k926IKeb/HXnXFQmtu X-Received: by 2002:a05:620a:1920:b0:78a:6b2d:1c79 with SMTP id bj32-20020a05620a192000b0078a6b2d1c79mr1097223qkb.8.1711666189216; Thu, 28 Mar 2024 15:49:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711666189; cv=pass; d=google.com; s=arc-20160816; b=jE4AiYcxtqB0NrSMC+PrKSpI4OqBjem4nitn3oICC6bcVMxfqBra852JKGJz+RStUw 6H/ICNDLJfbeqaCjIsU5BEgClSLdxe3e36piqvMfS3ywH26tv2sPw1sQa21qp37p0Va8 Ik3HKUERRY8grC7WoqjE5V8lvgPB/x1O1K5JWVf/i8ebtFt8pbN3RHqhZB2m+52EIlFd 8YFhmoOdpK/MV+SKbMDkC5Er31bkz9Hy5TdP5UczQSUvrWs0iy48IlypvhRtvg4Xhzqw QW1qW5sJQK97pYyDcX04eGNc5zqswgwqtu+LWAaTg9NAra/0ZXWKPf6Lasjyyr0gvR2U aMKQ== 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=GmrXSAQWGBoEsD1JTGXAnrjztPWXOpPhFjyHBjPIkOb71teGbI+MwIvTZMJ5YWh9TT 10EwWMRsZKjg0cCduqPHFpYeoieyYVxnT9Og062eL7J/GbZuSdwozJjrT+WHVGA6N363 0nqClV8r8LUwXmH9MapaZrX+rnnDOwGxy2ZUMMXGN9KpAWU5qtrp5CwMZ8BatFDwi9+N E7Ps8JGRiWjZvmc5bU30m20Z+0oqFpD7oGZOgnDSc+nJ+c0zxw1n+ST+3gosltsA9T+J iOW2eOmxsvScIiuOV7Syx5dpcdFRicqE44SkeVJdOpYVJqtWxwPlVMtEq8zUCoBu0m7y ECQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jTHqrtJL; 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 y17-20020a37e311000000b0078a4534419bsi2344669qki.326.2024.03.28.15.49.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:49:49 -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=jTHqrtJL; 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 D0CF7385843B for ; Thu, 28 Mar 2024 22:49:48 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 61D7E3858D33 for ; Thu, 28 Mar 2024 22:49:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61D7E3858D33 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 61D7E3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666186; cv=none; b=mRasjPhmWYrWvFSaxB/GRhZnUNcqA53U6AiwrKQHdFqANldPahbhJLejOGzHuCkZjuFZtxpIjAPQxzxj6IksUIYLsjCM5yBFgXIH4KMWH2LutAWaascWAe2A9e2Jq+S7D+pX+mAcxH/LLQkrZQSDjmWsO2CCvVhcY+6N5Fr6F1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711666186; c=relaxed/simple; bh=cw8HWoi0GK9IULJ9tjjvNvNLD3bq4hT65KiMLi9O98c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=L74qLKPo6fT+2LbTMLFv0iKu8yr+T+sL0PGMXNBjac2fH2YEcFtkrGScf6eiotpRH1wCkzTYDSXd7yXlTwfTZZUmi3uCCEdoNhlrxEDXkJMJcikeOa7p3LolYIp38lJ4QAGePyqNWZOXrezYs2NWWHFEIQ/CBRw8Sp65+WiUT0A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e220e40998so6942075ad.1 for ; Thu, 28 Mar 2024 15:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711666183; x=1712270983; 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; b=jTHqrtJLf0iNT0KHECkJJDqjPvdcFJm6lJMHmKxcWWY66QRAYiqIkePPatgF4yBwys rTYMQDx4IvKQm60jWwLF6pHMCI+8G4YFWzq6osNIS0PCRfzBFvJ2j4BfGmTgXPPvSREi Oys+uEu/QVbECjyDLTF16oVD6HhRybTm6qBT02zV4GaOa4GJyv7rmdJmlYiZhEDc05cM 1APwxP/Gd+HEfmUXxcbGllAaYnG1qCzSKPl17VBIPP6LaUtsuxoihUlX0UnqwmUgCTa0 rVinejkZxGrMQxwm3ETKECI4wg2kQl+Zr4C7DBGMxX1Z9aQHziblaqLhSE8aa3P/Ohfx 9O2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711666183; x=1712270983; 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=nFpODmsS60D0MgO2Sq0vHP1Bf80f04kJ09zfTtn5e6M=; b=MzDmre629ocDJuhux3oMw8vpcTar9RKuvEtDWnCKviep3wkAjKrBb6WDYnibAr8lPB 7we1+cT6hfkRFHWzOnqcga24ZPzAhkSVlykzSKqFwhZ1Ojj4qvxJfWh1NIEw9yX1Jpmt KYd0QZJun2KlflBwNTPU9ar1ZhyE+pFHIBbYTfd+1juhwynEVxCHNlYFuh9VsV6T8jA0 TN2THDHuooyG3f2IkeoidAbQK7RbTg78bIcXpX2tNSYFQUXYITEd3SKKswKE/nsbkjnE pkGwvlF1cmkaCecGdxECWHYlEuSyyF9hgGFcCOj/mOi9zbGnTILoYWK3Uona1wjV/uci evYw== X-Gm-Message-State: AOJu0YzNJYKixnUKU/ThzoJ9gIejWhiZwVx69+fzoLx2b/NDhLyz1CbN hTbbTPDaBqSqhxFjCfuq5rcaODyWV4lA4Zl1gTfrOYvVGzZ6OQ4UyDyITKCyepDWhH/q4fPKAho R X-Received: by 2002:a17:902:e849:b0:1e0:b871:53f5 with SMTP id t9-20020a170902e84900b001e0b87153f5mr1168238plg.20.1711666182872; Thu, 28 Mar 2024 15:49:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 15:49:42 -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 1/4] gdb: aarch64: Remove MTE address checking from get_memtag Date: Thu, 28 Mar 2024 22:48:47 +0000 Message-Id: <20240328224850.2785280-2-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 X-Spam-Status: No, score=-12.1 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 --- 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);