From: Baoquan He <bhe@redhat.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Eric Biederman <ebiederm@xmission.com>,
Kees Cook <kees@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Mark Brown <broonie@kernel.org>,
Dave Martin <Dave.Martin@arm.com>,
Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
kexec@lists.infradead.org, devel@daynix.com
Subject: Re: [PATCH v2 1/5] elf: Define note name macros
Date: Mon, 6 Jan 2025 14:06:45 +0800 [thread overview]
Message-ID: <Z3ty9adBwE+C/guf@MiWiFi-R3L-srv> (raw)
In-Reply-To: <70daf544-f59f-404b-bec0-0d60e892a9e9@daynix.com>
On 01/06/25 at 02:07pm, Akihiko Odaki wrote:
> On 2025/01/06 11:21, Baoquan He wrote:
> > On 01/04/25 at 11:38pm, Akihiko Odaki wrote:
> > > elf.h had a comment saying:
> > > > Notes used in ET_CORE. Architectures export some of the arch register
> > > > sets using the corresponding note types via the PTRACE_GETREGSET and
> > > > PTRACE_SETREGSET requests.
> > > > The note name for these types is "LINUX", except NT_PRFPREG that is
> > > > named "CORE".
> > >
> > > However, NT_PRSTATUS is also named "CORE". It is also unclear what
> > > "these types" refers to.
> > >
> > > To fix these problems, define a name for each note type. The added
> > > definitions are macros so the kernel and userspace can directly refer to
> > > them.
> > >
> > > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> > > ---
> > > include/uapi/linux/elf.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++--
> > > 1 file changed, 83 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
> > > index b44069d29cec..014b705b97d7 100644
> > > --- a/include/uapi/linux/elf.h
> > > +++ b/include/uapi/linux/elf.h
> > > @@ -372,8 +372,6 @@ typedef struct elf64_shdr {
> > > * Notes used in ET_CORE. Architectures export some of the arch register sets
> > > * using the corresponding note types via the PTRACE_GETREGSET and
> > > * PTRACE_SETREGSET requests.
> > > - * The note name for these types is "LINUX", except NT_PRFPREG that is named
> > > - * "CORE".
> > > */
> > > #define NT_PRSTATUS 1
> > > #define NT_PRFPREG 2
> > > @@ -460,9 +458,91 @@ typedef struct elf64_shdr {
> > > #define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
> > > #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
> > > -/* Note types with note name "GNU" */
> > > +/* Note used in ET_EXEC and ET_DYN. */
> > > #define NT_GNU_PROPERTY_TYPE_0 5
> > > +/* Note names */
> > > +#define NN_PRSTATUS "CORE"
> > > +#define NN_PRFPREG "CORE"
> > > +#define NN_PRPSINFO "CORE"
> > > +#define NN_TASKSTRUCT "CORE"
> > > +#define NN_AUXV "CORE"
> > > +#define NN_SIGINFO "CORE"
> > > +#define NN_FILE "CORE"
> > > +#define NN_PRXFPREG "LINUX"
> >
> > No objection to make them clearer. Thanks for the effort.
> >
> > Wondering where below arch specific macros are used. So you just
> > added all NN_xxx for the corresponding NT_xxx? Not sure if this is
> > needed if we don't use them at all in the current kernel.
>
> Indeed I just added all NN_xxx. The kernel won't use the macros that are
> defined as "LINUX"; fs/binfmt_elf.c uses "LINUX" by default as the notes
> named "CORE" or "GNU" are exceptional.
>
> Userspace applications may still be interested in these macros as
> demonstrated in:
> https://lore.kernel.org/r/Z3f7zJwu8bu8HYln@e133380.arm.com
>
> These macros also serve as documentation; correcting and clarifying the
> documentation is the main purpose of this series.
I see, thanks. Then the overall series looks good to me.
next prev parent reply other threads:[~2025-01-06 6:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-04 14:38 [PATCH v2 0/5] elf: Define note name macros Akihiko Odaki
2025-01-04 14:38 ` [PATCH v2 1/5] " Akihiko Odaki
2025-01-06 2:21 ` Baoquan He
2025-01-06 5:07 ` Akihiko Odaki
2025-01-06 6:06 ` Baoquan He [this message]
2025-01-06 14:39 ` Dave Martin
2025-01-06 16:48 ` Kees Cook
2025-01-06 17:23 ` Dave Martin
2025-01-04 14:38 ` [PATCH v2 2/5] binfmt_elf: Use " Akihiko Odaki
2025-01-04 14:38 ` [PATCH v2 3/5] powwerpc: " Akihiko Odaki
2025-01-04 14:38 ` [PATCH v2 4/5] crash: " Akihiko Odaki
2025-01-04 14:38 ` [PATCH v2 5/5] crash: Remove KEXEC_CORE_NOTE_NAME Akihiko Odaki
2025-01-06 14:51 ` Dave Martin
2025-01-06 6:07 ` [PATCH v2 0/5] elf: Define note name macros Baoquan He
2025-01-06 15:23 ` Dave Martin
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=Z3ty9adBwE+C/guf@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=Dave.Martin@arm.com \
--cc=akihiko.odaki@daynix.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=devel@daynix.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=kees@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=vgoyal@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.