From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id CkldKt7VEWaLMSYAWB0awg (envelope-from ) for ; Sat, 06 Apr 2024 19:08:14 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=q+5g9QNj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 94CF41E0C0; Sat, 6 Apr 2024 19:08:14 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 505571E030 for ; Sat, 6 Apr 2024 19:08:12 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6410A3858289 for ; Sat, 6 Apr 2024 23:08:11 +0000 (GMT) Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id E3CBB3858416 for ; Sat, 6 Apr 2024 23:07:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3CBB3858416 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 E3CBB3858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712444872; cv=none; b=rYjiWvDCTzwQr9U4j32MIMajMS+Mzqfl0XW+OmNTisyns73FKT6sA/XAbBr+oF0rISkxc4+vEy/mAiGi1FEmmGsadYiSr1O2UteZv8JYqFS4BxUatWJMA4g1L/24gAGKfc/CnduRUp679gWVfCFmeUoqI4xNT7tx3xkR1pQoUQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712444872; c=relaxed/simple; bh=7Dvjeipyax73SXZwRb07RhEdz8yjje/fRO5S9/EcDQU=; h=DKIM-Signature:Subject:To:From:Message-ID:Date:MIME-Version; b=j0k33SDmjt562ViKkcFbeM6qlaSMu6ylQPllrRBSf0Xh5s6UrXEtY2Q3DbLOejB6ldikzh8v7VGjpKiJeV7dHk9mnM5Q5AcRXy5qU6BtyDdbiGHviZe93zLt/t6nT9FE7HXWXgu+7SgDO3PDj8JTDB9SEwcu1rfmPvXNp7BVikM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6ed0e9ccca1so707895b3a.0 for ; Sat, 06 Apr 2024 16:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712444869; x=1713049669; darn=sourceware.org; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=4lTt+QXiQaDQPxfvUZaOV1bsAZt2kSKfjf2+BExxNwM=; b=q+5g9QNjdTCQW94XwBomffloGqBd5tauOs/vvYEgIf4jS8MNFkh3uGat7yqhglFjqZ xhIrTXC8hTklhZiZq3Znl+BOmnQ9EaU1mt8i3dCYLf9/ov/UzyApUpHUyhga23qzmxac yaWAbT+A8T387EVyALoJF6RYJdSjLN1W/U747hKPJp5z8qIJ619AgX6qvm6ZZBx/Kcwv yV4ZrEIU7fklaSHXeaMsLXHfB4dZgIVeMpbqHyGQzpMWMc1vtbIGI2TvveqJ4uE1zMHp 7/xc+JOvyfnlVf/9NfXee0IrYh/RZZrIr8S3CpyosZ20zPzRZoqtpbyCHNVgYNpefM+f yvWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712444869; x=1713049669; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4lTt+QXiQaDQPxfvUZaOV1bsAZt2kSKfjf2+BExxNwM=; b=spJbS7NBC2nmfk6aUI4WMMdxphQPdK2UHBFAvZkBogGPEQZNW8TAtlDdz/LC0yPIAR /219iYEUGs0Mt4oBDK2Ai4+eqyBDLITcPHevsuklkiYAEN9XOI+Q4WUN1oF6s1q9jMmu QlFwZGnqSHDJkIcEPibmOlEpSkuc2nZf/prayjTN2bQ5h5U7GEt/r0tusixeZMrzA/Vj udBXWiW4jxTVZq06Vg6Rn7xWnxIr7vQzJcOuMgY4yF8lezcMQWNbvOzWr+nZYwqhs1HB 34u9nIXHY+MM3OSuzB3U0WZxeeHmUP2ntczF7C2w+4EmlQVjyCkEylQ1RSmLYxezlAJR w5aQ== X-Forwarded-Encrypted: i=1; AJvYcCUgPV8wx3Fa5Ln2aMfccBg340SDj8ggWwkuaJNC5cmKCCDl9Yb8eGXcYc/mR1SZbZQ1AiYRqtAnpI74vdiByWgP499Qm2hfw8vWhA== X-Gm-Message-State: AOJu0YzjxqopOkgih/Y3wiYHdmihS41TYPIsoBAmzLViwyb7Bs/OAq8Z hT/8jk3NQJl7hXhprGNr/XccFqG6leO+Sr+zKhzPPMreCvrOQ8pKCGruxN+9qBcIWJ9CdyhA9HT w X-Google-Smtp-Source: AGHT+IGsxjGhMgKoRBtNGWj0gTtwl3R1cEDilE1vEKnXK8fla0NNSx1txUr+lbZW0q3TOzbkiQISbQ== X-Received: by 2002:a05:6a20:2454:b0:1a7:4839:2265 with SMTP id t20-20020a056a20245400b001a748392265mr4206215pzc.39.1712444868836; Sat, 06 Apr 2024 16:07:48 -0700 (PDT) Received: from ?IPv6:2804:7f0:b581:414f:53e7:d033:7750:c775? ([2804:7f0:b581:414f:53e7:d033:7750:c775]) by smtp.gmail.com with ESMTPSA id ga16-20020a17090b039000b002a2b06cbe46sm3679875pjb.22.2024.04.06.16.07.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Apr 2024 16:07:48 -0700 (PDT) Subject: Re: [PATCH v3 2/7] gdb: aarch64: Move MTE address check out of set_memtag To: Luis Machado , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20240404064819.2848899-1-gustavo.romero@linaro.org> <20240404064819.2848899-3-gustavo.romero@linaro.org> <2c3d0482-b3cb-4a23-8d9b-2df179f83281@arm.com> From: Gustavo Romero Message-ID: <5edc0e8f-f32d-b624-5a0b-9fa3c973f856@linaro.org> Date: Sat, 6 Apr 2024 20:07:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <2c3d0482-b3cb-4a23-8d9b-2df179f83281@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-15.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, 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+public-inbox=simark.ca@sourceware.org Hi Luis, On 4/4/24 11:17 AM, Luis Machado wrote: > On 4/4/24 07:48, Gustavo Romero wrote: >> 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 > > A nit: > > s/memory mapped/memory-mapped ? > >> + 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)); >> + > > Looks like memory_tag_set_allocation_tag_command calls parse_set_allocation_tag_input, > and the latter has the exact same check as you are adding here. Is this then redundant? hmm, right, it is (and was) redundant. I'm removing the check from parse_set_allocation_tag_input. Thanks, Gustavo