From patchwork Thu Mar 28 07:00:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 783585 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2572835wrt; Thu, 28 Mar 2024 00:01:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRSggvHtcK7ptPTCnm8uKJTrb3Dk0C/WnrdjjSGlUmk/XKBpAtfPVceGaelnJO1JrLHuAzJca9ATKEoK51sLWf X-Google-Smtp-Source: AGHT+IGJGhdVsQ6uR47b76kDN0CoUvXHnwMMIgOxVsmQKQsJJ92twTMM/zo0wvTeoRyPZkRUWdsn X-Received: by 2002:a05:620a:c90:b0:78b:c1e6:31d8 with SMTP id q16-20020a05620a0c9000b0078bc1e631d8mr4708qki.14.1711609319043; Thu, 28 Mar 2024 00:01:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711609319; cv=pass; d=google.com; s=arc-20160816; b=FGjFakgcUfINAJryikEd+aANp0l1/+uQ/slY47zrcJtXzTJmA044oUC9sgkz3S2RvM 3Ai8ILFMmJd3FD5NpUXfsPBO07DSpVQKb9WrxqcH4WO5OPHuAathPAAE7/Xl5dSaRRMl ak2EzDJu4me7mPp/loqoxLPHACi9Xvb0/o9gx/bdzBJFQD85nysSr6Kdg5s71LPPvt5v uhZWkQWJknaQtP32Fqa7CdAWa1eoVxZ1UuMQ97dv46qNnjjYDIHxd80XToBP/Cuih+xD 9/mn11iYQwLQrjWYjxkuhrqBWBcY8MjLg2az1aIZXRQOEyKuUQb68EqnIYcLmzFN4/83 cZfA== 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=ilag/Jr+6TNnOGN02ZgOKlgSmIgtYGupLlm4g6mhHbQ=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=BO5SwbrxhjAjM78iQ8uFqzK4e0klSi6hrMMugPgHl/9++VTnCaca399iOROQMFmQNn iYKfzFhye9GtnC6HUN9WlQiZdDs5rouRlQV/EkueJ6IB4oxjSECzyWyAseBd8SJkQPtR IKEW3vT5YLiQebrd6F2CksHpqasP5DwIdEzc8A5WAH4NkDAC7YFfj6f+MI77HIzAdpVA GV2H8lro1yhiMK2GgXWvlRPrB+ouVZ2HBwhGHb0iiUebJp8u1ND0shVKN8VF/OzCtrr3 ecGa4/pWqQ86WlfYjuptlaoSWS9lzkvN1wioRpwJE/Bd4JBA3R9FfzYBFUIrOmh0hyJ/ t0PA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TYZ6cX86; 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 pe32-20020a05620a852000b00789dc64b235si794697qkn.517.2024.03.28.00.01.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 00:01:59 -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=TYZ6cX86; 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 772AE385DC3F for ; Thu, 28 Mar 2024 07:01:58 +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 87BCB3858D20 for ; Thu, 28 Mar 2024 07:01:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87BCB3858D20 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 87BCB3858D20 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=1711609294; cv=none; b=iSiJt9mhhIKHJn9B7tu+Rr+h/yJLeDYV1F5PPsGTwN7pVr8wGpABQT+y9OZpmLsFpAQR3qYPRbVsqXebjcU1Sqs8xEnBH8m56JYQ103xOTmsf1Q9tT6xTo8N1nlPVLnM3IWKRjA/wN0I5AejrR+WTbzmGnoQMnbPYnErMZS2sYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711609294; c=relaxed/simple; bh=Ot07zx98/HzRqfFiuW6mucw3t+ApYoI7a9eYGtpH+b0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Qa20I58VdDBt7UsESc18+9DoLvVe5evvhG7FCcrT69BkWB3i509VvAkQlpl1ePu2tBp9G9ostRz8VpgoDAVUy4NrrdM+MFT9ibWIB9Xjagy+sgk4Lih2NuAuZK96PsWjWsDkDpUb1Jjvp23J2T6CQEZYLTldle0kj0oYIxN5BOU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e0f0398553so6360995ad.3 for ; Thu, 28 Mar 2024 00:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711609291; x=1712214091; 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=ilag/Jr+6TNnOGN02ZgOKlgSmIgtYGupLlm4g6mhHbQ=; b=TYZ6cX860l9z+9uMqWbQNw7EYt1RVH+8n+3Y3qmP3I+Jr4K1WBS/3dCcutdxwIAMY3 +rOL3Axjjl4KiZNeeSLxe9DCcJwt6AkwTR3yWQ9GQx2nG0G1IrXZPvLVX05leg7i9vnE JghJC1FIviyN3ff44raG7Ahh22HCrmhp0cnKXvaBgTdkcWxu+APkG4Vr8Doh+T0Si2Ar iGtQ30BuUvG5t+GJOtIzTql04KNxoS+u1IpS/5DwfO22lO+Z2DdtOvbDdJ8Cblmum5Bl +nCaOGZtVv0GON8Gu2xUn6OBrDfMLdxoBANLfCO6wOz5L/FON6yaPjCVZ65fHfy9UMj7 PmXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711609291; x=1712214091; 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=ilag/Jr+6TNnOGN02ZgOKlgSmIgtYGupLlm4g6mhHbQ=; b=S5bUAcFylGo2jXN0VYiigzNNjQOUKreQgOEEv0jctZHAnIuP3kMd61rPqreklt6INj 7OcsXfBchj6DZb7H5QKtN+NOBIoGeK5UcfD73HWAvsjI+Vkq2Aj4/W1QC5FMhk227fW/ h04nhw9GVX/kKS6bY2DggmxXLs4GF5PDc8LSaA5tO22wN7YvwVm31xTw+B7BkxNJ3KGd iHH3JYCONvDF0z8jWI2zbFHijH1S6O/wLQAw+1fzEliBp1UIVbaMfZiI6SiZVUrz3pnl OCB3Kv16TzK02Qj8MefUWp4Z7ziUmFRw6OyruHVj4hXklXPBBSE0BwebgJCyUh3xcDfa Oh0w== X-Gm-Message-State: AOJu0YxpyITrFigOSHb/4VfvFuZBlTsnBawG890QgUXm8Iro4rMWLLRg pSwnRKitDV1QqG5xoWguJLahDdbl+LpwxRjYq9ufWh9ffYKP+9wSgMGD0rQ8RF0gsieW0UpuXPA d X-Received: by 2002:a17:902:a617:b0:1e2:15a9:32d5 with SMTP id u23-20020a170902a61700b001e215a932d5mr843770plq.29.1711609291149; Thu, 28 Mar 2024 00:01:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 00:01:30 -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 2/4] gdb: aarch64: Move MTE address check out of set_memtag Date: Thu, 28 Mar 2024 07:00:53 +0000 Message-Id: <20240328070055.2578783-3-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=-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patch=linaro.org@sourceware.org Move MTE address check out of set_memtag and add this check to the upper layer, before set_memtag is called. This is a preparation for using a target hook instead of a gdbarch hook MTE address checks. Signed-off-by: Gustavo Romero --- gdb/aarch64-linux-tdep.c | 4 ---- gdb/printcmd.c | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 50055ac3f48..8e6e63d4dcb 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -2525,10 +2525,6 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address, /* Remove the top byte. */ addr = gdbarch_remove_non_address_bits (gdbarch, addr); - /* Make sure we are dealing with a tagged address to begin with. */ - if (!aarch64_linux_tagged_address_p (gdbarch, address)) - return false; - /* With G being the number of tag granules and N the number of tags passed in, we can have the following cases: diff --git a/gdb/printcmd.c b/gdb/printcmd.c index cb0d32aa4bc..ae4d640ccf2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -3127,6 +3127,12 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty) /* Parse the input. */ parse_set_allocation_tag_input (args, &val, &length, tags); + /* If the address is not in a region memory mapped with a memory tagging + flag, it is no use trying to manipulate its allocation tag. */ + if (!gdbarch_tagged_address_p (current_inferior ()->arch (), val)) { + show_addr_not_tagged (value_as_address(val)); + } + if (!gdbarch_set_memtags (current_inferior ()->arch (), val, length, tags, memtag_type::allocation)) gdb_printf (_("Could not update the allocation tag(s).\n"));