lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z3s+QeMv8AaGbMGs@MiWiFi-R3L-srv>
Date: Mon, 6 Jan 2025 10:21:53 +0800
From: Baoquan He <bhe@...hat.com>
To: Akihiko Odaki <akihiko.odaki@...nix.com>
Cc: Eric Biederman <ebiederm@...ssion.com>, Kees Cook <kees@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Mark Brown <broonie@...nel.org>, Dave Martin <Dave.Martin@....com>,
	Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
	kexec@...ts.infradead.org, devel@...nix.com
Subject: Re: [PATCH v2 1/5] elf: Define note name macros

On 01/04/25 at 11:38pm, 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.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@...nix.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..014b705b97d7 100644
> --- a/include/uapi/linux/elf.h
> +++ b/include/uapi/linux/elf.h
> @@ -372,8 +372,6 @@ typedef struct elf64_shdr {
>   * 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 NT_PRSTATUS	1
>  #define NT_PRFPREG	2
> @@ -460,9 +458,91 @@ typedef struct elf64_shdr {
>  #define NT_LOONGARCH_HW_BREAK	0xa05   /* LoongArch hardware breakpoint registers */
>  #define NT_LOONGARCH_HW_WATCH	0xa06   /* LoongArch hardware watchpoint registers */
>  
> -/* Note types with note name "GNU" */
> +/* Note used in ET_EXEC and ET_DYN. */
>  #define NT_GNU_PROPERTY_TYPE_0	5
>  
> +/* Note names */
> +#define NN_PRSTATUS	"CORE"
> +#define NN_PRFPREG	"CORE"
> +#define NN_PRPSINFO	"CORE"
> +#define NN_TASKSTRUCT	"CORE"
> +#define NN_AUXV	"CORE"
> +#define NN_SIGINFO	"CORE"
> +#define NN_FILE	"CORE"
> +#define NN_PRXFPREG	"LINUX"

No objection to make them clearer. Thanks for the effort.

Wondering where below arch specific macros are used. So you just
added all NN_xxx for the corresponding NT_xxx? Not sure if this is
needed if we don't use them at all in the current kernel.

> +#define NN_PPC_VMX	"LINUX"
> +#define NN_PPC_SPE	"LINUX"
> +#define NN_PPC_VSX	"LINUX"
> +#define NN_PPC_TAR	"LINUX"
> +#define NN_PPC_PPR	"LINUX"
> +#define NN_PPC_DSCR	"LINUX"
> +#define NN_PPC_EBB	"LINUX"
> +#define NN_PPC_PMU	"LINUX"
> +#define NN_PPC_TM_CGPR	"LINUX"
> +#define NN_PPC_TM_CFPR	"LINUX"
> +#define NN_PPC_TM_CVMX	"LINUX"
> +#define NN_PPC_TM_CVSX	"LINUX"
> +#define NN_PPC_TM_SPR	"LINUX"
> +#define NN_PPC_TM_CTAR	"LINUX"
> +#define NN_PPC_TM_CPPR	"LINUX"
> +#define NN_PPC_TM_CDSCR	"LINUX"
> +#define NN_PPC_PKEY	"LINUX"
> +#define NN_PPC_DEXCR	"LINUX"
> +#define NN_PPC_HASHKEYR	"LINUX"
> +#define NN_386_TLS	"LINUX"
> +#define NN_386_IOPERM	"LINUX"
> +#define NN_X86_XSTATE	"LINUX"
> +#define NN_X86_SHSTK	"LINUX"
> +#define NN_X86_XSAVE_LAYOUT	"LINUX"
> +#define NN_S390_HIGH_GPRS	"LINUX"
> +#define NN_S390_TIMER	"LINUX"
> +#define NN_S390_TODCMP	"LINUX"
> +#define NN_S390_TODPREG	"LINUX"
> +#define NN_S390_CTRS	"LINUX"
> +#define NN_S390_PREFIX	"LINUX"
> +#define NN_S390_LAST_BREAK	"LINUX"
> +#define NN_S390_SYSTEM_CALL	"LINUX"
> +#define NN_S390_TDB	"LINUX"
> +#define NN_S390_VXRS_LOW	"LINUX"
> +#define NN_S390_VXRS_HIGH	"LINUX"
> +#define NN_S390_GS_CB	"LINUX"
> +#define NN_S390_GS_BC	"LINUX"
> +#define NN_S390_RI_CB	"LINUX"
> +#define NN_S390_PV_CPU_DATA	"LINUX"
> +#define NN_ARM_VFP	"LINUX"
> +#define NN_ARM_TLS	"LINUX"
> +#define NN_ARM_HW_BREAK	"LINUX"
> +#define NN_ARM_HW_WATCH	"LINUX"
> +#define NN_ARM_SYSTEM_CALL	"LINUX"
> +#define NN_ARM_SVE	"LINUX"
> +#define NN_ARM_PAC_MASK	"LINUX"
> +#define NN_ARM_PACA_KEYS	"LINUX"
> +#define NN_ARM_PACG_KEYS	"LINUX"
> +#define NN_ARM_TAGGED_ADDR_CTRL	"LINUX"
> +#define NN_ARM_PAC_ENABLED_KEYS	"LINUX"
> +#define NN_ARM_SSVE	"LINUX"
> +#define NN_ARM_ZA	"LINUX"
> +#define NN_ARM_ZT	"LINUX"
> +#define NN_ARM_FPMR	"LINUX"
> +#define NN_ARM_POE	"LINUX"
> +#define NN_ARM_GCS	"LINUX"
> +#define NN_ARC_V2	"LINUX"
> +#define NN_VMCOREDD	"LINUX"
> +#define NN_MIPS_DSP	"LINUX"
> +#define NN_MIPS_FP_MODE	"LINUX"
> +#define NN_MIPS_MSA	"LINUX"
> +#define NN_RISCV_CSR	"LINUX"
> +#define NN_RISCV_VECTOR	"LINUX"
> +#define NN_RISCV_TAGGED_ADDR_CTRL	"LINUX"
> +#define NN_LOONGARCH_CPUCFG	"LINUX"
> +#define NN_LOONGARCH_CSR	"LINUX"
> +#define NN_LOONGARCH_LSX	"LINUX"
> +#define NN_LOONGARCH_LASX	"LINUX"
> +#define NN_LOONGARCH_LBT	"LINUX"
> +#define NN_LOONGARCH_HW_BREAK	"LINUX"
> +#define NN_LOONGARCH_HW_WATCH	"LINUX"
> +#define NN_GNU_PROPERTY_TYPE_0	"GNU"
> +
>  /* Note header in a PT_NOTE section */
>  typedef struct elf32_note {
>    Elf32_Word	n_namesz;	/* Name size */
> 
> -- 
> 2.47.1
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