Message ID | 20240404064819.2848899-4-gustavo.romero@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> 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 73EED3858428 for <patchwork@sourceware.org>; Thu, 4 Apr 2024 06:49:38 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id E215F385840A for <gdb-patches@sourceware.org>; Thu, 4 Apr 2024 06:48:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E215F385840A 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 E215F385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213333; cv=none; b=q4f3QmK325omzM7ZCA2jtkz6UaD2Bz3/sCYNUl51f86Z/ENH9gDJ+HEmg2YomtE1sH4ewdofnst8tUlF3XG8w+i79wX/50z2LqcaP8xW6amW8PV5GHfOFV5bRHlwiOhxXkg+CCtmv9Gl8HTAobaOXFgS3Cwl3pH+WkEze4EJKjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213333; c=relaxed/simple; bh=m0zxqCy8ZHC4pqDMn5zPMAeOHRoB5JgRRsV+IvPQPCM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=cBdAMT2YC+EPnErO3wfTJVnN2P8YD3PSqESzo8ITc+MUa/cJ8StkUOTggKjXf6Z9bQt6STA2IzNUizdQXlyvZpDTUuYIpXIsp8gmZQNbKuu/fb8nazgMDHCmfaV3L1FyHVaMaZjvZI98qtpqh3OftaioeXUF4k59jhMdlI4I+fU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3c3e2e18db7so377936b6e.0 for <gdb-patches@sourceware.org>; Wed, 03 Apr 2024 23:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213330; x=1712818130; 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=CkpJndIS961iAMYqy80lEUh7uV3OrKV2zpeEaXIJ8mU=; b=MIl5LrkErzFqCMBwR/1Boz/58FrG02lP3qxaJDK0Qmg/d+xFHg8bOGaiHIUwBzR1hp V4o7DpYCgLzIVUTjxO6PNRqj7FhRRdFJw0qOXOfSHiFfkT4DFNNSVzTn8MgPlhxecoch XUhtDuucKOKsXAGPnDYeRdOcqekhQwoh4EQ4d5cz+pEQr625STf+h2ymgNx+Wq9PEq2h J9XcI9uFJ1w7qCT9qp/71wADa4/5jmGosgu4wCTO7G2uQd5DvHw9SBcxZHxj+Di/7O9L lBEta+ogyTaBGbYcJ6dac72w9PmRzfMyr8MFUSAMZQkpy8BGAMawjCMbxycLikFzOMfv spIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213330; x=1712818130; 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=CkpJndIS961iAMYqy80lEUh7uV3OrKV2zpeEaXIJ8mU=; b=Xezg1hy8sXaCfePta0Z6foYheuFnTNDb50j2aITKS8BBsH7qWGxVo3BLLbtOYkzFkM JgRtgsuFIYd8ftsGyLfL7uxRbOIYWi89brtsTLAyNiDZj3mgKblEvh8v3Ccmm/dyCJJR CJEVkG/3J2YCdm5aghcC92uylq9DQYzBC+lWnNHGPimYFtOsDyWHSItKBDsx0gZb/iyc J2uglPre/YVt2x72njp5rpPDGOJ7w+wzMo9lc1BV1VuYCdLknxt+xo9Lkgzl67JSw0T/ FoC+j5j9o1WwJNXCccNLSSkMhY/HJTRPdtwqswAFlpa1ptUfnlIMIK53UkkvRJkr5Zm8 ye2w== X-Gm-Message-State: AOJu0YzXluY0zO+xlywmqfhBlatc/OM1+f1ToURbvfwBkdTphoiUIvsM Ypo4tk1CMtpZ7bSzCXNUZlJez0yUbKK9OBzYd6LHHkKC55OPhWAXCAVpo35BAxFrl7aclh/EGU9 v X-Google-Smtp-Source: AGHT+IHxAoij9xUeXbrGXG38bHhzeze2mPU1tY94oPc02wymP7S2m3PKibK8FPURlUXwcb4At/9Idg== X-Received: by 2002:a05:6808:178d:b0:3c5:d4e0:b295 with SMTP id bg13-20020a056808178d00b003c5d4e0b295mr1684394oib.0.1712213330609; Wed, 03 Apr 2024 23:48:50 -0700 (PDT) Received: from amd.. ([2804:7f0:b402:d0dc:3e7c:3fff:fe7a:e83b]) by smtp.gmail.com with ESMTPSA id n16-20020aa79850000000b006e64ddfa71asm13218899pfq.170.2024.04.03.23.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:49 -0700 (PDT) From: Gustavo Romero <gustavo.romero@linaro.org> To: gdb-patches@sourceware.org Cc: luis.machado@arm.com, thiago.bauermann@linaro.org, gustavo.romero@linaro.org Subject: [PATCH v3 3/7] gdb: aarch64: Remove MTE address checking from memtag_matches_p Date: Thu, 4 Apr 2024 06:48:15 +0000 Message-Id: <20240404064819.2848899-4-gustavo.romero@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240404064819.2848899-1-gustavo.romero@linaro.org> References: <20240404064819.2848899-1-gustavo.romero@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.3 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Add another way to check tagged addresses on remote targets
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Testing passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Testing passed |
Commit Message
Gustavo Romero
April 4, 2024, 6:48 a.m. UTC
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 <gustavo.romero@linaro.org>
---
gdb/aarch64-linux-tdep.c | 4 ----
1 file changed, 4 deletions(-)
Comments
On 4/4/24 07:48, Gustavo Romero wrote: > 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 <gustavo.romero@linaro.org> > --- > 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. */ Thanks. This is OK and can go in separately, or alongside the rest of the series if you wish. Approved-By: Luis Machado <luis.machado@arm.com> Tested-By: Luis Machado <luis.machado@arm.com>
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. */