From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TH+NISthB2b3lRsAWB0awg (envelope-from ) for ; Fri, 29 Mar 2024 20:47:39 -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=efVts9eO; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 753AD1E0C0; Fri, 29 Mar 2024 20:47:39 -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 5906C1E08C for ; Fri, 29 Mar 2024 20:47:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B28643858D39 for ; Sat, 30 Mar 2024 00:47:36 +0000 (GMT) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 62F443858D33 for ; Sat, 30 Mar 2024 00:47:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62F443858D33 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 62F443858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::529 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711759639; cv=none; b=u9Wwh4AhETySYskETIpkANwWawybtq3b4eTpLqW7w60A5YBzFcgAdNkqOuR/iX40MpKgTxuaQt2WxVaBM3frCCeA8NiLb0N6x2IP4hQ0kO/GDbbBnq1AWlbUMtFDZRcEvuKk303qjJUciM1/Dt7uWx93GGSm1KMuCdxQQNDe2Z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711759639; c=relaxed/simple; bh=1loan0LetCg7VMyIFOyWplxLyNgcw1mY4lGxXjDi2GU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JbDTY30g3OftXIjNlud5A6Jcq0/WOCZ3r3wh0L3XqhsDm95RZBbVTaDpP1+8hCP69ucwZKLwk55FakIWfcoOeBYxBKSwSposDrQLKtk8YA5C6lH71CngG6Gcv0pgodZgWDTZX8e9eAvX8EZ8nE1mfonYzBaW6m3NQiWo29brEDM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5dca1efad59so1728571a12.2 for ; Fri, 29 Mar 2024 17:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711759635; x=1712364435; 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=vX2yW4YBW5G/cob1b7RxymaXjsO1pUOdeiPxC3+hRMc=; b=efVts9eO5D+Pt7/Z+GvqGrgbOhFe3udSxyOEOBfBcl398txZWQsBb4eP3TMUhHX4Y1 PQXJYVctZ5toyz0wbEqOIqwebZhFcWO2NmY5qb8LDaIXgW2RsjJXuppIv8NSIHzFhz4s rWl11YFboxV125eQQnY6fkYMtTqgPcoegzr1zwgH8+c4qS1wcKHeeKyD0iI5OUlBqA/M 5mnVzP7m7g3OUUbrKuElylbih+baCxXBN2t+Yyas6335ogGoVcnXRONKru6D11vmjRVB itL0jDBdRoE0+CnHw9STZSFfrQjjT02p0oOkWjXWJHJVbSsNennjtXVKB9lQT1GAxIbF Jvyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711759635; x=1712364435; 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=vX2yW4YBW5G/cob1b7RxymaXjsO1pUOdeiPxC3+hRMc=; b=TVkNtNZ/3DxCKlAyUe73Ev/bVQdi9RTY07lTTG7dsvjfWRGsqVz4haTExq4kxffAIX n7lQRXWuKIn7QpKoETwW+SW5Z7casYoPc3bQr8qTBHG5G64FfWaTjS/xwRbwBd1ALHbG BzKsjeOLrkXmKcRnSJs48g5d62j3JbUv6WjndmbXRGNa91bj/N6Fh6Jx3RJLFeUZNPm5 /FyjKGB64gnFjww0xOsDY14qrzLoUAokdaHj4dgyqJgaT9D8+IVvW5dn54ae8WFmAtpG cHWz7Ld2rFZlwtpQ2Q5KielSPg+iX8oAG9VXLV3p2dMDxv5TAKtanXXQNn0W1Mq+vhiZ 7hgQ== X-Gm-Message-State: AOJu0Yy3zGhbCm/hTer9TQTaH+zI4+8zL/dQJ9tbK3L5wxJ3KBV4RHii aJL+jOhOJ3rlFu2qfnz0/rJ3sEMiqbuITkCoJZJmmIIfZLBhqWXL3uV1II7eYgQ+WspqEFi1BOh O X-Google-Smtp-Source: AGHT+IELeGvb8Kyw6RkcXoxMUVOYOIugVA7QcUhn1KQVzw6DIKnak4CYA0GEI4XwM9BS39DF3gTXuQ== X-Received: by 2002:a05:6a20:7285:b0:1a3:5170:8eb9 with SMTP id o5-20020a056a20728500b001a351708eb9mr3946602pzk.39.1711759635294; Fri, 29 Mar 2024 17:47:15 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:2981:86:c711:2bee]) by smtp.gmail.com with ESMTPSA id o16-20020a170902d4d000b001e0a7bf9f4asm4068860plg.0.2024.03.29.17.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 17:47:14 -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: <20240328224850.2785280-3-gustavo.romero@linaro.org> (Gustavo Romero's message of "Thu, 28 Mar 2024 22:48:48 +0000") References: <20240328224850.2785280-1-gustavo.romero@linaro.org> <20240328224850.2785280-3-gustavo.romero@linaro.org> User-Agent: mu4e 1.12.2; emacs 29.1 Date: Fri, 29 Mar 2024 21:47:12 -0300 Message-ID: <87msqg8s1b.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.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+public-inbox=simark.ca@sourceware.org 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? > > 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)); > + } GNU style doesn't use curly braces in if blocks with only one statement. > + > if (!gdbarch_set_memtags (current_inferior ()->arch (), val, length, tags, > memtag_type::allocation)) > gdb_printf (_("Could not update the allocation tag(s).\n")); -- Thiago