Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash: Use note name macros

Use note name macros to match with the userspace's expectation.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Link: https://lore.kernel.org/r/20250115-elf-v5-4-0f9e55bbb2fc@daynix.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Akihiko Odaki and committed by
Kees Cook
0de47f28 609c8b30

+8 -8
+6 -6
fs/proc/kcore.c
··· 34 34 #include <asm/sections.h> 35 35 #include "internal.h" 36 36 37 - #define CORE_STR "CORE" 38 - 39 37 #ifndef ELF_CORE_EFLAGS 40 38 #define ELF_CORE_EFLAGS 0 41 39 #endif ··· 120 122 121 123 kcore_phdrs_len = kcore_nphdr * sizeof(struct elf_phdr); 122 124 kcore_notes_len = (4 * sizeof(struct elf_note) + 123 - 3 * ALIGN(sizeof(CORE_STR), 4) + 125 + ALIGN(sizeof(NN_PRSTATUS), 4) + 126 + ALIGN(sizeof(NN_PRPSINFO), 4) + 127 + ALIGN(sizeof(NN_TASKSTRUCT), 4) + 124 128 VMCOREINFO_NOTE_NAME_BYTES + 125 129 ALIGN(sizeof(struct elf_prstatus), 4) + 126 130 ALIGN(sizeof(struct elf_prpsinfo), 4) + ··· 443 443 goto out; 444 444 } 445 445 446 - append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus, 446 + append_kcore_note(notes, &i, NN_PRSTATUS, NT_PRSTATUS, &prstatus, 447 447 sizeof(prstatus)); 448 - append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo, 448 + append_kcore_note(notes, &i, NN_PRPSINFO, NT_PRPSINFO, &prpsinfo, 449 449 sizeof(prpsinfo)); 450 - append_kcore_note(notes, &i, CORE_STR, NT_TASKSTRUCT, current, 450 + append_kcore_note(notes, &i, NN_TASKSTRUCT, NT_TASKSTRUCT, current, 451 451 arch_task_struct_size); 452 452 /* 453 453 * vmcoreinfo_size is mostly constant after init time, but it
+1 -1
include/linux/vmcore_info.h
··· 8 8 9 9 #define CRASH_CORE_NOTE_NAME "CORE" 10 10 #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4) 11 - #define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4) 11 + #define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4) 12 12 #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4) 13 13 14 14 /*
+1 -1
kernel/crash_core.c
··· 436 436 memset(&prstatus, 0, sizeof(prstatus)); 437 437 prstatus.common.pr_pid = current->pid; 438 438 elf_core_copy_regs(&prstatus.pr_reg, regs); 439 - buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS, 439 + buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS, 440 440 &prstatus, sizeof(prstatus)); 441 441 final_note(buf); 442 442 }