* [PATCH v4 1/6] elf: Define note name macros
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:22 ` Dave Martin
2025-01-11 5:48 ` [PATCH v4 2/6] binfmt_elf: Use " Akihiko Odaki
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki
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.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Baoquan He <bhe@redhat.com>
---
include/uapi/linux/elf.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 83 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index b44069d29cec..343f5c40d03a 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -368,99 +368,179 @@ typedef struct elf64_shdr {
#define ELF_OSABI ELFOSABI_NONE
#endif
+/* Note definitions: NN_ defines names. NT_ defines types. */
+
/*
* 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".
*/
+#define NN_PRSTATUS "CORE"
#define NT_PRSTATUS 1
+#define NN_PRFPREG "CORE"
#define NT_PRFPREG 2
+#define NN_PRPSINFO "CORE"
#define NT_PRPSINFO 3
+#define NN_TASKSTRUCT "CORE"
#define NT_TASKSTRUCT 4
+#define NN_AUXV "CORE"
#define NT_AUXV 6
/*
* Note to userspace developers: size of NT_SIGINFO note may increase
* in the future to accomodate more fields, don't assume it is fixed!
*/
+#define NN_SIGINFO "CORE"
#define NT_SIGINFO 0x53494749
+#define NN_FILE "CORE"
#define NT_FILE 0x46494c45
+#define NN_PRXFPREG "LINUX"
#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
+#define NN_PPC_VMX "LINUX"
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
+#define NN_PPC_SPE "LINUX"
#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
+#define NN_PPC_VSX "LINUX"
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
+#define NN_PPC_TAR "LINUX"
#define NT_PPC_TAR 0x103 /* Target Address Register */
+#define NN_PPC_PPR "LINUX"
#define NT_PPC_PPR 0x104 /* Program Priority Register */
+#define NN_PPC_DSCR "LINUX"
#define NT_PPC_DSCR 0x105 /* Data Stream Control Register */
+#define NN_PPC_EBB "LINUX"
#define NT_PPC_EBB 0x106 /* Event Based Branch Registers */
+#define NN_PPC_PMU "LINUX"
#define NT_PPC_PMU 0x107 /* Performance Monitor Registers */
+#define NN_PPC_TM_CGPR "LINUX"
#define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */
+#define NN_PPC_TM_CFPR "LINUX"
#define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */
+#define NN_PPC_TM_CVMX "LINUX"
#define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */
+#define NN_PPC_TM_CVSX "LINUX"
#define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */
+#define NN_PPC_TM_SPR "LINUX"
#define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */
+#define NN_PPC_TM_CTAR "LINUX"
#define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */
+#define NN_PPC_TM_CPPR "LINUX"
#define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */
+#define NN_PPC_TM_CDSCR "LINUX"
#define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */
+#define NN_PPC_PKEY "LINUX"
#define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */
+#define NN_PPC_DEXCR "LINUX"
#define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */
+#define NN_PPC_HASHKEYR "LINUX"
#define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */
+#define NN_386_TLS "LINUX"
#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
+#define NN_386_IOPERM "LINUX"
#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
+#define NN_X86_XSTATE "LINUX"
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
/* Old binutils treats 0x203 as a CET state */
+#define NN_X86_SHSTK "LINUX"
#define NT_X86_SHSTK 0x204 /* x86 SHSTK state */
+#define NN_X86_XSAVE_LAYOUT "LINUX"
#define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description */
+#define NN_S390_HIGH_GPRS "LINUX"
#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
+#define NN_S390_TIMER "LINUX"
#define NT_S390_TIMER 0x301 /* s390 timer register */
+#define NN_S390_TODCMP "LINUX"
#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
+#define NN_S390_TODPREG "LINUX"
#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
+#define NN_S390_CTRS "LINUX"
#define NT_S390_CTRS 0x304 /* s390 control registers */
+#define NN_S390_PREFIX "LINUX"
#define NT_S390_PREFIX 0x305 /* s390 prefix register */
+#define NN_S390_LAST_BREAK "LINUX"
#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
+#define NN_S390_SYSTEM_CALL "LINUX"
#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
+#define NN_S390_TDB "LINUX"
#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
+#define NN_S390_VXRS_LOW "LINUX"
#define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */
+#define NN_S390_VXRS_HIGH "LINUX"
#define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */
+#define NN_S390_GS_CB "LINUX"
#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */
+#define NN_S390_GS_BC "LINUX"
#define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */
+#define NN_S390_RI_CB "LINUX"
#define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */
+#define NN_S390_PV_CPU_DATA "LINUX"
#define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */
+#define NN_ARM_VFP "LINUX"
#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
+#define NN_ARM_TLS "LINUX"
#define NT_ARM_TLS 0x401 /* ARM TLS register */
+#define NN_ARM_HW_BREAK "LINUX"
#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
+#define NN_ARM_HW_WATCH "LINUX"
#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
+#define NN_ARM_SYSTEM_CALL "LINUX"
#define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */
+#define NN_ARM_SVE "LINUX"
#define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */
+#define NN_ARM_PAC_MASK "LINUX"
#define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */
+#define NN_ARM_PACA_KEYS "LINUX"
#define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */
+#define NN_ARM_PACG_KEYS "LINUX"
#define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */
+#define NN_ARM_TAGGED_ADDR_CTRL "LINUX"
#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */
+#define NN_ARM_PAC_ENABLED_KEYS "LINUX"
#define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */
+#define NN_ARM_SSVE "LINUX"
#define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */
+#define NN_ARM_ZA "LINUX"
#define NT_ARM_ZA 0x40c /* ARM SME ZA registers */
+#define NN_ARM_ZT "LINUX"
#define NT_ARM_ZT 0x40d /* ARM SME ZT registers */
+#define NN_ARM_FPMR "LINUX"
#define NT_ARM_FPMR 0x40e /* ARM floating point mode register */
+#define NN_ARM_POE "LINUX"
#define NT_ARM_POE 0x40f /* ARM POE registers */
+#define NN_ARM_GCS "LINUX"
#define NT_ARM_GCS 0x410 /* ARM GCS state */
+#define NN_ARC_V2 "LINUX"
#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
+#define NN_VMCOREDD "LINUX"
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
+#define NN_MIPS_DSP "LINUX"
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */
+#define NN_MIPS_FP_MODE "LINUX"
#define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */
+#define NN_MIPS_MSA "LINUX"
#define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */
+#define NN_RISCV_CSR "LINUX"
#define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */
+#define NN_RISCV_VECTOR "LINUX"
#define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */
+#define NN_RISCV_TAGGED_ADDR_CTRL "LINUX"
#define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */
+#define NN_LOONGARCH_CPUCFG "LINUX"
#define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */
+#define NN_LOONGARCH_CSR "LINUX"
#define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */
+#define NN_LOONGARCH_LSX "LINUX"
#define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */
+#define NN_LOONGARCH_LASX "LINUX"
#define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */
+#define NN_LOONGARCH_LBT "LINUX"
#define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */
+#define NN_LOONGARCH_HW_BREAK "LINUX"
#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */
+#define NN_LOONGARCH_HW_WATCH "LINUX"
#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
-/* Note types with note name "GNU" */
+/* Note used in other file types. */
+#define NN_GNU_PROPERTY_TYPE_0 "GNU"
#define NT_GNU_PROPERTY_TYPE_0 5
/* Note header in a PT_NOTE section */
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 1/6] elf: Define note name macros
2025-01-11 5:48 ` [PATCH v4 1/6] " Akihiko Odaki
@ 2025-01-14 12:22 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:22 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel
Hi,
On Sat, Jan 11, 2025 at 02:48:44PM +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.
I guess another motivation is to move towards having elf.h as the
single point of definition for the note names, so that obscure and
duplicate logic for determining note names can be removed.
(Could be worth adding a note on this is the patch is respun, but this
would be overkill otherwise...)
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Acked-by: Baoquan He <bhe@redhat.com>
> ---
> include/uapi/linux/elf.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 83 insertions(+), 3 deletions(-)
>
> diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
> index b44069d29cec..343f5c40d03a 100644
> --- a/include/uapi/linux/elf.h
> +++ b/include/uapi/linux/elf.h
> @@ -368,99 +368,179 @@ typedef struct elf64_shdr {
> #define ELF_OSABI ELFOSABI_NONE
> #endif
>
> +/* Note definitions: NN_ defines names. NT_ defines types. */
> +
> /*
> * 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".
> */
> +#define NN_PRSTATUS "CORE"
> #define NT_PRSTATUS 1
> +#define NN_PRFPREG "CORE"
> #define NT_PRFPREG 2
> +#define NN_PRPSINFO "CORE"
> #define NT_PRPSINFO 3
> +#define NN_TASKSTRUCT "CORE"
> #define NT_TASKSTRUCT 4
> +#define NN_AUXV "CORE"
> #define NT_AUXV 6
> /*
> * Note to userspace developers: size of NT_SIGINFO note may increase
> * in the future to accomodate more fields, don't assume it is fixed!
> */
> +#define NN_SIGINFO "CORE"
> #define NT_SIGINFO 0x53494749
> +#define NN_FILE "CORE"
> #define NT_FILE 0x46494c45
> +#define NN_PRXFPREG "LINUX"
> #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
[...]
> +#define NN_LOONGARCH_HW_WATCH "LINUX"
> #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */
>
> -/* Note types with note name "GNU" */
> +/* Note used in other file types. */
For this, it may make sense to be vaguer, e.g.
/* Other notes */
(We don't dump NT_GNU_PROPERTY_TYPE_0 in coredumps, but I don't think
it would be nonsensical to do so.)
> +#define NN_GNU_PROPERTY_TYPE_0 "GNU"
> #define NT_GNU_PROPERTY_TYPE_0 5
[...]
With or without those changes,
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 2/6] binfmt_elf: Use note name macros
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
2025-01-11 5:48 ` [PATCH v4 1/6] " Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:22 ` Dave Martin
2025-01-11 5:48 ` [PATCH v4 3/6] powerpc: " Akihiko Odaki
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki
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>
---
fs/binfmt_elf.c | 21 ++++++++++-----------
fs/binfmt_elf_fdpic.c | 8 ++++----
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 106f0e8af177..5b4a92e5e508 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -762,8 +762,7 @@ static int parse_elf_property(const char *data, size_t *off, size_t datasz,
}
#define NOTE_DATA_SZ SZ_1K
-#define GNU_PROPERTY_TYPE_0_NAME "GNU"
-#define NOTE_NAME_SZ (sizeof(GNU_PROPERTY_TYPE_0_NAME))
+#define NOTE_NAME_SZ (sizeof(NN_GNU_PROPERTY_TYPE_0))
static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr,
struct arch_elf_state *arch)
@@ -800,7 +799,7 @@ static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr,
if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 ||
note.nhdr.n_namesz != NOTE_NAME_SZ ||
strncmp(note.data + sizeof(note.nhdr),
- GNU_PROPERTY_TYPE_0_NAME, n - sizeof(note.nhdr)))
+ NN_GNU_PROPERTY_TYPE_0, n - sizeof(note.nhdr)))
return -ENOEXEC;
off = round_up(sizeof(note.nhdr) + NOTE_NAME_SZ,
@@ -1603,14 +1602,14 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
do
i += 2;
while (auxv[i - 2] != AT_NULL);
- fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
+ fill_note(note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
}
static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
const kernel_siginfo_t *siginfo)
{
copy_siginfo_to_external(csigdata, siginfo);
- fill_note(note, "CORE", NT_SIGINFO, sizeof(*csigdata), csigdata);
+ fill_note(note, NN_SIGINFO, NT_SIGINFO, sizeof(*csigdata), csigdata);
}
/*
@@ -1706,7 +1705,7 @@ static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm
}
size = name_curpos - (char *)data;
- fill_note(note, "CORE", NT_FILE, size, data);
+ fill_note(note, NN_FILE, NT_FILE, size, data);
return 0;
}
@@ -1767,7 +1766,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
regset_get(t->task, &view->regsets[0],
sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg);
- fill_note(&t->notes[0], "CORE", NT_PRSTATUS,
+ fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS,
PRSTATUS_SIZE, &t->prstatus);
info->size += notesize(&t->notes[0]);
@@ -1801,7 +1800,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
if (is_fpreg)
SET_PR_FPVALID(&t->prstatus);
- fill_note(&t->notes[note_iter], is_fpreg ? "CORE" : "LINUX",
+ fill_note(&t->notes[note_iter], is_fpreg ? NN_PRFPREG : "LINUX",
note_type, ret, data);
info->size += notesize(&t->notes[note_iter]);
@@ -1821,7 +1820,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
fill_prstatus(&t->prstatus.common, p, signr);
elf_core_copy_task_regs(p, &t->prstatus.pr_reg);
- fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus),
+ fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
&(t->prstatus));
info->size += notesize(&t->notes[0]);
@@ -1832,7 +1831,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
}
t->prstatus.pr_fpvalid = 1;
- fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(*fpu), fpu);
+ fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(*fpu), fpu);
info->size += notesize(&t->notes[1]);
return 1;
@@ -1852,7 +1851,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
if (!psinfo)
return 0;
- fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
+ fill_note(&info->psinfo, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
#ifdef CORE_DUMP_USE_REGSET
view = task_user_regset_view(dump_task);
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index f1a7c4875c4a..96bd9d2f23d7 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1397,7 +1397,7 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
regset_get(p, &view->regsets[0],
sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg);
- fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus),
+ fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
&t->prstatus);
t->num_notes++;
*sz += notesize(&t->notes[0]);
@@ -1415,7 +1415,7 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
}
if (t->prstatus.pr_fpvalid) {
- fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu),
+ fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(t->fpu),
&t->fpu);
t->num_notes++;
*sz += notesize(&t->notes[1]);
@@ -1530,7 +1530,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
*/
fill_psinfo(psinfo, current->group_leader, current->mm);
- fill_note(&psinfo_note, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
+ fill_note(&psinfo_note, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
thread_status_size += notesize(&psinfo_note);
auxv = (elf_addr_t *) current->mm->saved_auxv;
@@ -1538,7 +1538,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
do
i += 2;
while (auxv[i - 2] != AT_NULL);
- fill_note(&auxv_note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
+ fill_note(&auxv_note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
thread_status_size += notesize(&auxv_note);
offset = sizeof(*elf); /* ELF header */
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 2/6] binfmt_elf: Use note name macros
2025-01-11 5:48 ` [PATCH v4 2/6] binfmt_elf: Use " Akihiko Odaki
@ 2025-01-14 12:22 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:22 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel
On Sat, Jan 11, 2025 at 02:48:45PM +0900, Akihiko Odaki wrote:
> 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>
> ---
> fs/binfmt_elf.c | 21 ++++++++++-----------
> fs/binfmt_elf_fdpic.c | 8 ++++----
> 2 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 106f0e8af177..5b4a92e5e508 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -762,8 +762,7 @@ static int parse_elf_property(const char *data, size_t *off, size_t datasz,
> }
>
> #define NOTE_DATA_SZ SZ_1K
> -#define GNU_PROPERTY_TYPE_0_NAME "GNU"
> -#define NOTE_NAME_SZ (sizeof(GNU_PROPERTY_TYPE_0_NAME))
> +#define NOTE_NAME_SZ (sizeof(NN_GNU_PROPERTY_TYPE_0))
>
> static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr,
> struct arch_elf_state *arch)
> @@ -800,7 +799,7 @@ static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr,
> if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 ||
> note.nhdr.n_namesz != NOTE_NAME_SZ ||
> strncmp(note.data + sizeof(note.nhdr),
> - GNU_PROPERTY_TYPE_0_NAME, n - sizeof(note.nhdr)))
> + NN_GNU_PROPERTY_TYPE_0, n - sizeof(note.nhdr)))
> return -ENOEXEC;
>
> off = round_up(sizeof(note.nhdr) + NOTE_NAME_SZ,
> @@ -1603,14 +1602,14 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
> do
> i += 2;
> while (auxv[i - 2] != AT_NULL);
> - fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
> + fill_note(note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
> }
>
> static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
> const kernel_siginfo_t *siginfo)
> {
> copy_siginfo_to_external(csigdata, siginfo);
> - fill_note(note, "CORE", NT_SIGINFO, sizeof(*csigdata), csigdata);
> + fill_note(note, NN_SIGINFO, NT_SIGINFO, sizeof(*csigdata), csigdata);
> }
>
> /*
> @@ -1706,7 +1705,7 @@ static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm
> }
>
> size = name_curpos - (char *)data;
> - fill_note(note, "CORE", NT_FILE, size, data);
> + fill_note(note, NN_FILE, NT_FILE, size, data);
> return 0;
> }
>
> @@ -1767,7 +1766,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
> regset_get(t->task, &view->regsets[0],
> sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg);
>
> - fill_note(&t->notes[0], "CORE", NT_PRSTATUS,
> + fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS,
> PRSTATUS_SIZE, &t->prstatus);
> info->size += notesize(&t->notes[0]);
>
> @@ -1801,7 +1800,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
> if (is_fpreg)
> SET_PR_FPVALID(&t->prstatus);
>
> - fill_note(&t->notes[note_iter], is_fpreg ? "CORE" : "LINUX",
> + fill_note(&t->notes[note_iter], is_fpreg ? NN_PRFPREG : "LINUX",
> note_type, ret, data);
>
> info->size += notesize(&t->notes[note_iter]);
> @@ -1821,7 +1820,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
> fill_prstatus(&t->prstatus.common, p, signr);
> elf_core_copy_task_regs(p, &t->prstatus.pr_reg);
>
> - fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus),
> + fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
> &(t->prstatus));
> info->size += notesize(&t->notes[0]);
>
> @@ -1832,7 +1831,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
> }
>
> t->prstatus.pr_fpvalid = 1;
> - fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(*fpu), fpu);
> + fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(*fpu), fpu);
> info->size += notesize(&t->notes[1]);
>
> return 1;
> @@ -1852,7 +1851,7 @@ static int fill_note_info(struct elfhdr *elf, int phdrs,
> psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL);
> if (!psinfo)
> return 0;
> - fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
> + fill_note(&info->psinfo, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
>
> #ifdef CORE_DUMP_USE_REGSET
> view = task_user_regset_view(dump_task);
> diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
> index f1a7c4875c4a..96bd9d2f23d7 100644
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -1397,7 +1397,7 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
> regset_get(p, &view->regsets[0],
> sizeof(t->prstatus.pr_reg), &t->prstatus.pr_reg);
>
> - fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus),
> + fill_note(&t->notes[0], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
> &t->prstatus);
> t->num_notes++;
> *sz += notesize(&t->notes[0]);
> @@ -1415,7 +1415,7 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
> }
>
> if (t->prstatus.pr_fpvalid) {
> - fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu),
> + fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(t->fpu),
> &t->fpu);
> t->num_notes++;
> *sz += notesize(&t->notes[1]);
> @@ -1530,7 +1530,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
> */
>
> fill_psinfo(psinfo, current->group_leader, current->mm);
> - fill_note(&psinfo_note, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
> + fill_note(&psinfo_note, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
> thread_status_size += notesize(&psinfo_note);
>
> auxv = (elf_addr_t *) current->mm->saved_auxv;
> @@ -1538,7 +1538,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
> do
> i += 2;
> while (auxv[i - 2] != AT_NULL);
> - fill_note(&auxv_note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
> + fill_note(&auxv_note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
> thread_status_size += notesize(&auxv_note);
>
> offset = sizeof(*elf); /* ELF header */
>
> --
> 2.47.1
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 3/6] powerpc: Use note name macros
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
2025-01-11 5:48 ` [PATCH v4 1/6] " Akihiko Odaki
2025-01-11 5:48 ` [PATCH v4 2/6] binfmt_elf: Use " Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:23 ` Dave Martin
2025-01-11 5:48 ` [PATCH v4 4/6] crash: " Akihiko Odaki
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki
Use note name macros to match with the userspace's expectation.
Acked-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
arch/powerpc/kernel/fadump.c | 2 +-
arch/powerpc/platforms/powernv/opal-core.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 4b371c738213..d44349fe8e2b 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -751,7 +751,7 @@ u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs)
* prstatus.pr_pid = ????
*/
elf_core_copy_regs(&prstatus.pr_reg, regs);
- buf = append_elf_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
+ buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS,
&prstatus, sizeof(prstatus));
return buf;
}
diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
index c9a9b759cc92..a379ff86c120 100644
--- a/arch/powerpc/platforms/powernv/opal-core.c
+++ b/arch/powerpc/platforms/powernv/opal-core.c
@@ -149,7 +149,7 @@ static Elf64_Word *__init auxv_to_elf64_notes(Elf64_Word *buf,
/* end of vector */
bufp[idx++] = cpu_to_be64(AT_NULL);
- buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME, NT_AUXV,
+ buf = append_elf64_note(buf, NN_AUXV, NT_AUXV,
oc_conf->auxv_buf, AUXV_DESC_SZ);
return buf;
}
@@ -252,7 +252,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
* crashing CPU's prstatus.
*/
first_cpu_note = buf;
- buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
+ buf = append_elf64_note(buf, NN_PRSTATUS, NT_PRSTATUS,
&prstatus, sizeof(prstatus));
for (i = 0; i < oc_conf->num_cpus; i++, bufp += size_per_thread) {
@@ -279,7 +279,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
fill_prstatus(&prstatus, thread_pir, ®s);
if (thread_pir != oc_conf->crashing_cpu) {
- buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME,
+ buf = append_elf64_note(buf, NN_PRSTATUS,
NT_PRSTATUS, &prstatus,
sizeof(prstatus));
} else {
@@ -287,7 +287,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
* Add crashing CPU as the first NT_PRSTATUS note for
* GDB to process the core file appropriately.
*/
- append_elf64_note(first_cpu_note, CRASH_CORE_NOTE_NAME,
+ append_elf64_note(first_cpu_note, NN_PRSTATUS,
NT_PRSTATUS, &prstatus,
sizeof(prstatus));
}
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 3/6] powerpc: Use note name macros
2025-01-11 5:48 ` [PATCH v4 3/6] powerpc: " Akihiko Odaki
@ 2025-01-14 12:23 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:23 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel
Hi,
On Sat, Jan 11, 2025 at 02:48:46PM +0900, Akihiko Odaki wrote:
> Use note name macros to match with the userspace's expectation.
Note, there seems to be some manual encoding of some arch-specific
notes in arch/powerpc/boot/addnote.c, but since this is all hard-coded
and the note types are not taken from elf.h anyway, I think this is
probably out of scope for this series. I haven't tried to understand
fully what that code is doing.
Anyway:
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
>
> Acked-by: Baoquan He <bhe@redhat.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> arch/powerpc/kernel/fadump.c | 2 +-
> arch/powerpc/platforms/powernv/opal-core.c | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index 4b371c738213..d44349fe8e2b 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -751,7 +751,7 @@ u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs)
> * prstatus.pr_pid = ????
> */
> elf_core_copy_regs(&prstatus.pr_reg, regs);
> - buf = append_elf_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
> + buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS,
> &prstatus, sizeof(prstatus));
> return buf;
> }
> diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
> index c9a9b759cc92..a379ff86c120 100644
> --- a/arch/powerpc/platforms/powernv/opal-core.c
> +++ b/arch/powerpc/platforms/powernv/opal-core.c
> @@ -149,7 +149,7 @@ static Elf64_Word *__init auxv_to_elf64_notes(Elf64_Word *buf,
> /* end of vector */
> bufp[idx++] = cpu_to_be64(AT_NULL);
>
> - buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME, NT_AUXV,
> + buf = append_elf64_note(buf, NN_AUXV, NT_AUXV,
> oc_conf->auxv_buf, AUXV_DESC_SZ);
> return buf;
> }
> @@ -252,7 +252,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
> * crashing CPU's prstatus.
> */
> first_cpu_note = buf;
> - buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
> + buf = append_elf64_note(buf, NN_PRSTATUS, NT_PRSTATUS,
> &prstatus, sizeof(prstatus));
>
> for (i = 0; i < oc_conf->num_cpus; i++, bufp += size_per_thread) {
> @@ -279,7 +279,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
> fill_prstatus(&prstatus, thread_pir, ®s);
>
> if (thread_pir != oc_conf->crashing_cpu) {
> - buf = append_elf64_note(buf, CRASH_CORE_NOTE_NAME,
> + buf = append_elf64_note(buf, NN_PRSTATUS,
> NT_PRSTATUS, &prstatus,
> sizeof(prstatus));
> } else {
> @@ -287,7 +287,7 @@ static Elf64_Word * __init opalcore_append_cpu_notes(Elf64_Word *buf)
> * Add crashing CPU as the first NT_PRSTATUS note for
> * GDB to process the core file appropriately.
> */
> - append_elf64_note(first_cpu_note, CRASH_CORE_NOTE_NAME,
> + append_elf64_note(first_cpu_note, NN_PRSTATUS,
> NT_PRSTATUS, &prstatus,
> sizeof(prstatus));
> }
>
> --
> 2.47.1
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 4/6] crash: Use note name macros
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
` (2 preceding siblings ...)
2025-01-11 5:48 ` [PATCH v4 3/6] powerpc: " Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:23 ` Dave Martin
2025-01-11 5:48 ` [PATCH v4 5/6] s390/crash: " Akihiko Odaki
2025-01-11 5:48 ` [PATCH v4 6/6] crash: Remove KEXEC_CORE_NOTE_NAME Akihiko Odaki
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki
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>
---
fs/proc/kcore.c | 12 ++++++------
include/linux/vmcore_info.h | 2 +-
kernel/crash_core.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index e376f48c4b8b..e5612313b8b4 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -34,8 +34,6 @@
#include <asm/sections.h>
#include "internal.h"
-#define CORE_STR "CORE"
-
#ifndef ELF_CORE_EFLAGS
#define ELF_CORE_EFLAGS 0
#endif
@@ -119,7 +117,9 @@ static size_t get_kcore_size(int *nphdr, size_t *phdrs_len, size_t *notes_len,
*phdrs_len = *nphdr * sizeof(struct elf_phdr);
*notes_len = (4 * sizeof(struct elf_note) +
- 3 * ALIGN(sizeof(CORE_STR), 4) +
+ ALIGN(sizeof(NN_PRSTATUS), 4) +
+ ALIGN(sizeof(NN_PRPSINFO), 4) +
+ ALIGN(sizeof(NN_TASKSTRUCT), 4) +
VMCOREINFO_NOTE_NAME_BYTES +
ALIGN(sizeof(struct elf_prstatus), 4) +
ALIGN(sizeof(struct elf_prpsinfo), 4) +
@@ -444,11 +444,11 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
goto out;
}
- append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus,
+ append_kcore_note(notes, &i, NN_PRSTATUS, NT_PRSTATUS, &prstatus,
sizeof(prstatus));
- append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo,
+ append_kcore_note(notes, &i, NN_PRPSINFO, NT_PRPSINFO, &prpsinfo,
sizeof(prpsinfo));
- append_kcore_note(notes, &i, CORE_STR, NT_TASKSTRUCT, current,
+ append_kcore_note(notes, &i, NN_TASKSTRUCT, NT_TASKSTRUCT, current,
arch_task_struct_size);
/*
* vmcoreinfo_size is mostly constant after init time, but it
diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h
index e1dec1a6a749..1672801fd98c 100644
--- a/include/linux/vmcore_info.h
+++ b/include/linux/vmcore_info.h
@@ -8,7 +8,7 @@
#define CRASH_CORE_NOTE_NAME "CORE"
#define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
-#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4)
+#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4)
#define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
/*
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 078fe5bc5a74..335b8425dd4b 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -436,7 +436,7 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
memset(&prstatus, 0, sizeof(prstatus));
prstatus.common.pr_pid = current->pid;
elf_core_copy_regs(&prstatus.pr_reg, regs);
- buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
+ buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS,
&prstatus, sizeof(prstatus));
final_note(buf);
}
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 4/6] crash: Use note name macros
2025-01-11 5:48 ` [PATCH v4 4/6] crash: " Akihiko Odaki
@ 2025-01-14 12:23 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:23 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel
On Sat, Jan 11, 2025 at 02:48:47PM +0900, Akihiko Odaki wrote:
> 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>
> ---
> fs/proc/kcore.c | 12 ++++++------
> include/linux/vmcore_info.h | 2 +-
> kernel/crash_core.c | 2 +-
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
> index e376f48c4b8b..e5612313b8b4 100644
> --- a/fs/proc/kcore.c
> +++ b/fs/proc/kcore.c
> @@ -34,8 +34,6 @@
> #include <asm/sections.h>
> #include "internal.h"
>
> -#define CORE_STR "CORE"
> -
> #ifndef ELF_CORE_EFLAGS
> #define ELF_CORE_EFLAGS 0
> #endif
> @@ -119,7 +117,9 @@ static size_t get_kcore_size(int *nphdr, size_t *phdrs_len, size_t *notes_len,
>
> *phdrs_len = *nphdr * sizeof(struct elf_phdr);
> *notes_len = (4 * sizeof(struct elf_note) +
> - 3 * ALIGN(sizeof(CORE_STR), 4) +
> + ALIGN(sizeof(NN_PRSTATUS), 4) +
> + ALIGN(sizeof(NN_PRPSINFO), 4) +
> + ALIGN(sizeof(NN_TASKSTRUCT), 4) +
> VMCOREINFO_NOTE_NAME_BYTES +
> ALIGN(sizeof(struct elf_prstatus), 4) +
> ALIGN(sizeof(struct elf_prpsinfo), 4) +
> @@ -444,11 +444,11 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
> goto out;
> }
>
> - append_kcore_note(notes, &i, CORE_STR, NT_PRSTATUS, &prstatus,
> + append_kcore_note(notes, &i, NN_PRSTATUS, NT_PRSTATUS, &prstatus,
> sizeof(prstatus));
> - append_kcore_note(notes, &i, CORE_STR, NT_PRPSINFO, &prpsinfo,
> + append_kcore_note(notes, &i, NN_PRPSINFO, NT_PRPSINFO, &prpsinfo,
> sizeof(prpsinfo));
> - append_kcore_note(notes, &i, CORE_STR, NT_TASKSTRUCT, current,
> + append_kcore_note(notes, &i, NN_TASKSTRUCT, NT_TASKSTRUCT, current,
> arch_task_struct_size);
> /*
> * vmcoreinfo_size is mostly constant after init time, but it
> diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h
> index e1dec1a6a749..1672801fd98c 100644
> --- a/include/linux/vmcore_info.h
> +++ b/include/linux/vmcore_info.h
> @@ -8,7 +8,7 @@
>
> #define CRASH_CORE_NOTE_NAME "CORE"
> #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
> -#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4)
> +#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4)
> #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
>
> /*
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 078fe5bc5a74..335b8425dd4b 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -436,7 +436,7 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
> memset(&prstatus, 0, sizeof(prstatus));
> prstatus.common.pr_pid = current->pid;
> elf_core_copy_regs(&prstatus.pr_reg, regs);
> - buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
> + buf = append_elf_note(buf, NN_PRSTATUS, NT_PRSTATUS,
> &prstatus, sizeof(prstatus));
> final_note(buf);
> }
>
> --
> 2.47.1
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 5/6] s390/crash: Use note name macros
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
` (3 preceding siblings ...)
2025-01-11 5:48 ` [PATCH v4 4/6] crash: " Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:23 ` Dave Martin
2025-01-11 5:48 ` [PATCH v4 6/6] crash: Remove KEXEC_CORE_NOTE_NAME Akihiko Odaki
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki, Heiko Carstens
Use note name macros to match with the userspace's expectation.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/kernel/crash_dump.c | 62 ++++++++++++++++---------------------------
1 file changed, 23 insertions(+), 39 deletions(-)
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index cd0c93a8fb8b..022f4f198edf 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -248,15 +248,6 @@ bool is_kdump_kernel(void)
}
EXPORT_SYMBOL_GPL(is_kdump_kernel);
-static const char *nt_name(Elf64_Word type)
-{
- const char *name = "LINUX";
-
- if (type == NT_PRPSINFO || type == NT_PRSTATUS || type == NT_PRFPREG)
- name = KEXEC_CORE_NOTE_NAME;
- return name;
-}
-
/*
* Initialize ELF note
*/
@@ -281,10 +272,8 @@ static void *nt_init_name(void *buf, Elf64_Word type, void *desc, int d_len,
return PTR_ADD(buf, len);
}
-static inline void *nt_init(void *buf, Elf64_Word type, void *desc, int d_len)
-{
- return nt_init_name(buf, type, desc, d_len, nt_name(type));
-}
+#define nt_init(buf, type, desc) \
+ nt_init_name(buf, NT_ ## type, &(desc), sizeof(desc), NN_ ## type)
/*
* Calculate the size of ELF note
@@ -300,10 +289,7 @@ static size_t nt_size_name(int d_len, const char *name)
return size;
}
-static inline size_t nt_size(Elf64_Word type, int d_len)
-{
- return nt_size_name(d_len, nt_name(type));
-}
+#define nt_size(type, desc) nt_size_name(sizeof(desc), NN_ ## type)
/*
* Fill ELF notes for one CPU with save area registers
@@ -324,18 +310,16 @@ static void *fill_cpu_elf_notes(void *ptr, int cpu, struct save_area *sa)
memcpy(&nt_fpregset.fpc, &sa->fpc, sizeof(sa->fpc));
memcpy(&nt_fpregset.fprs, &sa->fprs, sizeof(sa->fprs));
/* Create ELF notes for the CPU */
- ptr = nt_init(ptr, NT_PRSTATUS, &nt_prstatus, sizeof(nt_prstatus));
- ptr = nt_init(ptr, NT_PRFPREG, &nt_fpregset, sizeof(nt_fpregset));
- ptr = nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer));
- ptr = nt_init(ptr, NT_S390_TODCMP, &sa->todcmp, sizeof(sa->todcmp));
- ptr = nt_init(ptr, NT_S390_TODPREG, &sa->todpreg, sizeof(sa->todpreg));
- ptr = nt_init(ptr, NT_S390_CTRS, &sa->ctrs, sizeof(sa->ctrs));
- ptr = nt_init(ptr, NT_S390_PREFIX, &sa->prefix, sizeof(sa->prefix));
+ ptr = nt_init(ptr, PRSTATUS, nt_prstatus);
+ ptr = nt_init(ptr, PRFPREG, nt_fpregset);
+ ptr = nt_init(ptr, S390_TIMER, sa->timer);
+ ptr = nt_init(ptr, S390_TODCMP, sa->todcmp);
+ ptr = nt_init(ptr, S390_TODPREG, sa->todpreg);
+ ptr = nt_init(ptr, S390_CTRS, sa->ctrs);
+ ptr = nt_init(ptr, S390_PREFIX, sa->prefix);
if (cpu_has_vx()) {
- ptr = nt_init(ptr, NT_S390_VXRS_HIGH,
- &sa->vxrs_high, sizeof(sa->vxrs_high));
- ptr = nt_init(ptr, NT_S390_VXRS_LOW,
- &sa->vxrs_low, sizeof(sa->vxrs_low));
+ ptr = nt_init(ptr, S390_VXRS_HIGH, sa->vxrs_high);
+ ptr = nt_init(ptr, S390_VXRS_LOW, sa->vxrs_low);
}
return ptr;
}
@@ -348,16 +332,16 @@ static size_t get_cpu_elf_notes_size(void)
struct save_area *sa = NULL;
size_t size;
- size = nt_size(NT_PRSTATUS, sizeof(struct elf_prstatus));
- size += nt_size(NT_PRFPREG, sizeof(elf_fpregset_t));
- size += nt_size(NT_S390_TIMER, sizeof(sa->timer));
- size += nt_size(NT_S390_TODCMP, sizeof(sa->todcmp));
- size += nt_size(NT_S390_TODPREG, sizeof(sa->todpreg));
- size += nt_size(NT_S390_CTRS, sizeof(sa->ctrs));
- size += nt_size(NT_S390_PREFIX, sizeof(sa->prefix));
+ size = nt_size(PRSTATUS, struct elf_prstatus);
+ size += nt_size(PRFPREG, elf_fpregset_t);
+ size += nt_size(S390_TIMER, sa->timer);
+ size += nt_size(S390_TODCMP, sa->todcmp);
+ size += nt_size(S390_TODPREG, sa->todpreg);
+ size += nt_size(S390_CTRS, sa->ctrs);
+ size += nt_size(S390_PREFIX, sa->prefix);
if (cpu_has_vx()) {
- size += nt_size(NT_S390_VXRS_HIGH, sizeof(sa->vxrs_high));
- size += nt_size(NT_S390_VXRS_LOW, sizeof(sa->vxrs_low));
+ size += nt_size(S390_VXRS_HIGH, sa->vxrs_high);
+ size += nt_size(S390_VXRS_LOW, sa->vxrs_low);
}
return size;
@@ -373,7 +357,7 @@ static void *nt_prpsinfo(void *ptr)
memset(&prpsinfo, 0, sizeof(prpsinfo));
prpsinfo.pr_sname = 'R';
strcpy(prpsinfo.pr_fname, "vmlinux");
- return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo));
+ return nt_init(ptr, PRPSINFO, prpsinfo);
}
/*
@@ -589,7 +573,7 @@ static size_t get_elfcorehdr_size(int phdr_count)
/* PT_NOTES */
size += sizeof(Elf64_Phdr);
/* nt_prpsinfo */
- size += nt_size(NT_PRPSINFO, sizeof(struct elf_prpsinfo));
+ size += nt_size(PRPSINFO, struct elf_prpsinfo);
/* regsets */
size += get_cpu_cnt() * get_cpu_elf_notes_size();
/* nt_vmcoreinfo */
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 5/6] s390/crash: Use note name macros
2025-01-11 5:48 ` [PATCH v4 5/6] s390/crash: " Akihiko Odaki
@ 2025-01-14 12:23 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:23 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel,
Heiko Carstens
Hi,
On Sat, Jan 11, 2025 at 02:48:48PM +0900, Akihiko Odaki wrote:
> Use note name macros to match with the userspace's expectation.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Acked-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
(I'm not in a position to test this, though.)
> ---
> arch/s390/kernel/crash_dump.c | 62 ++++++++++++++++---------------------------
> 1 file changed, 23 insertions(+), 39 deletions(-)
>
> diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
> index cd0c93a8fb8b..022f4f198edf 100644
> --- a/arch/s390/kernel/crash_dump.c
> +++ b/arch/s390/kernel/crash_dump.c
> @@ -248,15 +248,6 @@ bool is_kdump_kernel(void)
> }
> EXPORT_SYMBOL_GPL(is_kdump_kernel);
>
> -static const char *nt_name(Elf64_Word type)
> -{
> - const char *name = "LINUX";
> -
> - if (type == NT_PRPSINFO || type == NT_PRSTATUS || type == NT_PRFPREG)
> - name = KEXEC_CORE_NOTE_NAME;
> - return name;
> -}
> -
> /*
> * Initialize ELF note
> */
> @@ -281,10 +272,8 @@ static void *nt_init_name(void *buf, Elf64_Word type, void *desc, int d_len,
> return PTR_ADD(buf, len);
> }
>
> -static inline void *nt_init(void *buf, Elf64_Word type, void *desc, int d_len)
> -{
> - return nt_init_name(buf, type, desc, d_len, nt_name(type));
> -}
> +#define nt_init(buf, type, desc) \
> + nt_init_name(buf, NT_ ## type, &(desc), sizeof(desc), NN_ ## type)
>
> /*
> * Calculate the size of ELF note
> @@ -300,10 +289,7 @@ static size_t nt_size_name(int d_len, const char *name)
> return size;
> }
>
> -static inline size_t nt_size(Elf64_Word type, int d_len)
> -{
> - return nt_size_name(d_len, nt_name(type));
> -}
> +#define nt_size(type, desc) nt_size_name(sizeof(desc), NN_ ## type)
>
> /*
> * Fill ELF notes for one CPU with save area registers
> @@ -324,18 +310,16 @@ static void *fill_cpu_elf_notes(void *ptr, int cpu, struct save_area *sa)
> memcpy(&nt_fpregset.fpc, &sa->fpc, sizeof(sa->fpc));
> memcpy(&nt_fpregset.fprs, &sa->fprs, sizeof(sa->fprs));
> /* Create ELF notes for the CPU */
> - ptr = nt_init(ptr, NT_PRSTATUS, &nt_prstatus, sizeof(nt_prstatus));
> - ptr = nt_init(ptr, NT_PRFPREG, &nt_fpregset, sizeof(nt_fpregset));
> - ptr = nt_init(ptr, NT_S390_TIMER, &sa->timer, sizeof(sa->timer));
> - ptr = nt_init(ptr, NT_S390_TODCMP, &sa->todcmp, sizeof(sa->todcmp));
> - ptr = nt_init(ptr, NT_S390_TODPREG, &sa->todpreg, sizeof(sa->todpreg));
> - ptr = nt_init(ptr, NT_S390_CTRS, &sa->ctrs, sizeof(sa->ctrs));
> - ptr = nt_init(ptr, NT_S390_PREFIX, &sa->prefix, sizeof(sa->prefix));
> + ptr = nt_init(ptr, PRSTATUS, nt_prstatus);
> + ptr = nt_init(ptr, PRFPREG, nt_fpregset);
> + ptr = nt_init(ptr, S390_TIMER, sa->timer);
> + ptr = nt_init(ptr, S390_TODCMP, sa->todcmp);
> + ptr = nt_init(ptr, S390_TODPREG, sa->todpreg);
> + ptr = nt_init(ptr, S390_CTRS, sa->ctrs);
> + ptr = nt_init(ptr, S390_PREFIX, sa->prefix);
> if (cpu_has_vx()) {
> - ptr = nt_init(ptr, NT_S390_VXRS_HIGH,
> - &sa->vxrs_high, sizeof(sa->vxrs_high));
> - ptr = nt_init(ptr, NT_S390_VXRS_LOW,
> - &sa->vxrs_low, sizeof(sa->vxrs_low));
> + ptr = nt_init(ptr, S390_VXRS_HIGH, sa->vxrs_high);
> + ptr = nt_init(ptr, S390_VXRS_LOW, sa->vxrs_low);
> }
> return ptr;
> }
> @@ -348,16 +332,16 @@ static size_t get_cpu_elf_notes_size(void)
> struct save_area *sa = NULL;
> size_t size;
>
> - size = nt_size(NT_PRSTATUS, sizeof(struct elf_prstatus));
> - size += nt_size(NT_PRFPREG, sizeof(elf_fpregset_t));
> - size += nt_size(NT_S390_TIMER, sizeof(sa->timer));
> - size += nt_size(NT_S390_TODCMP, sizeof(sa->todcmp));
> - size += nt_size(NT_S390_TODPREG, sizeof(sa->todpreg));
> - size += nt_size(NT_S390_CTRS, sizeof(sa->ctrs));
> - size += nt_size(NT_S390_PREFIX, sizeof(sa->prefix));
> + size = nt_size(PRSTATUS, struct elf_prstatus);
> + size += nt_size(PRFPREG, elf_fpregset_t);
> + size += nt_size(S390_TIMER, sa->timer);
> + size += nt_size(S390_TODCMP, sa->todcmp);
> + size += nt_size(S390_TODPREG, sa->todpreg);
> + size += nt_size(S390_CTRS, sa->ctrs);
> + size += nt_size(S390_PREFIX, sa->prefix);
> if (cpu_has_vx()) {
> - size += nt_size(NT_S390_VXRS_HIGH, sizeof(sa->vxrs_high));
> - size += nt_size(NT_S390_VXRS_LOW, sizeof(sa->vxrs_low));
> + size += nt_size(S390_VXRS_HIGH, sa->vxrs_high);
> + size += nt_size(S390_VXRS_LOW, sa->vxrs_low);
> }
>
> return size;
> @@ -373,7 +357,7 @@ static void *nt_prpsinfo(void *ptr)
> memset(&prpsinfo, 0, sizeof(prpsinfo));
> prpsinfo.pr_sname = 'R';
> strcpy(prpsinfo.pr_fname, "vmlinux");
> - return nt_init(ptr, NT_PRPSINFO, &prpsinfo, sizeof(prpsinfo));
> + return nt_init(ptr, PRPSINFO, prpsinfo);
> }
>
> /*
> @@ -589,7 +573,7 @@ static size_t get_elfcorehdr_size(int phdr_count)
> /* PT_NOTES */
> size += sizeof(Elf64_Phdr);
> /* nt_prpsinfo */
> - size += nt_size(NT_PRPSINFO, sizeof(struct elf_prpsinfo));
> + size += nt_size(PRPSINFO, struct elf_prpsinfo);
> /* regsets */
> size += get_cpu_cnt() * get_cpu_elf_notes_size();
> /* nt_vmcoreinfo */
>
> --
> 2.47.1
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 6/6] crash: Remove KEXEC_CORE_NOTE_NAME
2025-01-11 5:48 [PATCH v4 0/6] elf: Define note name macros Akihiko Odaki
` (4 preceding siblings ...)
2025-01-11 5:48 ` [PATCH v4 5/6] s390/crash: " Akihiko Odaki
@ 2025-01-11 5:48 ` Akihiko Odaki
2025-01-14 12:23 ` Dave Martin
5 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2025-01-11 5:48 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Dave Martin, Baoquan He, Vivek Goyal, Dave Young,
LEROY Christophe
Cc: linux-mm, linux-kernel, linuxppc-dev, linux-s390, kexec,
binutils, devel, Akihiko Odaki
KEXEC_CORE_NOTE_NAME is no longer used.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Baoquan He <bhe@redhat.com>
---
include/linux/kexec.h | 2 --
include/linux/vmcore_info.h | 1 -
2 files changed, 3 deletions(-)
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index f0e9f8eda7a3..c840431eadda 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -68,8 +68,6 @@ extern note_buf_t __percpu *crash_notes;
#define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE
#endif
-#define KEXEC_CORE_NOTE_NAME CRASH_CORE_NOTE_NAME
-
/*
* This structure is used to hold the arguments that are used when loading
* kernel binaries.
diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h
index 1672801fd98c..37e003ae5262 100644
--- a/include/linux/vmcore_info.h
+++ b/include/linux/vmcore_info.h
@@ -6,7 +6,6 @@
#include <linux/elfcore.h>
#include <linux/elf.h>
-#define CRASH_CORE_NOTE_NAME "CORE"
#define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4)
#define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
--
2.47.1
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 6/6] crash: Remove KEXEC_CORE_NOTE_NAME
2025-01-11 5:48 ` [PATCH v4 6/6] crash: Remove KEXEC_CORE_NOTE_NAME Akihiko Odaki
@ 2025-01-14 12:23 ` Dave Martin
0 siblings, 0 replies; 13+ messages in thread
From: Dave Martin @ 2025-01-14 12:23 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Eric Biederman, Kees Cook, Catalin Marinas, Mark Brown,
Baoquan He, Vivek Goyal, Dave Young, LEROY Christophe, linux-mm,
linux-kernel, linuxppc-dev, linux-s390, kexec, binutils, devel
Hi,
On Sat, Jan 11, 2025 at 02:48:49PM +0900, Akihiko Odaki wrote:
> KEXEC_CORE_NOTE_NAME is no longer used.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Acked-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> ---
> include/linux/kexec.h | 2 --
> include/linux/vmcore_info.h | 1 -
> 2 files changed, 3 deletions(-)
>
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index f0e9f8eda7a3..c840431eadda 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -68,8 +68,6 @@ extern note_buf_t __percpu *crash_notes;
> #define KEXEC_CRASH_MEM_ALIGN PAGE_SIZE
> #endif
>
> -#define KEXEC_CORE_NOTE_NAME CRASH_CORE_NOTE_NAME
> -
> /*
> * This structure is used to hold the arguments that are used when loading
> * kernel binaries.
> diff --git a/include/linux/vmcore_info.h b/include/linux/vmcore_info.h
> index 1672801fd98c..37e003ae5262 100644
> --- a/include/linux/vmcore_info.h
> +++ b/include/linux/vmcore_info.h
> @@ -6,7 +6,6 @@
> #include <linux/elfcore.h>
> #include <linux/elf.h>
>
> -#define CRASH_CORE_NOTE_NAME "CORE"
> #define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
> #define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(NN_PRSTATUS), 4)
> #define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
>
> --
> 2.47.1
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread