From patchwork Tue Apr 16 14:07:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 789232 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:dcf:b0:346:15ad:a2a with SMTP id dw15csp304918wrb; Tue, 16 Apr 2024 07:09:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbXNhd+Ab0Br8ItFecrs1+4BwryGi8hm4ZJWTW/+t8dGOf4cvBZcyPV7R26XS6CEGd5HvbdNcwV0dnSKAikJws X-Google-Smtp-Source: AGHT+IG/MpNMhF0ptixtdEGbxCJt0cNxjT3EB6dSS2VD98+uKyo2GDq3NPtYPHENZf32NemPKhEt X-Received: by 2002:a05:620a:190c:b0:78d:7802:16fc with SMTP id bj12-20020a05620a190c00b0078d780216fcmr15862541qkb.49.1713276549785; Tue, 16 Apr 2024 07:09:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713276549; cv=pass; d=google.com; s=arc-20160816; b=aaJKDT6xduIrSKPpXxu8FqsI9daGkZbdQdp77qzHi9blLIY6W/JRHb7BhzH7929ZXP a+ANu9oIG819D+zKeNx3zi9FP0sz12VlYUc2i4qzaOe3bUxSlhetv+4QhlHGtH0QQo+z jXRT4jTWG6iSquqUrpvynlLqW+a/o0Ra44RZtVe9BcNPXZIz3r9LGaHg9cRiWuVooPxZ DI9ULMuXbcPXcIVR/+W3JolQ67Xrnwnf8XV3klqfrJA1PO3AVDZuJF9QKEccyORW5Csm xk1WVu8sOcmKWhCOhfa5ur2KgKexDSxROgf9qX/2OEyFlYFkfo5jvRgx1D5w9Qz6uqaX DS/Q== 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=k4t/OkSdqXOFOVdbmZG+QDE0aaiWd592cOChHpmR15U=; fh=PHP0XrDyWzrRvU96cs6sxWXpzsZ2PqUxQqbJpAaSNaA=; b=NXXjjFecaO8kpeSZpGtSvjVu7GpUgAVvU4ppuO5+j5iey1KdGZ9ahF5kP2kkhljK1D 01vMFHWWLzXldz5W6YKB5cHAKhpBU7Hv7CKMv21pBWrazTM4qg0beWM1ObF/n5qnyhuq AF3uGBnFcWloOcS1Ihz4R6qx/c1QMpUZjfVpts/RnbMNgQXybcp8EwHIXpHk6VPeFw9C Sj76H3JTKPfXSekYGQgrfA46s7bhv+1WMduYuxP9eOdCngLb5lVvvzR/FRcGMhwC63+S 0Bx8L6yHvLqOy4ro2/8TGcMgLqQ4pd0/UhBdK8iXqJlQytUm+gmrY63KiSVwntJQI0BG yd/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dNFdL19d; 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 v17-20020a05620a0a9100b0078a5fc2adf0si12314702qkg.138.2024.04.16.07.09.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:09:09 -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=dNFdL19d; 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 1B22C38460A3 for ; Tue, 16 Apr 2024 14:09:09 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id BDA933858CDA for ; Tue, 16 Apr 2024 14:07:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDA933858CDA 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 BDA933858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276477; cv=none; b=yEUva6kbmDF73cw/rY46oz+8ecvMLK3HWzpgtAK5mcY1PeWU5v/loxE9RvN6puEV2bTHFX6DiDabm62MuL/o756dXCqi4dV46WsB8zDxfVkWdwrw1dJlWeJQmrLe1hsX1dXuPLfslh6L5vIW2tZtAyVdxxI8ne9VqJIs8P+/SjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713276477; c=relaxed/simple; bh=WxhGoGvDUNyHMS4tOjdoth41+fxv5hm536NHqm7b6zY=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TrIhqZ1W4G2wEeqhPrfKXmi0sWedQN1GDJqP2YTN5CGfM3uJlgLy1cTyrY7T4soBZe+Uq4Qmt04yRX7X9Eh3K+sxcS2F8msp4b1/gl3TQS+lgGAWl/+PaOOriD4u2FuPPQgff58ecQb+SJTo+2+ahA0w+17q7lmckbsIwDOFwVM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6ecf3943040so3515803b3a.0 for ; Tue, 16 Apr 2024 07:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713276469; x=1713881269; 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=dNFdL19de/q8RksWV8R0X0vx/ia9BRg7pSYUGSwEDMN2b6cnjaIIbq/DOq+736ibvr 3biDpcmSaM9BeQCe/CSlTJ2QebgM1MbjWVoh0X+3n28oyia/PtQFoonYExw6wp5QRU8p rvXiPc+ckyXvSpdG/9jdIjZJQlkEkyvpo3cuidVCqBUc3utsaTfGP5Y+91pTjPyqTO1/ F4CM3GyrQ9XJwX6IB/CMFoS/4KKCoBeuZY7c1PxF63avkBtBRKMoWk3S8s8LVC4iY1wK n4IsMXUi8FbgxuUUAND3hWvxRt9B86069nVSXmYzs7NzSECb4gk3BdnV/UHKSSGLVZBz TAmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713276469; x=1713881269; 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=nQ1XcTUO/2xnpIXSTJvEXzrv70EOjJPnED/CRFkCgmZQA8LXW6b29jbVzfK3gLb+tD sWyW7REmqzK/JIPTtRB6JOJAD/DwdRkPK5L8m8bacDDrxCEggR1BbeF9MFvtaPnCohhi G/8JWluzaASEicTJgOR65x/dVgPD5kvkplcpcX9jratVg30tTik6ohhwWj8bVqwmHoXX fj5yAfkBGjuUOY7EXteMMPA0uxkWOM67HKRaqpJmQbIbE3rTSUl2z4A/S5mJhXlNSOeh eJ0Jsdoz0K8S7iGimukZaVtb5n9pmeLJEnNgQEKYfkth5zcnTbs1nmyYyvO7BQ2uiFAM Oqrw== X-Gm-Message-State: AOJu0Yxf3uZYfaoItmYBZKTkAwjQqmR5j9o8ByQdGJg6XlgVw/vuyTI6 pXan2VAhmKwfKBEcmRe+2eS9sfPjK+l1b3gL7iSBL0nzzqCjzgomTESNdpmHnZjAPJKH7ubQ57B B51I= X-Received: by 2002:a05:6300:630e:b0:1a7:a21b:66f9 with SMTP id jn14-20020a056300630e00b001a7a21b66f9mr10310191pzc.43.1713276469439; Tue, 16 Apr 2024 07:07:49 -0700 (PDT) Received: from amd.. ([2804:7f0:b403:ad57:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id o3-20020a63e343000000b005f3d54c0a57sm8937473pgj.49.2024.04.16.07.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 07:07:49 -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 v4 3/8] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Tue, 16 Apr 2024 14:07:23 +0000 Message-Id: <20240416140728.198163-4-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416140728.198163-1-gustavo.romero@linaro.org> References: <20240416140728.198163-1-gustavo.romero@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 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_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. */