Skip to content

elf: Define note name macros

Akihiko Odaki kexec linux-mm linux-s390 linuxppc-dev lkml 5 versions – Applied

Status from this message: Applied to for-next/execve, thanks!

Get series with b4
b4 am [email protected] change-id 20241210-elf-b80ea3949c39

Versions newest first

  1. v5 Latest6 patches 2 repliesApplied
  2. v46 patches 6 repliesSuperseded
  3. v36 patches 10 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v25 patches9 repliesSuperseded
v11 patch3 repliesSuperseded

Changes in v5 from the cover letter

- Noted that patch "elf: Define note name macros" allows removing duplicate definitions of note names.
- Reordered NT_GNU_PROPERTY_TYPE_0 to precede notes used in ET_CORE to show its not specific to ET_CORE.
- Link to v4: https://lore.kernel.org/r/[email protected]

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/6elf: Define note name macrosinclude/uapi/linux/elf.h+84 -51 reply
2/6binfmt_elf: Use note name macrosfs/binfmt_elf.c fs/binfmt_elf_fdpic.c+14 -150 replies
3/6powerpc: Use note name macrosarch/powerpc/kernel/fadump.c arch/powerpc/platforms/powernv/opal-core.c+5 -50 replies
4/6crash: Use note name macrosfs/proc/kcore.c include/linux/vmcore_info.h kernel/crash_core.c+8 -80 replies
5/6s390/crash: Use note name macrosarch/s390/kernel/crash_dump.c+23 -390 replies
6/6crash: Remove KEXEC_CORE_NOTE_NAMEinclude/linux/kexec.h include/linux/vmcore_info.h+0 -30 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchBaoquan HeDave MartinHeiko Carstens
1/6A-b R-b
2/6A-b R-b
3/6A-b R-b
4/6A-b R-b
5/6R-b A-b
6/6A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/6] elf: Define note name macros

elf.h had a comment saying:

Quoted 5 lines

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.

For userspace program developers
---------------------------------------------------
While the main purpose of new macros is documentation, they are also hoped to be useful for userspace programs. Please check patch "elf: Define note name macros" and if you have a suggestion to make it more convenient for you, please share.

I added the Binutils mailing list to the CC as it contains code to parse dumps. I'm also planning to share this series on LLVM Discourse.

---
Changes in v5:
- Noted that patch "elf: Define note name macros" allows removing duplicate definitions of note names.
- Reordered NT_GNU_PROPERTY_TYPE_0 to precede notes used in ET_CORE to show its not specific to ET_CORE.
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- s/powwerpc/powerpc/
- s/NT_INIT/nt_init/g s/NT_SIZE/nt_size/g
- Removed parentheses that have little value.
- Fixed the code alignment in get_cpu_elf_notes_size().
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Added patch "s390/crash: Use note name macros".
- Changed to interleave note name and type macros.
- Described NN_ and NT_ macros.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Added a macro definition for each note type instead of trying to describe in a comment.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Akihiko Odaki (6):
elf: Define note name macros
binfmt_elf: Use note name macros
powerpc: Use note name macros
crash: Use note name macros
s390/crash: Use note name macros
crash: Remove KEXEC_CORE_NOTE_NAME

 arch/powerpc/kernel/fadump.c               |  2 +-
 arch/powerpc/platforms/powernv/opal-core.c |  8 +--
 arch/s390/kernel/crash_dump.c              | 62 ++++++++-------------
 fs/binfmt_elf.c                            | 21 ++++---
 fs/binfmt_elf_fdpic.c                      |  8 +--
 fs/proc/kcore.c                            | 12 ++--
 include/linux/kexec.h                      |  2 -
 include/linux/vmcore_info.h                |  3 +-
 include/uapi/linux/elf.h                   | 89 ++++++++++++++++++++++++++++--
 kernel/crash_core.c                        |  2 +-
 10 files changed, 134 insertions(+), 75 deletions(-)

---
base-commit: a32e14f8aef69b42826cf0998b068a43d486a9e9
change-id: 20241210-elf-b80ea3949c39

Best regards,

Signature · 1 line
Akihiko Odaki <[email protected]>