From patchwork Thu Apr 18 20:10:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 88682 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C378B384AB7D for ; Thu, 18 Apr 2024 20:12:13 +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 B7FCF384AB4D for ; Thu, 18 Apr 2024 20:11:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7FCF384AB4D 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 B7FCF384AB4D 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=1713471066; cv=none; b=m6PRqMkN82JaTV3j8M4B9X8FIo9/TuhSSw9WPV5ukc/Tmv0UGD3/g+nw/BdiTqf98dzJe1S8CQlAYRiPgVIMZ6E9/O8RUVyqjzK1mnARorSt+CuDhN2ZudYhDvT/5fEA3aWJDmB0/G5WMktbzJ14/N9dTsjnmowb7dHmYx+MALM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713471066; c=relaxed/simple; bh=WxhGoGvDUNyHMS4tOjdoth41+fxv5hm536NHqm7b6zY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=HobDDOpRomJ9wTyErMLoz9lRgA9n+8cou2Wr16vyeyaBjF1kFP6GBJuwZ1k43daYLw5N/pukfV63pTj1edTJjpzQTs85cHrIJ6P3sprHlDDqKVSNBA0OO8/8J2Jq3UM6Mt7uEy2LbZFrWC30ugL2pLCDQUxaVmGshAdqwWU9zs0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e651a9f3ffso8745425ad.1 for ; Thu, 18 Apr 2024 13:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713471061; x=1714075861; 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; b=mEdzXJOunFWbDcEMuYPeyp5lkm/bjmeTUalLBGJP8Yq1xngt7ToWKo/rgEfRS9grdv UC2l7oELGf3bMW7u8KM0125hFDL50DvO4R6kIBDfjsuvW5tT0XDfbbnvSlW34ERu6wSV RMEekvQR3qmfM4kGVq6ryMBBFsjsvGpnh4ALi/rsu56V+EwiUfnlHrWTfOjPhtJGAv25 +kPevrwn2cuRZiJt8pb82BT0BpU7BZjPDkshNwZG7ctKFGzOqnQ1SDr6CtcM5REayJbQ kJYZYlAtRk0hcgZQUggKSJPW1vlumjpE2WHXcAtKtbm4usdITErQiRSlJaDks1rgFzek 3OAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713471061; x=1714075861; 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; b=b24GlQQp/Mddi5qaTasP9MUacbgZIGyCGzYEwuSymxwO3aaAyvz/tzHip829f229YJ WsNnsZPJuUYOjDkKSfCQ5il/rtr2vfaZQ5BKldjZ0jAN/WZKiMhm1knlsIqWO4gxfpLl A5brUTpveJIEeQZkxT2/cgNjSBON+INciUg8whDoYm5j85LvlY1dzj8dg9SF0jfWihan 9IvJyCSzOT5FKY0BtNgNZGQYz0P6uiBWo3hPBFQJuABrhjDe0XRBh7szHr/FFfLtRl1S mkKsbf47cnd2R5lJQfnfynSWUTOv7ETmmU0ohOGKlmjKmOw+wTMItxc7e9ggXPaktGmL 6Nqg== X-Gm-Message-State: AOJu0YzgxfqJNm4WaPMKchxrlq7iNsG2CBzjSRExSZ2lLc15+hoio7Pe xsvhvg2awwwaQpOduCcwsdkHqx9807BwErsh1tHZbO5ld4F2vIuqs4bk5J0txQrEvYnniqgpZbY I X-Google-Smtp-Source: AGHT+IFUQA0JfA2j53L1utS1sGth7++ZreK7oNgLFZLAeuGPY3U0/aoxQcOIHVFj4ts/xmybAnff3w== X-Received: by 2002:a17:902:d386:b0:1e3:f012:568d with SMTP id e6-20020a170902d38600b001e3f012568dmr146824pld.15.1713471061205; Thu, 18 Apr 2024 13:11:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 13:11:00 -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 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Thu, 18 Apr 2024 20:10:34 +0000 Message-Id: <20240418201039.236867-4-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.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+patchwork=sourceware.org@sourceware.org This commit removes aarch64_linux_tagged_address_p from aarch64_linux_memtag_matches_p. aarch64_linux_tagged_address_p checks if an address is tagged (MTE) or not. The check is redundant because aarch64_linux_memtag_matches_p is always called from the upper layers (i.e. from printcmd.c via gdbarch hook gdbarch_memtag_matches_p) 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, gdbarch_memtag_matches_p is called only after should_validate_memtags is called, which checks the address at its end; b) in memory_tag_check_command, gdbarch_memtag_matches_p is called only after gdbarch_tagged_address_p is called directly. 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 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 8e6e63d4dcb..fc60e602748 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2476,10 +2476,6 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch, { gdb_assert (address != nullptr); - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return true; - CORE_ADDR addr = value_as_address (address); /* Fetch the allocation tag for ADDRESS. */