public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Replace the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
@ 2024-04-12  6:21 Vignesh Balasubramanian
  2024-04-12  6:21 ` [PATCH 1/1] Replace " Vignesh Balasubramanian
  2024-04-15 18:03 ` [PATCH 0/1] Replace the " Kees Cook
  0 siblings, 2 replies; 5+ messages in thread
From: Vignesh Balasubramanian @ 2024-04-12  6:21 UTC (permalink / raw)
  To: linux-kernel, linux-toolchains
  Cc: mpe, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao,
	ebiederm, keescook, x86, linuxppc-dev, linux-mm, bpetkov,
	jinisusan.george, matz, binutils, jhb, felix.willgerodt,
	Vignesh Balasubramanian

This patch replaces the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
as discussed here
https://lore.kernel.org/lkml/CA+55aFxDk9_cmo4SPYMgG_WQ+_g5e_v6O-HEtQ_nTs-q1zjykg@mail.gmail.com/
It is a pre-requisite patch for the review
https://lore.kernel.org/lkml/20240314112359.50713-1-vigbalas@amd.com/
I have split this patch as suggested in the review comment
https://lore.kernel.org/lkml/87o7bg31jd.fsf@mail.lhotse/


Vignesh Balasubramanian (1):
  Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig

 arch/Kconfig                   | 9 +++++++++
 arch/powerpc/Kconfig           | 1 +
 arch/powerpc/include/asm/elf.h | 2 --
 include/linux/elf.h            | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
  2024-04-12  6:21 [PATCH 0/1] Replace the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig Vignesh Balasubramanian
@ 2024-04-12  6:21 ` Vignesh Balasubramanian
  2024-04-12 12:07   ` Michael Ellerman
  2024-04-22  8:15   ` Florian Weimer
  2024-04-15 18:03 ` [PATCH 0/1] Replace the " Kees Cook
  1 sibling, 2 replies; 5+ messages in thread
From: Vignesh Balasubramanian @ 2024-04-12  6:21 UTC (permalink / raw)
  To: linux-kernel, linux-toolchains
  Cc: mpe, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao,
	ebiederm, keescook, x86, linuxppc-dev, linux-mm, bpetkov,
	jinisusan.george, matz, binutils, jhb, felix.willgerodt,
	Vignesh Balasubramanian

"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>
---
 arch/Kconfig                   | 9 +++++++++
 arch/powerpc/Kconfig           | 1 +
 arch/powerpc/include/asm/elf.h | 2 --
 include/linux/elf.h            | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 9f066785bb71..143f021c8a76 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -502,6 +502,15 @@ config MMU_LAZY_TLB_SHOOTDOWN
 config ARCH_HAVE_NMI_SAFE_CMPXCHG
 	bool
 
+config ARCH_HAVE_EXTRA_ELF_NOTES
+	bool
+	help
+	  An architecture should select this in order to enable adding an
+	  arch-specific ELF note section to core files. It must provide two
+	  functions: elf_coredump_extra_notes_size() and
+	  elf_coredump_extra_notes_write() which are invoked by the ELF core
+	  dumper.
+
 config ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
 	bool
 
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1c4be3373686..c45fa9d7fb76 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -156,6 +156,7 @@ config PPC
 	select ARCH_HAS_UACCESS_FLUSHCACHE
 	select ARCH_HAS_UBSAN
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
+	select ARCH_HAVE_EXTRA_ELF_NOTES        if SPU_BASE
 	select ARCH_KEEP_MEMBLOCK
 	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if PPC_RADIX_MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 79f1c480b5eb..bb4b94444d3e 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -127,8 +127,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 /* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
 #define NT_SPU		1
 
-#define ARCH_HAVE_EXTRA_ELF_NOTES
-
 #endif /* CONFIG_SPU_BASE */
 
 #ifdef CONFIG_PPC64
diff --git a/include/linux/elf.h b/include/linux/elf.h
index c9a46c4e183b..5c402788da19 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -65,7 +65,7 @@ extern Elf64_Dyn _DYNAMIC [];
 struct file;
 struct coredump_params;
 
-#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
+#ifndef CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES
 static inline int elf_coredump_extra_notes_size(void) { return 0; }
 static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
 #else
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
  2024-04-12  6:21 ` [PATCH 1/1] Replace " Vignesh Balasubramanian
@ 2024-04-12 12:07   ` Michael Ellerman
  2024-04-22  8:15   ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2024-04-12 12:07 UTC (permalink / raw)
  To: Vignesh Balasubramanian, linux-kernel, linux-toolchains
  Cc: npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao, ebiederm,
	keescook, x86, linuxppc-dev, linux-mm, bpetkov, jinisusan.george,
	matz, binutils, jhb, felix.willgerodt, Vignesh Balasubramanian

Vignesh Balasubramanian <vigbalas@amd.com> writes:
> "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>
> ---
>  arch/Kconfig                   | 9 +++++++++
>  arch/powerpc/Kconfig           | 1 +
>  arch/powerpc/include/asm/elf.h | 2 --
>  include/linux/elf.h            | 2 +-
>  4 files changed, 11 insertions(+), 3 deletions(-)

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

