On Sat, Jan 04, 2025 at 11:38:34PM +0900, 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@xxxxxxxxxx> > --- > 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". Maybe most people would find it obvious, but is it worth saying what the NT_ and NN_ macros are for? They can easily be explained in terms of the elfXX_note struct fields. > */ > #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. */ May just "other notes"? I think that the comment might bitrot over time. > #define NT_GNU_PROPERTY_TYPE_0 5 > > +/* Note names */ > +#define NN_PRSTATUS "CORE" Can these be interleaved with the NT_ definitions? I think this would make the resulting header (and the diff) easier to read. > +#define NN_PRFPREG "CORE" [...] > +#define NN_GNU_PROPERTY_TYPE_0 "GNU" [...] Cheers ---Dave