From patchwork Thu Mar 28 07:00:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 783587 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2572896wrt; Thu, 28 Mar 2024 00:02:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhd/r0IqT9Do63qZeLSWeZopi0wEnCjQaxEoX/fwOkh1Ionja7eb5AIcqVaVRBuEBANrNSyWq2gExAFC17LvX2 X-Google-Smtp-Source: AGHT+IEIsc6EBBDzw16OO0geZcQAfnPQyD7/CXbL8PT+L05oK2WNMqytsoE2Cg4BEcjTuz/PR5Cc X-Received: by 2002:a05:6122:459a:b0:4ca:80c5:7544 with SMTP id de26-20020a056122459a00b004ca80c57544mr2621958vkb.4.1711609326894; Thu, 28 Mar 2024 00:02:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711609326; cv=pass; d=google.com; s=arc-20160816; b=raKAAji9NNvkSYscECBwcBbZEh0d9SnypPwpB4qksG0rqqSIARG2jWwsxqOxGdr571 JaCU0d5aio6qzW+W5G7JOgXGXdqHVBGBueDdZf/qHe8QGNgW5LVwi1wFGVqWAUrIN4DV zanfPqrvmpIOPvpthGEbljHLCNNaMNVlu8tNTLp4Avg99ChpX7R/f6vMIFGzKExDkwUt RHBo2IY8YKR0WC6zdZ2KA7cfhwnN5yhV4EElXCWw578SLuKQbsRReYKrBUqum5NDrrlN nDIQtwuDvluYSAiSOrEqklw5wh8MrDnCB59XCsy44DaEj2vs3ac3GbCsPRFPr2vzRC8U 6lcA== 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=KMhIK92GkRiBx7sNL8LhIZ8p4iDg7dPzw1XEQvpaqKKEEet1bubAGZggkqazhabnkk jlheV6q+33ti42/+vq4h0R7tbU8nUAY0FA+4nx7zeriC8DlcS4j1+POHMUHSv8hV+Ed7 +qwBQt3QN22e+M4xRnotJCEEgcGeoL2/j7juWNn8TBv8pNxQhCktQqiqKDiXh5C4J9U9 nfHlJdRyyRlcV4vQrZi+frIpIcXZa5B0CMyTjBE4pl3555PhIucs8XVEuIBheNGykQ6s exWi1omg9mdxnG0/5SJJZ5elpRFLFbrhoEe1fzfsbfMtet36j9ysASp5HaWIG3j3IRIw 6fBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tYcjXBCR; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t10-20020a0cea2a000000b00696121a27c1si802967qvp.424.2024.03.28.00.02.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 00:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tYcjXBCR; arc=pass (i=1); spf=pass (google.com: domain of gdb-patches-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c 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 8549A385E82A for ; Thu, 28 Mar 2024 07:02:06 +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 709803858C36 for ; Thu, 28 Mar 2024 07:01:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 709803858C36 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 709803858C36 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=1711609292; cv=none; b=AOxJm/6ir7rPfr6qZvWVscd6FgiHzrbSZ8jIr8b8tRsyE3dOMaSAm2gBL1TonH7rHWecW6ngJIEPFPap6ihWyHvAQjMF6ZILE0b04585r24yWv6grD5nZd1+hy5DnoNdrL10zRtNLVrhLOO+zCinUrP26U1rWKLMWwOzkW8lyso= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711609292; c=relaxed/simple; bh=cw8HWoi0GK9IULJ9tjjvNvNLD3bq4hT65KiMLi9O98c=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=k/xh85h38bewXf1QYyKESlKqYpPNKGBusEbh5oSpwwHtcztKiJdS/63zcv3C7jAAfuc1jTgKEndihb/p1/J40BtEf1dTEhT07rRhoGYJ/6w08RhGROn7UkKEzYCG/uMkG3aTSvPvdsXfN9oHRTmVa+W0KDqN0BU+eBum/vvcHfw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1df01161b39so5612415ad.3 for ; Thu, 28 Mar 2024 00:01:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711609289; x=1712214089; 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=tYcjXBCRUiqpeFRHXmEyheiNDQ6yNLueTyi8JAlS0O1p3URrwk7TSIyzz1DiayG2lU eXm0bSizk9MRFSOmHKCrPS7OccKzRkMvP2mcGqbvLlwCtXscmYXbJi4VIEG/4s6OhDiZ hQi9uRyv27OVu/5U9HDOlXYOUbo+cZt+oqisZb2qGXzchxCtmKTWnq1xSu11ygWzyohz QscqJuLt3lrHJf6w22k9mpa7gAbXCA0uPYdndAjUvkDoeNI5wet8n8PXaMTxKb62Sxwx qYtfakyObTy1QavIdcsyxgWm7+S4e2sOn/UG+hD3G7VHbLvwWgyN5q3CwKEHAA7IXOly UYJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711609289; x=1712214089; 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=rf8Y5dogFT1dyUUHonIRZEM1D4j7VEmb4iHpn5D4BvY0VjHiJMvWuxS8tZcJa2J2PI xPN8yd5Ul2Z0gsev3gWnBv5nmLUQK9kB8CX29ETEDLlM6pbILy5jUgEXSomS2ftF7Rn0 Fmvmu0XRGeexrLpSXSUVvgpU4X7qVGe9oxv9/jePrhHpIz1Zs8gN6949mzNM4/lIhU+z Il4N3p+0Vp82wYVNYYVSBsEqZ9dEZsJXvEoRy7q3upFcF6hx6v+nsWyRhL4JyK+DICmg gTldkjSlZ/tP/Gvgfl4jXBbdaP8CE0RDHG40zueNp1qtjAd+RCVzsNeP6bQ05ZwS/dJ+ m1kA== X-Gm-Message-State: AOJu0YyuvBtRD+1/dbRmNEZtEzlDtRTHPXzKJ409ZQxcGPZPlsLatPPv fB5vNTszsuSlnXPe+QUZ35SSuHFsedLebu71Zdk1X/CTHJqg/JhlH+oBzGt2EppLrKm0deHnbWb G X-Received: by 2002:a17:902:6808:b0:1e0:e2b1:7395 with SMTP id h8-20020a170902680800b001e0e2b17395mr1864703plk.14.1711609289205; Thu, 28 Mar 2024 00:01:29 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:41b2:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id b15-20020a170902650f00b001e014627baasm754252plk.79.2024.03.28.00.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 00:01:28 -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 1/4] gdb: aarch64: Remove MTE address checking from get_memtag Date: Thu, 28 Mar 2024 07:00:52 +0000 Message-Id: <20240328070055.2578783-2-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328070055.2578783-1-gustavo.romero@linaro.org> References: <20240328070055.2578783-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 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 --- 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);