From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id rxnoMNCrEGbpEiUAWB0awg (envelope-from ) for ; Fri, 05 Apr 2024 21:56:32 -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=mZKiMbz5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B43F81E0C0; Fri, 5 Apr 2024 21:56:32 -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 8699A1E092 for ; Fri, 5 Apr 2024 21:56:30 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A755C3858415 for ; Sat, 6 Apr 2024 01:56:29 +0000 (GMT) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 9D39F3858D1E for ; Sat, 6 Apr 2024 01:56:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9D39F3858D1E 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 9D39F3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712368573; cv=none; b=HQCwHhdVciWuORMM9TUx+IBqvWEHC7LKRcTaso3vf+3I1g5RanLb9gkHAyF9gWR7VZ+vv97MJ0tuiO/bc5Pt2+Y3XprlPrdLCue3r7MrNesTDhetUuL1oAatze5ZW9yFhxlpyEsZddMjW4SI3UWrXykD6QOfTJOfTh4klqpczCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712368573; c=relaxed/simple; bh=Xdo6yWzq8Cyl6PnoyBTrXBDpsbGBCUfk3fgiTWUdKM0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Fd41BBtfkF71IW0rEii+Lp2GqfPp4hNdh9BTEpVfvX9HeRWatRLZSyR51TKKpN8XSx6FQ1QcfJlj3Iz8A0EmYdrqoS/nNIgYNXczozj2HhjXx0cHomIJXjlOsG1RCmknjyMJUce3w6xyX9osDLM1HkHuq9lMHVZbY7Qv6TAA7pU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a2da57ab3aso1597830a91.3 for ; Fri, 05 Apr 2024 18:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712368561; x=1712973361; darn=sourceware.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=xTWNO0J1eyrfG0Kz65pirPdTU3MLWKicxvIg1vwUQCg=; b=mZKiMbz5M6P8A1K3Uk5M1Jsw7xmncvoxew3Behs2YbDqPujtazCwx21tsuJhqFG+vw vpBZPW9n1QRYxakDa32dw1Lw65C0e9ITODGZ2y0DiC6FEXcVOF584FECuVskapElwsSP csAn6pweR6exQaEls2PonmP1hWg+AtJpvwFuW1E8uQyOxAuoVvXbaIA8LRl6uMy4f2Cp ACKw5LtfuouJnZ+IvaZwQk5p5IQO2/1HOJQkeKbxuqCSYdCyrZqQtSgYeFftbu+ug5u9 +v91OjNj8YhD1/Dvigl9oYIZZqcPEr9NL75bRxJeHB5y/twWhmcu27aE+SVtrcMnufXs KbRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712368561; x=1712973361; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xTWNO0J1eyrfG0Kz65pirPdTU3MLWKicxvIg1vwUQCg=; b=w4MGDQyms6eZADISVk36g04FETcmGh2sUyDWPWMTlhbkp6ywQbKyTlxjGDlWcI1Kkn SRr6swGt5NFoe3smrW86AoyovaWmphCyU3DBt+132VwXctWS/Yc+sp+pGlpaBQL44/Hu d40ugLjG62MGouUK+Jfh8SzNl4znfyGMd6L9nELNwxwZvyO8rL4SrmxhTbAF2BeyE2KT 5juJTskCzMjBHujPv0BHuBHS4P7RLowE9/TL9HniX6Vhzo+D80XAAYXm6LWUbSxY2u5d WXw5Qb53QuD7dEIl2z2x7nPeSyZJpfpJqAwuR/Xf2ABG48/v5lWbRfGn6qDcoeSfrinx QnsA== X-Gm-Message-State: AOJu0YxXNqaCJG6aq8z0hdKg4llYwasbA06cIbZqPFFpmsny7EI+gzMM e47QPNEfqVOX/xd681Gui5sMKH3oIreS1RJhGsyqInrWLb0MA2AY5KVnO7R3Zs4yCwXlND0s5b0 F X-Google-Smtp-Source: AGHT+IFM8C5O3l4vxAoAuApUQ9LN+vZOecWTJrWjgAlLXN3MQt2XkWHysjZOjgEf18NrPru3AhESLQ== X-Received: by 2002:a17:90a:be05:b0:2a2:18fb:683e with SMTP id a5-20020a17090abe0500b002a218fb683emr2679061pjs.30.1712368561488; Fri, 05 Apr 2024 18:56:01 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:8e61:5c78:78b:6f3e]) by smtp.gmail.com with ESMTPSA id v10-20020a17090a00ca00b002a2af71479bsm2367993pjd.49.2024.04.05.18.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 18:56:01 -0700 (PDT) From: Thiago Jung Bauermann To: Gustavo Romero Cc: gdb-patches@sourceware.org, luis.machado@arm.com Subject: Re: [PATCH v2 2/4] gdb: aarch64: Move MTE address check out of set_memtag In-Reply-To: <322b8080-d9f4-7741-4358-ca6f0de4b7f5@linaro.org> (Gustavo Romero's message of "Thu, 4 Apr 2024 02:25:02 -0300") References: <20240328224850.2785280-1-gustavo.romero@linaro.org> <20240328224850.2785280-3-gustavo.romero@linaro.org> <87msqg8s1b.fsf@linaro.org> <322b8080-d9f4-7741-4358-ca6f0de4b7f5@linaro.org> User-Agent: mu4e 1.12.2; emacs 29.3 Date: Fri, 05 Apr 2024 22:55:58 -0300 Message-ID: <87v84v9rv5.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 Gustavo Romero writes: > On 3/29/24 9:47 PM, Thiago Jung Bauermann wrote: >> Gustavo Romero writes: >> >>> 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. >> gdbarch_set_memtags is also called from >> memory_tag_with_logical_tag_command. Shouldn't the same check be added >> there? > > In aarch64_linux_set_memtags, the memory check is inside the else {}, which > is only executed when tag_type == memtag_type::allocation, but not in the if {}, > which is executed when memtag_type::logical. Because > memory_tag_with_logical_tag_command always calls set_memtags with the argument > for tag_type param == memtag_type::logical there is no need to check the address. > > In other words, memory_tag_with_logical_tag_command is about logical tags only, > so it's a local operation that does not touch any memory in the target, it just > changes a local pointer, so it's ok to change the pointer, being it tagged or not, > hence not memory checks are needed. > > These comments try to clarify a bit it: > > In memory_tag_with_logical_tag_command: > > /* Setting the logical tag is just a local operation that does not touch > any memory from the target. Given an input value, we modify the value > to include the appropriate tag. <-- > > > In memory_tag_print_tag_command: > > /* If the address is not in a region memory mapped with a memory tagging > flag, it is no use trying to access/manipulate its allocation tag. > > It is OK to manipulate the logical tag though. */ <-- Thanks for the explanation, makes sense! -- Thiago