From: Luis <luis.machado.foss@gmail.com>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Cc: gdb-patches@sourceware.org,
Chris Packham <judge.packham@gmail.com>,
Tom Tromey <tom@tromey.com>, Simon Marchi <simark@simark.ca>,
sunilkumar.dora@windriver.com
Subject: Re: [PATCH v4 5/6] GDB: aarch64-linux: Reorganize GCS-related definitions
Date: Tue, 10 Mar 2026 11:05:41 -0300 [thread overview]
Message-ID: <CANnS9rugOk3uSLEhA5a=WFZSQ-kmM25VHe5hmzRazPh8rv0U7Q@mail.gmail.com> (raw)
In-Reply-To: <87seagb4nd.fsf@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3997 bytes --]
Thanks.
Approved-By: Luis Machado <luis.machado.foss@gmail.com>
On Wed, Mar 4, 2026, 01:27 Thiago Jung Bauermann <
thiago.bauermann@linaro.org> wrote:
> Thiago Jung Bauermann <thiago.bauermann@linaro.org> 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 <luis.machado.foss@gmail.com>
> > Suggested-by: Simon Marchi <simark@simark.ca>
>
> 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 <http://www.gnu.org/licenses/>.
> */
> > +
> > +#ifndef GDB_NAT_AARCH64_GCS_LINUX_H
> > +#define GDB_NAT_AARCH64_GCS_LINUX_H
> > +
> > +#include <stdint.h>
> > +#include <asm/ptrace.h>
> > +
> > +/* 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 <stdint.h>
> +#include <asm/hwcap.h>
> #include <asm/ptrace.h>
>
> /* Feature check for Guarded Control Stack. */
>
> --
> Thiago
>
[-- Attachment #2: Type: text/html, Size: 5371 bytes --]
next prev parent reply other threads:[~2026-03-10 14:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 5:06 [PATCH v4 0/6] GDB: aarch64-linux: Some header fixes Thiago Jung Bauermann
2026-03-03 5:06 ` [PATCH v4 1/6] GDB: Add aarch64-pauth-linux.h to gdb/arch/ and gdb/nat/ Thiago Jung Bauermann
2026-03-03 15:51 ` Simon Marchi
2026-03-04 4:04 ` Thiago Jung Bauermann
2026-03-10 14:18 ` Luis
2026-03-04 3:59 ` Thiago Jung Bauermann
2026-03-03 5:06 ` [PATCH v4 2/6] GDB: Add aarch64-fpmr-linux.h " Thiago Jung Bauermann
2026-03-04 4:14 ` Thiago Jung Bauermann
2026-03-10 14:14 ` Luis
2026-03-03 5:06 ` [PATCH v4 3/6] GDB: aarch64-linux: Reorganize MTE-related definitions Thiago Jung Bauermann
2026-03-04 4:17 ` Thiago Jung Bauermann
2026-03-10 14:12 ` Luis
2026-03-03 5:06 ` [PATCH v4 4/6] GDB: aarch64-linux: Reorganize SME-related definitions Thiago Jung Bauermann
2026-03-04 4:21 ` Thiago Jung Bauermann
2026-03-10 14:07 ` Luis
2026-03-03 5:06 ` [PATCH v4 5/6] GDB: aarch64-linux: Reorganize GCS-related definitions Thiago Jung Bauermann
2026-03-04 4:27 ` Thiago Jung Bauermann
2026-03-10 14:05 ` Luis [this message]
2026-03-03 5:06 ` [PATCH v4 6/6] GDB: aarch64-linux: Fix build failure on musl systems Thiago Jung Bauermann
2026-03-03 16:14 ` [PATCH v4 0/6] GDB: aarch64-linux: Some header fixes Simon Marchi
2026-03-04 3:52 ` Thiago Jung Bauermann
2026-03-10 14:19 ` Luis
2026-03-17 2:29 ` Thiago Jung Bauermann
2026-03-17 2:49 ` Simon Marchi
2026-03-17 23:43 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANnS9rugOk3uSLEhA5a=WFZSQ-kmM25VHe5hmzRazPh8rv0U7Q@mail.gmail.com' \
--to=luis.machado.foss@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=judge.packham@gmail.com \
--cc=simark@simark.ca \
--cc=sunilkumar.dora@windriver.com \
--cc=thiago.bauermann@linaro.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox