linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <kees@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Brown <broonie@kernel.org>, Baoquan He <bhe@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
	LEROY Christophe <christophe.leroy2@cs-soprasteria.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	kexec@lists.infradead.org, binutils@sourceware.org,
	devel@daynix.com
Subject: Re: [PATCH v4 1/6] elf: Define note name macros
Date: Tue, 14 Jan 2025 12:22:31 +0000	[thread overview]
Message-ID: <Z4ZXB2UJaZWOmshN@e133380.arm.com> (raw)
In-Reply-To: <20250111-elf-v4-1-b3841fa0dcd9@daynix.com>

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>



  reply	other threads:[~2025-01-14 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11  5:48 [PATCH v4 0/6] " Akihiko Odaki
2025-01-11  5:48 ` [PATCH v4 1/6] " Akihiko Odaki
2025-01-14 12:22   ` Dave Martin [this message]
2025-01-11  5:48 ` [PATCH v4 2/6] binfmt_elf: Use " Akihiko Odaki
2025-01-14 12:22   ` Dave Martin
2025-01-11  5:48 ` [PATCH v4 3/6] powerpc: " Akihiko Odaki
2025-01-14 12:23   ` Dave Martin
2025-01-11  5:48 ` [PATCH v4 4/6] crash: " Akihiko Odaki
2025-01-14 12:23   ` Dave Martin
2025-01-11  5:48 ` [PATCH v4 5/6] s390/crash: " 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
2025-01-14 12:23   ` Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z4ZXB2UJaZWOmshN@e133380.arm.com \
    --to=dave.martin@arm.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=bhe@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.leroy2@cs-soprasteria.com \
    --cc=devel@daynix.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=kees@kernel.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox