Skip to content

Commit a9c3475

Browse files
vigbalukees
authored andcommitted
Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
"ARCH_HAVE_EXTRA_ELF_NOTES" enables an extra note section in the core dump. Kconfig variable is preferred over ARCH_HAVE_* macro. Co-developed-by: Jini Susan George <jinisusan.george@amd.com> Signed-off-by: Jini Susan George <jinisusan.george@amd.com> Signed-off-by: Vignesh Balasubramanian <vigbalas@amd.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20240412062138.1132841-2-vigbalas@amd.com Signed-off-by: Kees Cook <keescook@chromium.org>
1 parent c823899 commit a9c3475

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

arch/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,15 @@ config MMU_LAZY_TLB_SHOOTDOWN
502502
config ARCH_HAVE_NMI_SAFE_CMPXCHG
503503
bool
504504

505+
config ARCH_HAVE_EXTRA_ELF_NOTES
506+
bool
507+
help
508+
An architecture should select this in order to enable adding an
509+
arch-specific ELF note section to core files. It must provide two
510+
functions: elf_coredump_extra_notes_size() and
511+
elf_coredump_extra_notes_write() which are invoked by the ELF core
512+
dumper.
513+
505514
config ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
506515
bool
507516

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ config PPC
156156
select ARCH_HAS_UACCESS_FLUSHCACHE
157157
select ARCH_HAS_UBSAN
158158
select ARCH_HAVE_NMI_SAFE_CMPXCHG
159+
select ARCH_HAVE_EXTRA_ELF_NOTES if SPU_BASE
159160
select ARCH_KEEP_MEMBLOCK
160161
select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE if PPC_RADIX_MMU
161162
select ARCH_MIGHT_HAVE_PC_PARPORT

arch/powerpc/include/asm/elf.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
127127
/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
128128
#define NT_SPU 1
129129

130-
#define ARCH_HAVE_EXTRA_ELF_NOTES
131-
132130
#endif /* CONFIG_SPU_BASE */
133131

134132
#ifdef CONFIG_PPC64

include/linux/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern Elf64_Dyn _DYNAMIC [];
6565
struct file;
6666
struct coredump_params;
6767

68-
#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
68+
#ifndef CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES
6969
static inline int elf_coredump_extra_notes_size(void) { return 0; }
7070
static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
7171
#else

0 commit comments

Comments
 (0)