From patchwork Thu Apr 4 06:48:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Romero X-Patchwork-Id: 785811 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp684669wro; Wed, 3 Apr 2024 23:49:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMbh9NGlAXIur9th69oXH8huquXXAT6ITlN4BZK+V/yZTipLtP+iz2uETECtdGsV7PEbLIWLtjQ9j5mpgmbj8A X-Google-Smtp-Source: AGHT+IEtOJNx+A71XkSmHmu9C9JJHfm50m2tpYriJDTMx8VOaNGmVWlwxmBnMEGkitvSqjLdhCoJ X-Received: by 2002:a05:620a:4006:b0:78d:3c29:1522 with SMTP id h6-20020a05620a400600b0078d3c291522mr1926273qko.49.1712213378547; Wed, 03 Apr 2024 23:49:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712213378; cv=pass; d=google.com; s=arc-20160816; b=bbcMOsEM5VYK48LFrJQ3Pivdad+IsgDPUQqvScWB4I/kACxUU0clSxXRnU5962hra6 B86eVESU32F1gggo7me3+6ufmyJwTzqCQWOIoLxFJB+JQ0FJWNPhC1floFVxhN7yoiHA dO+W0xH9wHQ8CQxP5vz0+QDs3wZV+HnM/Qm0PCHZJT3WksnS4arByWaLscjRCoZv/80V F9xEOtPao+NuTXM3QX5TYBHRI5Zb14J+lLdWLYDoy8vMw3PnplwqURaLoceMdHYGqY8d wordyRIlfJM3la74Qm9xfacZw8dgY7GElp2NMPEJ6I2ScQh5PHpfPD11OsmsxshaOUlN qcyA== 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=DWYOE8EpQChfa8uCdhk5+693ODj8bGW6P79IkUH3wv8=; fh=ip7+QkkM488k9wyzFaZPu3h7BUQARzj44zdeG2KNIXU=; b=oeWBDP10CgzzShg3EMm+GimuzQ1CikPBeI3JA/yTL2v9q1oebLwtP6DoljBgiF0uo4 s76f+g2LdhnMDn5x9tEDuNa7ROzm9hhj06nEUIPa5iWwF3WThXmtTEdXYfkDhS7Ts4La QmlLjSIWuT3J6+CqaxHQlXbuxIaASNRTTZv5sZS2xdSZ4CVxyWNcTk705+KoDLO+JmyJ lzaKcB50LYJrlpqEEXCpum4Rd3wuGwNM3YotWiJicNvMYUiB1cnykwxrkpbv0n3KtFOw wofr/wqXMnC1dQKeXwRji2PwrsdkGSCjCv2Dt6o/WVKPKYDEYXAhhR+JeoG+0qbobmgT DJbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rZ1O04RU; 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 t16-20020a05620a0b1000b00789f94f2f5csi15457645qkg.783.2024.04.03.23.49.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:49:38 -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=rZ1O04RU; 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 2CB753846405 for ; 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-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id C5C8F3858C50 for ; Thu, 4 Apr 2024 06:48:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5C8F3858C50 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 C5C8F3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213331; cv=none; b=aVdSjAO7B2lfUs+pEQ6UO7KL8G4l07onsy/Npt+t+0J3KK6S5SzZAShvGPOszyNic7TlCLspI/BKWVYCPp/1YLdJGmlee7CW5ov8YYo+EhqCvA/xqToHGnybH+cPasNib2sqJUbbG6eyva9XTKdHzqfODYa6V+JHuxEady6UCWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712213331; c=relaxed/simple; bh=lVZNgHHbt9wy4pZkjHuJ9gFQRh1DGKSeSPidKtEJSbA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=auL1QaSfq0KE8fxniXrbmVHKUNiYJZIKwDjjiSvFDarTXz+UWBQL1HdGN95hOAWbYU8HAr651ya7tHOjqHxttgZER3i/dqDIQbbsM9dVdHj+eFycPVZ/ooT+Yni4tfUn6HdOM1j69hFTxjhxYJyjQCE5pqDEp9qCxc/Ci3gES6s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6eced1dab1fso243899b3a.1 for ; Wed, 03 Apr 2024 23:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712213328; x=1712818128; 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=DWYOE8EpQChfa8uCdhk5+693ODj8bGW6P79IkUH3wv8=; b=rZ1O04RUtNflKQWdunKkvDOo58I1YiDrZ6L6GaWwd3BiIv3qDC0Q8mNlq3T2plo+5E AQ9fg6JPamUfoWj7DLSL4t8lxCs02a4NZwmh/PTMNoY4qdcwagc1KgYFf0xKVHdQff9D Wzks25MWEPuEFHpADbSOPfL8/a/qtMdoAn7QdEKCelpcZJruCKwleqjxrNBytd2Gkgur eeObViy5y7daEnU+l2UufiOEGuqMIDNBqis5bd9T4kAC1K9QN73xBdpwLwaG7RbuTva1 Jmrlevz2ZmIxhU6ICtmmMvsuYMsSdpwRE9+f0ToHnaHyGT48LKSHY3M4bUv5vLyNkmyq 9XBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712213328; x=1712818128; 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=DWYOE8EpQChfa8uCdhk5+693ODj8bGW6P79IkUH3wv8=; b=hl+nsEz6+TuVOsGfOVO0Ez3ByY7WSfd2O45yVFE0V2qchdIPbktz7BEEFzYzVuwyRz E9UrhAt8FxBmC2LWKN2iOxlpgW0OujjqfTH8Zr6z2zut+AiRdftUzSuv2KkhhcHcaNYY UheZwbQ2CLAlJKk+EBEC2S2W2BILIVfWoEFsL3zn9FFUZ6TLonz1n26ckHQSCJAgi+Cz +WT5p9Fy+ER6wUodZbnbekFvEelEjLgxebKGkaHJ6J967Ki+pqCrffW7sSrMGCHNAQt7 oohmrh4241Ksjb+rcUt6BTVDRUeCEylZK3SBhdZGPhuSlpiHOJdzFrbm0ASHp135Uo0V /Idw== X-Gm-Message-State: AOJu0YzlVRt/g0clDy8vvq0DHXZkaBvQUYIO80vmW4tQiyndLSms+I6D /xh3Si44Ki/26hYxvDEc0zd8rPf55GK3DvbuE/k3kTHuEXSL3S8O0E3D6zPC2ObYgFMBRYXmPwM y X-Received: by 2002:a05:6a00:1886:b0:6ea:be87:fd36 with SMTP id x6-20020a056a00188600b006eabe87fd36mr1708798pfh.1.1712213328218; Wed, 03 Apr 2024 23:48:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 23:48:47 -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 v3 2/7] gdb: aarch64: Move MTE address check out of set_memtag Date: Thu, 4 Apr 2024 06:48:14 +0000 Message-Id: <20240404064819.2848899-3-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 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 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 | 5 +++++ 2 files changed, 5 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..774e3ec74ae 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -3127,6 +3127,11 @@ 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"));