[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4fsRq4D4X5Qb+Dq@e133380.arm.com>
Date: Wed, 15 Jan 2025 17:11:34 +0000
From: Dave Martin <Dave.Martin@....com>
To: Akihiko Odaki <akihiko.odaki@...nix.com>
Cc: Eric Biederman <ebiederm@...ssion.com>, Kees Cook <kees@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Mark Brown <broonie@...nel.org>, Baoquan He <bhe@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>,
LEROY Christophe <christophe.leroy2@...soprasteria.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
kexec@...ts.infradead.org, binutils@...rceware.org,
devel@...nix.com
Subject: Re: [PATCH v5 1/6] elf: Define note name macros
Hi,
On Wed, Jan 15, 2025 at 02:47:58PM +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 to remove their duplicate definitions of note names.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@...nix.com>
> Acked-by: Baoquan He <bhe@...hat.com>
> ---
> include/uapi/linux/elf.h | 89 +++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 84 insertions(+), 5 deletions(-)
>
> diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
> index b44069d29cec..592507aa9b3a 100644
> --- a/include/uapi/linux/elf.h
> +++ b/include/uapi/linux/elf.h
> @@ -368,101 +368,180 @@ typedef struct elf64_shdr {
> #define ELF_OSABI ELFOSABI_NONE
> #endif
>
> +/* Note definitions: NN_ defines names. NT_ defines types. */
> +
> +#define NN_GNU_PROPERTY_TYPE_0 "GNU"
> +#define NT_GNU_PROPERTY_TYPE_0 5
> +
I guess this also works as a neutral way of saying that
NT_GNU_PROPERTY_TYPE_0 isn't _specifically_ for coredumps.
I would worry that moving this block is going to generate unwanted
context noise with other patches that may be in flight and add new
NT_ definitions.
But (a) changing the comments will cause that anyway, and
(b) if there are any new NT_ definitions in flight, we want people to
notice the conflict and add the accompanying NN_ definition.
So, perhaps context noise is not such a bad thing in this instance.
[...]
> +#define NN_LOONGARCH_HW_WATCH "LINUX"
> #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
>
> -/* Note types with note name "GNU" */
> -#define NT_GNU_PROPERTY_TYPE_0 5
> -
> /* Note header in a PT_NOTE section */
> typedef struct elf32_note {
> Elf32_Word n_namesz; /* Name size */
Reviewed-by: Dave Martin <Dave.Martin@....com>
Cheers
---Dave
Powered by blists - more mailing lists