> diff --git a/arch/Kconfig b/arch/Kconfig
> index 9f066785bb71..143f021c8a76 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -502,6 +502,15 @@ config MMU_LAZY_TLB_SHOOTDOWN
>  config ARCH_HAVE_NMI_SAFE_CMPXCHG
>  	bool
>  
> +config ARCH_HAVE_EXTRA_ELF_NOTES
> +	bool
> +	help
> +	  An architecture should select this in order to enable adding an
> +	  arch-specific ELF note section to core files. It must provide two
> +	  functions: elf_coredump_extra_notes_size() and
> +	  elf_coredump_extra_notes_write() which are invoked by the ELF core
> +	  dumper.
> +
>  config ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>  	bool
>  
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 1c4be3373686..c45fa9d7fb76 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -156,6 +156,7 @@ config PPC
>  	select ARCH_HAS_UACCESS_FLUSHCACHE
>  	select ARCH_HAS_UBSAN
>  	select ARCH_HAVE_NMI_SAFE_CMPXCHG
> +	select ARCH_HAVE_EXTRA_ELF_NOTES        if SPU_BASE
>  	select ARCH_KEEP_MEMBLOCK
>  	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if PPC_RADIX_MMU
>  	select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
> index 79f1c480b5eb..bb4b94444d3e 100644
> --- a/arch/powerpc/include/asm/elf.h
> +++ b/arch/powerpc/include/asm/elf.h
> @@ -127,8 +127,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
>  /* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
>  #define NT_SPU		1
>  
> -#define ARCH_HAVE_EXTRA_ELF_NOTES
> -
>  #endif /* CONFIG_SPU_BASE */
>  
>  #ifdef CONFIG_PPC64
> diff --git a/include/linux/elf.h b/include/linux/elf.h
> index c9a46c4e183b..5c402788da19 100644
> --- a/include/linux/elf.h
> +++ b/include/linux/elf.h
> @@ -65,7 +65,7 @@ extern Elf64_Dyn _DYNAMIC [];
>  struct file;
>  struct coredump_params;
>  
> -#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
> +#ifndef CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES
>  static inline int elf_coredump_extra_notes_size(void) { return 0; }
>  static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
>  #else
> -- 
> 2.34.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/1] Replace the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
  2024-04-12  6:21 [PATCH 0/1] Replace the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig Vignesh Balasubramanian
  2024-04-12  6:21 ` [PATCH 1/1] Replace " Vignesh Balasubramanian
@ 2024-04-15 18:03 ` Kees Cook
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2024-04-15 18:03 UTC (permalink / raw)
  To: linux-kernel, linux-toolchains, Vignesh Balasubramanian
  Cc: Kees Cook, mpe, npiggin, christophe.leroy, aneesh.kumar,
	naveen.n.rao, ebiederm, x86, linuxppc-dev, linux-mm, bpetkov,
	jinisusan.george, matz, binutils, jhb, felix.willgerodt

On Fri, 12 Apr 2024 11:51:37 +0530, Vignesh Balasubramanian wrote:
> This patch replaces the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
> as discussed here
> https://lore.kernel.org/lkml/CA+55aFxDk9_cmo4SPYMgG_WQ+_g5e_v6O-HEtQ_nTs-q1zjykg@mail.gmail.com/
> It is a pre-requisite patch for the review
> https://lore.kernel.org/lkml/20240314112359.50713-1-vigbalas@amd.com/
> I have split this patch as suggested in the review comment
> https://lore.kernel.org/lkml/87o7bg31jd.fsf@mail.lhotse/
> 
> [...]

Applied to for-next/execve, thanks!

[1/1] Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
      https://git.kernel.org/kees/c/a9c3475dd67b

Take care,

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] Replace macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig
  2024-04-12  6:21 ` [PATCH 1/1] Replace " Vignesh Balasubramanian
  2024-04-12 12:07   ` Michael Ellerman
@ 2024-04-22  8:15   ` Florian Weimer
  1 sibling, 0 replies; 5+ messages in thread
From: Florian Weimer @ 2024-04-22  8:15 UTC (permalink / raw)
  To: Vignesh Balasubramanian
  Cc: linux-kernel, linux-toolchains, mpe, npiggin, christophe.leroy,
	aneesh.kumar, naveen.n.rao, ebiederm, keescook, x86,
	linuxppc-dev, linux-mm, bpetkov, jinisusan.george, matz,
	binutils, jhb, felix.willgerodt

* Vignesh Balasubramanian:

> diff --git a/include/linux/elf.h b/include/linux/elf.h
> index c9a46c4e183b..5c402788da19 100644
> --- a/include/linux/elf.h
> +++ b/include/linux/elf.h
> @@ -65,7 +65,7 @@ extern Elf64_Dyn _DYNAMIC [];
>  struct file;
>  struct coredump_params;
>  
> -#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
> +#ifndef CONFIG_ARCH_HAVE_EXTRA_ELF_NOTES

You could add

  #pragma GCC poison ARCH_HAVE_EXTRA_ELF_NOTES

to a central header, to let GCC and Clang flag uses that have not been
converted.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-22  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  6:21 [PATCH 0/1] Replace the macro "ARCH_HAVE_EXTRA_ELF_NOTES" with kconfig Vignesh Balasubramanian
2024-04-12  6:21 ` [PATCH 1/1] Replace " Vignesh Balasubramanian
2024-04-12 12:07   ` Michael Ellerman
2024-04-22  8:15   ` Florian Weimer
2024-04-15 18:03 ` [PATCH 0/1] Replace the " Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).