From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ye1bENa0p2mieBMAWB0awg (envelope-from ) for ; Tue, 03 Mar 2026 23:28:06 -0500 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=sguf2ew+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3CCC01E0DD; Tue, 03 Mar 2026 23:28:06 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 895A41E08D for ; Tue, 03 Mar 2026 23:28:05 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 276594BA2E3D for ; Wed, 4 Mar 2026 04:28:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 276594BA2E3D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=sguf2ew+ Received: from mail-vk1-xa35.google.com (mail-vk1-xa35.google.com [IPv6:2607:f8b0:4864:20::a35]) by sourceware.org (Postfix) with ESMTPS id 538744BA2E0E for ; Wed, 4 Mar 2026 04:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 538744BA2E0E 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 538744BA2E0E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::a35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772598458; cv=none; b=rGD1/EdWJpxnJY9Q5r/dyQOOy67/fdFlsVGFVwXkpK0iVDt3bblSImXl10x0ywYFEi2DR9VAJJSzf2I9kaLlgen8oi+bvUjj54u/MDxoGTK9zd68sDyjoVA4Pt0UfGJsQjHTAY12Uuesa225ORMpedWcPYNgxtgGfifosG2IdeI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772598458; c=relaxed/simple; bh=yEj5A3PkBq61IQ6+VzVg5o+Y5W0fhSBxluGT7c3ggS4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=er32cMNbh03bC1OPuq5iuoUOyMnJOTAEAJvcmrQX57YNofqIZZJf4lXx3M1HoN2t0LblaPb7gkCl1EUuhjj0paEzo5eNRIk1Sn58NcolWDGvubxARZbUtvZyEt4O3gbavPSwgTFi74N8m2lopUEEe9ffT903yFWNJUu4fR7o1j8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 538744BA2E0E Received: by mail-vk1-xa35.google.com with SMTP id 71dfb90a1353d-56a87098868so2299925e0c.1 for ; Tue, 03 Mar 2026 20:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772598458; x=1773203258; 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=LFQHdE7r0MTOX2jvCFW6YoRCv7B798xDnIJxRVqEk6A=; b=sguf2ew+aA1eCD3ZZuACmtDCCoFtsCtcIMOGTHuHdpadJWXBbjy7p/pEEcKMPJvaZF zlCRDPbuvv76QKjWgVgKOMjETgxNSb0eSNcuqyR8yJ7AOzJJk3VRSm5tbMWqrzNdZJvk AsY3Po3RIJZP98csXz125Te8d4It7DrjEWEFMUq6uH1ixqg1pd0nCnjTKHkwckjxwIBa 7Us/SBZN11T5/okINm5aAPqdz6y1OGniajPVitEh+SwZ6ULB+LJu4TXF1j3XrWP6Ms1f QXef8L/izG4r/5fcyng5sO8ABCBlQgrS16RUYIsaH0eDq3AWaIWYozH92d71EYA9hbqR Ritw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772598458; x=1773203258; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=LFQHdE7r0MTOX2jvCFW6YoRCv7B798xDnIJxRVqEk6A=; b=e6PJpwZpZjiAluT15eNVkOhX4hmUlb+AlQHVow2ym+HCBZoDqS4urU2xzD768LvaiF T/7H3wz9ltSywNPLtqUWa/Oa8+igQC3PGZKAhO0/ILs3ErifupBEFHGoxBTS8fNdbA9y ewBjMYDro8DCNYwW+1xPlm6eic9zyhC7yMUt5SkFTzrrnHkd1czk81N/nj7EGqtLS3Yb XDGE2rto7/eCe9OSuu4CvHBQJPJ0WnqtOJ04Ql3Ejwca5LecMsdLE/SOFsyam2qOrF5d LS4RKuZCdoDL4zepveMaTgPbDOieq6GSlRrhVgAl72GyTIiz+ZvRA5UxZHlzcZCQv9qb MoCw== X-Gm-Message-State: AOJu0Yy/TJIGaTQ+nMyx9RKwEPdHkPyLGNP6I7ShMUuPbEqv70LCAjya 8/HABqSQ141arQYuCes1Y+5T4ZJ5IVXIToDxNBCvqFpQpJecSLGc0MPK94wABK4ydQRt9vwl+5d U6RuZ5ha4VQ== X-Gm-Gg: ATEYQzxdjvTE0Q6qableyE5lc/3vqx7X10InVKb/9KsK8QfqBWhqcjHmMAwahVMoxWH loMIfmWm+Bhj+g0UOfE2w22U+MyHw8mvmqx19elfPDSpjCutzvOgm2VyuLThscGYF4uJkSkArUu TPbYhawjK3vDKoXRFjtLOjeNHIbT2XFNzphdFhJWC5pvGigYYaR2F0g7Cf+CRAmjKt9Bjeuo7oY qT4Sx+zZ7LjhG1P9QDtxjVsWK/cNH7nRlhif8d5B8abRuegO1gkO5O27pvCp2lrrpanCh0ZD0kZ RpmfORh/WOVbttlTT1DwqnrByuWTgnYhRvJn1XRML8e3Rhp3Bt2ehBfGni7/ucG1uU9fKu7bl8l ZL2769+t3YDk+mJt1WThNi5eJA01T7/+YOEizOROGkkg96LW3rkmv5BQNgzdfTRK+4WcFP/SxdD 3E/JaNC4iEtqXuxFMYnDNvo6YY5ivcgp/6aQ== X-Received: by 2002:a05:6122:929:b0:566:21af:5d78 with SMTP id 71dfb90a1353d-56ae777f000mr420130e0c.10.1772598457618; Tue, 03 Mar 2026 20:27:37 -0800 (PST) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-56ab4aad2ebsm12970338e0c.17.2026.03.03.20.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 20:27:37 -0800 (PST) From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Cc: Chris Packham , Luis , Tom Tromey , Simon Marchi , sunilkumar.dora@windriver.com Subject: Re: [PATCH v4 5/6] GDB: aarch64-linux: Reorganize GCS-related definitions In-Reply-To: <20260303050641.198127-6-thiago.bauermann@linaro.org> (Thiago Jung Bauermann's message of "Tue, 3 Mar 2026 02:06:40 -0300") References: <20260303050641.198127-1-thiago.bauermann@linaro.org> <20260303050641.198127-6-thiago.bauermann@linaro.org> User-Agent: mu4e 1.12.15; emacs 30.2 Date: Wed, 04 Mar 2026 01:27:34 -0300 Message-ID: <87seagb4nd.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain 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 Thiago Jung Bauermann writes: > Only native code should use struct user_gcs, so its definition should be > in a native-specific file and not in a file under gdb/arch/. > > To fix this problem, create gdb/nat/aarch64-gcs-linux-ptrace.h and move > the struct user_gcs definition to it, as suggested by Luis. > > To fix the use of struct user_gcs in gdb/aarch64-linuxt-dep.c, define a > macro with the size of the GCS regset in gdb/arch/aarch64-gcs-linux.h > and use it in aarch64-linux-tdep.c, as is done for other regsets and > following a suggestion from Simon Marchi. > > Also, move the HWCAP_GCS definition to > gdb/nat/aarch64-gcs-linux-ptrace.h and create an AARCH64_HWCAP_GCS > definition in gdb/arch/aarch64-gcs-linux.h for use by target-dependent > code. > > Similarly, move the SEGV_CPERR and PR_SHADOW_STACK_{ENABLE,WRITE,PUSH} > definitions, which were added by the GCS patches and are only used by > aarch64-linux target-dependent code, to gdb/arch/aarch64-gcs-linux.h > with an AARCH64_ prefix and adjust users. > > Finally, I noticed that gdb/aarch64-linux-nat.c and > gdbserver/linux-aarch64-low.cc don't need anything from the > arch/aarch64-gcs-linux.h header, so make them not include it. > > Suggested-by: Luis > Suggested-by: Simon Marchi As Simon mentioned in his review, this commit message wrongly references gdb/nat/aarch64-gcs-linux-ptrace.h. I forgot to adjust the text after I decided to rename the file to gdb/nat/aarch64-gcs-linux.h. Fixed locally. > diff --git a/gdb/nat/aarch64-gcs-linux.h b/gdb/nat/aarch64-gcs-linux.h > new file mode 100644 > index 000000000000..ddf8342a4284 > --- /dev/null > +++ b/gdb/nat/aarch64-gcs-linux.h > @@ -0,0 +1,45 @@ > +/* Common native Linux definitions for AArch64 Guarded Control Stack. > + > + Copyright (C) 2025-2026 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#ifndef GDB_NAT_AARCH64_GCS_LINUX_H > +#define GDB_NAT_AARCH64_GCS_LINUX_H > + > +#include > +#include > + > +/* Feature check for Guarded Control Stack. */ > +#ifndef HWCAP_GCS > +#define HWCAP_GCS (1ULL << 32) > +#endif > + > +/* Make sure we only define these if the kernel header doesn't. */ > +#ifndef GCS_MAGIC > + > +/* GCS state (NT_ARM_GCS). */ > + > +struct user_gcs > +{ > + uint64_t features_enabled; > + uint64_t features_locked; > + uint64_t gcspr_el0; > +}; > + > +#endif /* GCS_MAGIC */ > + > +#endif /* GDB_NAT_AARCH64_GCS_LINUX_H */ As with previous patches, I amended this one locally with: diff --git a/gdb/nat/aarch64-gcs-linux.h b/gdb/nat/aarch64-gcs-linux.h index ddf8342a4284..79e6dcaaaf18 100644 --- a/gdb/nat/aarch64-gcs-linux.h +++ b/gdb/nat/aarch64-gcs-linux.h @@ -21,6 +21,7 @@ #define GDB_NAT_AARCH64_GCS_LINUX_H #include +#include #include /* Feature check for Guarded Control Stack. */ -- Thiago