binfmt_elf: Dump non-arch notes with strictly matching name and type
authorDave Martin <Dave.Martin@arm.com>
Tue, 1 Jul 2025 13:55:56 +0000 (14:55 +0100)
committerKees Cook <kees@kernel.org>
Tue, 15 Jul 2025 05:27:46 +0000 (22:27 -0700)
commit9674a1be4dd57579cee2aecfa1480e7790105078
treeea0f2ecbf8775f0d46185f2a850051bed4852478
parent85a7f9cbf8a83cfe0aca04053a832206c4ad1272
binfmt_elf: Dump non-arch notes with strictly matching name and type

The note names for some arch-independent coredump notes are specified
manually, albeit by referring to the NN_<foo> #define corresponding
to the NT_<foo> #define that specifies the note type.

Now that there are no exceptional cases, refactor fill_note() to pick
the correct NN_ and NT_ macros implcitly for the requested note type.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20250701135616.29630-4-Dave.Martin@arm.com
Signed-off-by: Kees Cook <kees@kernel.org>
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c