Re: [PATCH v5 1/6] elf: Define note name macros
From: Dave Martin <Dave.Martin@arm.com>
Date: 2025-01-15 17:11:45
Also in:
kexec, linux-mm, linux-s390, lkml
Hi, On Wed, Jan 15, 2025 at 02:47:58PM +0900, Akihiko Odaki wrote:
quoted hunk ↗ jump to hunk
elf.h had a comment saying:quoted
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 <redacted> Acked-by: Baoquan He <redacted> --- 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@arm.com> Cheers ---Dave