linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names
@ 2025-07-01 13:55 Dave Martin
  2025-07-01 13:55 ` [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset Dave Martin
                   ` (25 more replies)
  0 siblings, 26 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: David S. Miller, H. Peter Anvin, James E.J. Bottomley,
	Akihiko Odaki, Albert Ou, Alexander Gordeev, Alexandre Ghiti,
	Andreas Larsson, Anton Ivanov, Borislav Petkov, Brian Cain,
	Catalin Marinas, Chris Zankel, Christian Borntraeger,
	Christophe Leroy, Dave Hansen, Dinh Nguyen, Geert Uytterhoeven,
	Guo Ren, Heiko Carstens, Helge Deller, Huacai Chen, Ingo Molnar,
	Johannes Berg, John Paul Adrian Glaubitz, Jonas Bonn, Kees Cook,
	Madhavan Srinivasan, Max Filippov, Michael Ellerman,
	Nicholas Piggin, Oleg Nesterov, Palmer Dabbelt, Paul Walmsley,
	Rich Felker, Richard Weinberger, Russell King, Stafford Horne,
	Stefan Kristiansson, Sven Schnelle, Thomas Bogendoerfer,
	Thomas Gleixner, Vasily Gorbik, Vineet Gupta, WANG Xuerui,
	Will Deacon, Yoshinori Sato, linux-arch, linux-arm-kernel,
	linux-csky, linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
	linux-parisc, linux-riscv, linux-s390, linux-sh, linux-snps-arc,
	linux-um, linuxppc-dev, loongarch, sparclinux, x86

This series aims to clean up an aspect of coredump generation:

ELF coredumps contain a set of notes describing the state of machine
registers and other information about the dumped process.

Notes are identified by a numeric identifier n_type and a "name"
string, although this terminology is somewhat misleading.  Officially,
the "name" of a note is really an "originator" or namespace identifier
that indicates how to interpret n_type [1], although in practice it is
often used more loosely.

Either way, each kind of note needs _both_ a specific "name" string and
a specific n_type to identify it robustly.

To centralise this knowledge in one place and avoid the need for ad-hoc
code to guess the correct name for a given note, commit 7da8e4ad4df0
("elf: Define note name macros") [2] added an explicit NN_<foo> #define
in elf.h to give the name corresponding to each named note type
NT_<foo>.

Now that the note name for each note is specified explicitly, the
remaining guesswork for determining the note name for common and
arch-specific regsets in ELF core dumps can be eliminated.

This series aims to do just that:

 * Patch 2 adds a user_regset field to specify the note name, and a
   helper macro to populate it correctly alongside the note type.

 * Patch 3 ports away the ad-hoc note names in the common coredump
   code.

 * Patches 4-22 make the arch-specific changes.  (This is pretty
   mechanical for most arches.)

 * The final patch adds a WARN() when no note name is specified,
   and simplifies the fallback guess.  This should only be applied
   when all arches have ported across.

See the individual patches for details.


Testing:

 * x86, arm64: Booted in a VM and triggered a core dump with no WARN(),
   and verified that the dumped notes are the same.

 * arm: Build-tested only (for now).

 * Other arches: not tested yet

Any help with testing is appreciated.  If the following generates the
same notes (as dumped by readelf -n core) and doesn't trigger a WARN,
then we are probably good.

$ sleep 60 &
$ kill -QUIT $!

(Register content might differ between runs, but it should be safe to
ignore that -- this series only deals with the note names and types.)

Cheers
---Dave


[1] System V Application Binary Interface, Edition 4.1,
Section 5 (Program Loading and Dynamic Linking) -> "Note Section"

https://refspecs.linuxfoundation.org/elf/gabi41.pdf

[2] elf: Define note name macros

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/elf.h?id=7da8e4ad4df0dd12f37357af62ce1b63e75ae2e6


Dave Martin (23):
  regset: Fix kerneldoc for struct regset_get() in user_regset
  regset: Add explicit core note name in struct user_regset
  binfmt_elf: Dump non-arch notes with strictly matching name and type
  ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  ARM: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
    names
  binfmt_elf: Warn on missing or suspicious regset note names

 arch/arc/kernel/ptrace.c                 |  4 +-
 arch/arm/kernel/ptrace.c                 |  6 +-
 arch/arm64/kernel/ptrace.c               | 52 ++++++++---------
 arch/csky/kernel/ptrace.c                |  4 +-
 arch/hexagon/kernel/ptrace.c             |  2 +-
 arch/loongarch/kernel/ptrace.c           | 16 ++---
 arch/m68k/kernel/ptrace.c                |  4 +-
 arch/mips/kernel/ptrace.c                | 20 +++----
 arch/nios2/kernel/ptrace.c               |  2 +-
 arch/openrisc/kernel/ptrace.c            |  4 +-
 arch/parisc/kernel/ptrace.c              |  8 +--
 arch/powerpc/kernel/ptrace/ptrace-view.c | 74 ++++++++++++------------
 arch/riscv/kernel/ptrace.c               | 12 ++--
 arch/s390/kernel/ptrace.c                | 42 +++++++-------
 arch/sh/kernel/ptrace_32.c               |  4 +-
 arch/sparc/kernel/ptrace_32.c            |  4 +-
 arch/sparc/kernel/ptrace_64.c            |  8 +--
 arch/x86/kernel/ptrace.c                 | 22 +++----
 arch/x86/um/ptrace.c                     | 10 ++--
 arch/xtensa/kernel/ptrace.c              |  4 +-
 fs/binfmt_elf.c                          | 36 +++++++-----
 fs/binfmt_elf_fdpic.c                    | 17 +++---
 include/linux/regset.h                   | 12 +++-
 23 files changed, 194 insertions(+), 173 deletions(-)


base-commit: 86731a2a651e58953fc949573895f2fa6d456841
-- 
2.34.1


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

* [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-01 13:55 ` [PATCH 02/23] regset: Add explicit core note name in struct user_regset Dave Martin
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Oleg Nesterov, Kees Cook, Akihiko Odaki

Commit 7717cb9bdd04 ("regset: new method and helpers for it") added a
new interface ->regset_get() for struct user_regset, and commit
1e6986c9db21 ("regset: kill ->get()") got rid of the old interface.

The kerneldoc comment block was never updated to take account of this
change, though.

Update it.

No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>

---

No Fixes tag, since kerneldoc is rather best-effort and the kernel
works either way.  Kernels with users of the old ->get() method
wouldn't build any more, anyway.

I can add a tag if someone wants it.

I've made no effort to track down all kerneldoc discrepancies
introduced by the same changeset, but I need to update this particular
block for another patch.
---
 include/linux/regset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/regset.h b/include/linux/regset.h
index 9061266dd8de..02417e934845 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -151,7 +151,7 @@ typedef int user_regset_writeback_fn(struct task_struct *target,
  * @align:		Required alignment, in bytes.
  * @bias:		Bias from natural indexing.
  * @core_note_type:	ELF note @n_type value used in core dumps.
- * @get:		Function to fetch values.
+ * @regset_get:		Function to fetch values.
  * @set:		Function to store values.
  * @active:		Function to report if regset is active, or %NULL.
  * @writeback:		Function to write data back to user memory, or %NULL.
-- 
2.34.1


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

* [PATCH 02/23] regset: Add explicit core note name in struct user_regset
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
  2025-07-01 13:55 ` [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-09 11:57   ` Alexander Gordeev
  2025-07-01 13:55 ` [PATCH 03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type Dave Martin
                   ` (23 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Oleg Nesterov, Kees Cook, Akihiko Odaki

There is currently hard-coded logic spread around the tree for
determining the note name for regset notes emitted in coredumps.

Now that the names are declared explicitly in <uapi/elf.h>, this can be
simplified.

In preparation for getting rid of the special-case logic, add an
explicit core_note_name field in struct user_regset for specifying the
note name explicitly.  To help avoid mistakes, a convenience macro
USER_REGSET_NOTE_TYPE() is provided to set .core_note_type and
.core_note_name based on the note type.

When dumping core, use the new field to set the note name, if the
regset specifies it.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 fs/binfmt_elf.c        |  8 ++++++--
 include/linux/regset.h | 10 ++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index a43363d593e5..f1069103ca24 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1727,6 +1727,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 	for (view_iter = 1; view_iter < view->n; ++view_iter) {
 		const struct user_regset *regset = &view->regsets[view_iter];
 		int note_type = regset->core_note_type;
+		const char *note_name = regset->core_note_name;
 		bool is_fpreg = note_type == NT_PRFPREG;
 		void *data;
 		int ret;
@@ -1747,8 +1748,11 @@ 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 ? NN_PRFPREG : "LINUX",
-			  note_type, ret, data);
+		if (!note_name)
+			note_name = is_fpreg ? NN_PRFPREG : "LINUX";
+
+		fill_note(&t->notes[note_iter], note_name, note_type,
+			  ret, data);
 
 		info->size += notesize(&t->notes[note_iter]);
 		note_iter++;
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 02417e934845..ad1ca6fe04f4 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -151,6 +151,7 @@ typedef int user_regset_writeback_fn(struct task_struct *target,
  * @align:		Required alignment, in bytes.
  * @bias:		Bias from natural indexing.
  * @core_note_type:	ELF note @n_type value used in core dumps.
+ * @core_note_name:	ELF note name to qualify the note type.
  * @regset_get:		Function to fetch values.
  * @set:		Function to store values.
  * @active:		Function to report if regset is active, or %NULL.
@@ -190,6 +191,10 @@ typedef int user_regset_writeback_fn(struct task_struct *target,
  *
  * If nonzero, @core_note_type gives the n_type field (NT_* value)
  * of the core file note in which this regset's data appears.
+ * @core_note_name specifies the note name.  The preferred way to
+ * specify these two fields is to use the @USER_REGSET_NOTE_TYPE()
+ * macro.
+ *
  * NT_PRSTATUS is a special case in that the regset data starts at
  * offsetof(struct elf_prstatus, pr_reg) into the note data; that is
  * part of the per-machine ELF formats userland knows about.  In
@@ -207,8 +212,13 @@ struct user_regset {
 	unsigned int 			align;
 	unsigned int 			bias;
 	unsigned int 			core_note_type;
+	const char			*core_note_name;
 };
 
+#define USER_REGSET_NOTE_TYPE(type) \
+	.core_note_type			= (NT_ ## type), \
+	.core_note_name			= (NN_ ## type)
+
 /**
  * struct user_regset_view - available regsets
  * @name:	Identifier, e.g. UTS_MACHINE string.
-- 
2.34.1


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

* [PATCH 03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
  2025-07-01 13:55 ` [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset Dave Martin
  2025-07-01 13:55 ` [PATCH 02/23] regset: Add explicit core note name in struct user_regset Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-01 13:55 ` [PATCH 04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Dave Martin
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Oleg Nesterov, Kees Cook, Akihiko Odaki

The note names for some arch-independent coredump notes are specified
manually, albeit by referring to the NN_<foo> #define corresponding
to the NT_<foo> #define that specifies the note type.

Now that there are no exceptional cases, refactor fill_note() to pick
the correct NN_ and NT_ macros implcitly for the requested note type.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 fs/binfmt_elf.c       | 27 ++++++++++++++-------------
 fs/binfmt_elf_fdpic.c | 17 +++++++++--------
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f1069103ca24..89063d1d9e9a 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1450,8 +1450,8 @@ static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset)
 	phdr->p_align = 4;
 }
 
-static void fill_note(struct memelfnote *note, const char *name, int type,
-		unsigned int sz, void *data)
+static void __fill_note(struct memelfnote *note, const char *name, int type,
+			unsigned int sz, void *data)
 {
 	note->name = name;
 	note->type = type;
@@ -1459,6 +1459,9 @@ static void fill_note(struct memelfnote *note, const char *name, int type,
 	note->data = data;
 }
 
+#define fill_note(note, type, sz, data) \
+	__fill_note(note, NN_ ## type, NT_ ## type, sz, data)
+
 /*
  * fill up all the fields in prstatus from the given task struct, except
  * registers which need to be filled up separately.
@@ -1549,14 +1552,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, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
+	fill_note(note, 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, NN_SIGINFO, NT_SIGINFO, sizeof(*csigdata), csigdata);
+	fill_note(note, SIGINFO, sizeof(*csigdata), csigdata);
 }
 
 /*
@@ -1652,7 +1655,7 @@ static int fill_files_note(struct memelfnote *note, struct coredump_params *cprm
 	}
 
 	size = name_curpos - (char *)data;
-	fill_note(note, NN_FILE, NT_FILE, size, data);
+	fill_note(note, FILE, size, data);
 	return 0;
 }
 
@@ -1713,8 +1716,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], NN_PRSTATUS, NT_PRSTATUS,
-		  PRSTATUS_SIZE, &t->prstatus);
+	fill_note(&t->notes[0], PRSTATUS, PRSTATUS_SIZE, &t->prstatus);
 	info->size += notesize(&t->notes[0]);
 
 	do_thread_regset_writeback(t->task, &view->regsets[0]);
@@ -1751,8 +1753,8 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 		if (!note_name)
 			note_name = is_fpreg ? NN_PRFPREG : "LINUX";
 
-		fill_note(&t->notes[note_iter], note_name, note_type,
-			  ret, data);
+		__fill_note(&t->notes[note_iter], note_name, note_type,
+			    ret, data);
 
 		info->size += notesize(&t->notes[note_iter]);
 		note_iter++;
@@ -1771,8 +1773,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], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
-		  &(t->prstatus));
+	fill_note(&t->notes[0], PRSTATUS, sizeof(t->prstatus), &t->prstatus);
 	info->size += notesize(&t->notes[0]);
 
 	fpu = kzalloc(sizeof(elf_fpregset_t), GFP_KERNEL);
@@ -1782,7 +1783,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 	}
 
 	t->prstatus.pr_fpvalid = 1;
-	fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(*fpu), fpu);
+	fill_note(&t->notes[1], PRFPREG, sizeof(*fpu), fpu);
 	info->size += notesize(&t->notes[1]);
 
 	return 1;
@@ -1802,7 +1803,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, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
+	fill_note(&info->psinfo, 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 9133f3827f90..68b884df2011 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1275,8 +1275,8 @@ static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offs
 	return;
 }
 
-static inline void fill_note(struct memelfnote *note, const char *name, int type,
-		unsigned int sz, void *data)
+static inline void __fill_note(struct memelfnote *note, const char *name, int type,
+			       unsigned int sz, void *data)
 {
 	note->name = name;
 	note->type = type;
@@ -1285,6 +1285,9 @@ static inline void fill_note(struct memelfnote *note, const char *name, int type
 	return;
 }
 
+#define fill_note(note, type, sz, data) \
+	__fill_note(note, NN_ ## type, NT_ ## type, sz, data)
+
 /*
  * fill up all the fields in prstatus from the given task struct, except
  * registers which need to be filled up separately.
@@ -1398,8 +1401,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], NN_PRSTATUS, NT_PRSTATUS, sizeof(t->prstatus),
-		  &t->prstatus);
+	fill_note(&t->notes[0], PRSTATUS, sizeof(t->prstatus), &t->prstatus);
 	t->num_notes++;
 	*sz += notesize(&t->notes[0]);
 
@@ -1416,8 +1418,7 @@ static struct elf_thread_status *elf_dump_thread_status(long signr, struct task_
 	}
 
 	if (t->prstatus.pr_fpvalid) {
-		fill_note(&t->notes[1], NN_PRFPREG, NT_PRFPREG, sizeof(t->fpu),
-			  &t->fpu);
+		fill_note(&t->notes[1], PRFPREG, sizeof(t->fpu), &t->fpu);
 		t->num_notes++;
 		*sz += notesize(&t->notes[1]);
 	}
@@ -1531,7 +1532,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
 	 */
 
 	fill_psinfo(psinfo, current->group_leader, current->mm);
-	fill_note(&psinfo_note, NN_PRPSINFO, NT_PRPSINFO, sizeof(*psinfo), psinfo);
+	fill_note(&psinfo_note, PRPSINFO, sizeof(*psinfo), psinfo);
 	thread_status_size += notesize(&psinfo_note);
 
 	auxv = (elf_addr_t *) current->mm->saved_auxv;
@@ -1539,7 +1540,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
 	do
 		i += 2;
 	while (auxv[i - 2] != AT_NULL);
-	fill_note(&auxv_note, NN_AUXV, NT_AUXV, i * sizeof(elf_addr_t), auxv);
+	fill_note(&auxv_note, AUXV, i * sizeof(elf_addr_t), auxv);
 	thread_status_size += notesize(&auxv_note);
 
 	offset = sizeof(*elf);				/* ELF header */
-- 
2.34.1


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

* [PATCH 04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (2 preceding siblings ...)
  2025-07-01 13:55 ` [PATCH 03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-01 13:55 ` [PATCH 05/23] ARM: " Dave Martin
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Vineet Gupta, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linux-snps-arc

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-snps-arc@lists.infradead.org
---
 arch/arc/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index e0c233c178b1..cad5367b7c37 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -284,7 +284,7 @@ enum arc_getset {
 
 static const struct user_regset arc_regsets[] = {
 	[REGSET_CMN] = {
-	       .core_note_type = NT_PRSTATUS,
+	       USER_REGSET_NOTE_TYPE(PRSTATUS),
 	       .n = ELF_NGREG,
 	       .size = sizeof(unsigned long),
 	       .align = sizeof(unsigned long),
@@ -293,7 +293,7 @@ static const struct user_regset arc_regsets[] = {
 	},
 #ifdef CONFIG_ISA_ARCV2
 	[REGSET_ARCV2] = {
-	       .core_note_type = NT_ARC_V2,
+	       USER_REGSET_NOTE_TYPE(ARC_V2),
 	       .n = ELF_ARCV2REG,
 	       .size = sizeof(unsigned long),
 	       .align = sizeof(unsigned long),
-- 
2.34.1


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

* [PATCH 05/23] ARM: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (3 preceding siblings ...)
  2025-07-01 13:55 ` [PATCH 04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-01 13:55 ` [PATCH 06/23] arm64: " Dave Martin
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Russell King, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linux-arm-kernel

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/kernel/ptrace.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index c421a899fc84..7951b2c06fec 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -677,7 +677,7 @@ enum arm_regset {
 
 static const struct user_regset arm_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = ELF_NGREG,
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -689,7 +689,7 @@ static const struct user_regset arm_regsets[] = {
 		 * For the FPA regs in fpstate, the real fields are a mixture
 		 * of sizes, so pretend that the registers are word-sized:
 		 */
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(struct user_fp) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -702,7 +702,7 @@ static const struct user_regset arm_regsets[] = {
 		 * Pretend that the VFP regs are word-sized, since the FPSCR is
 		 * a single word dangling at the end of struct user_vfp:
 		 */
-		.core_note_type = NT_ARM_VFP,
+		USER_REGSET_NOTE_TYPE(ARM_VFP),
 		.n = ARM_VFPREGS_SIZE / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
-- 
2.34.1


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

* [PATCH 06/23] arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (4 preceding siblings ...)
  2025-07-01 13:55 ` [PATCH 05/23] ARM: " Dave Martin
@ 2025-07-01 13:55 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 07/23] csky: " Dave Martin
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Catalin Marinas, Will Deacon, Oleg Nesterov, Kees Cook,
	Akihiko Odaki, linux-arm-kernel

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

This does not affect the correctness of switch(note_type) and similar
code, since note type values known to Linux for coredump purposes were
already required to be unique.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm64/kernel/ptrace.c | 52 +++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index ee94b72bf8fb..4b001121c72d 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -1586,7 +1586,7 @@ enum aarch64_regset {
 
 static const struct user_regset aarch64_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = sizeof(struct user_pt_regs) / sizeof(u64),
 		.size = sizeof(u64),
 		.align = sizeof(u64),
@@ -1594,7 +1594,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = gpr_set
 	},
 	[REGSET_FPR] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(struct user_fpsimd_state) / sizeof(u32),
 		/*
 		 * We pretend we have 32-bit registers because the fpsr and
@@ -1607,7 +1607,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = fpr_set
 	},
 	[REGSET_TLS] = {
-		.core_note_type = NT_ARM_TLS,
+		USER_REGSET_NOTE_TYPE(ARM_TLS),
 		.n = 2,
 		.size = sizeof(void *),
 		.align = sizeof(void *),
@@ -1616,7 +1616,7 @@ static const struct user_regset aarch64_regsets[] = {
 	},
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 	[REGSET_HW_BREAK] = {
-		.core_note_type = NT_ARM_HW_BREAK,
+		USER_REGSET_NOTE_TYPE(ARM_HW_BREAK),
 		.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -1624,7 +1624,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = hw_break_set,
 	},
 	[REGSET_HW_WATCH] = {
-		.core_note_type = NT_ARM_HW_WATCH,
+		USER_REGSET_NOTE_TYPE(ARM_HW_WATCH),
 		.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -1633,7 +1633,7 @@ static const struct user_regset aarch64_regsets[] = {
 	},
 #endif
 	[REGSET_SYSTEM_CALL] = {
-		.core_note_type = NT_ARM_SYSTEM_CALL,
+		USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL),
 		.n = 1,
 		.size = sizeof(int),
 		.align = sizeof(int),
@@ -1641,7 +1641,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = system_call_set,
 	},
 	[REGSET_FPMR] = {
-		.core_note_type = NT_ARM_FPMR,
+		USER_REGSET_NOTE_TYPE(ARM_FPMR),
 		.n = 1,
 		.size = sizeof(u64),
 		.align = sizeof(u64),
@@ -1650,7 +1650,7 @@ static const struct user_regset aarch64_regsets[] = {
 	},
 #ifdef CONFIG_ARM64_SVE
 	[REGSET_SVE] = { /* Scalable Vector Extension */
-		.core_note_type = NT_ARM_SVE,
+		USER_REGSET_NOTE_TYPE(ARM_SVE),
 		.n = DIV_ROUND_UP(SVE_PT_SIZE(ARCH_SVE_VQ_MAX,
 					      SVE_PT_REGS_SVE),
 				  SVE_VQ_BYTES),
@@ -1662,7 +1662,7 @@ static const struct user_regset aarch64_regsets[] = {
 #endif
 #ifdef CONFIG_ARM64_SME
 	[REGSET_SSVE] = { /* Streaming mode SVE */
-		.core_note_type = NT_ARM_SSVE,
+		USER_REGSET_NOTE_TYPE(ARM_SSVE),
 		.n = DIV_ROUND_UP(SVE_PT_SIZE(SME_VQ_MAX, SVE_PT_REGS_SVE),
 				  SVE_VQ_BYTES),
 		.size = SVE_VQ_BYTES,
@@ -1671,7 +1671,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = ssve_set,
 	},
 	[REGSET_ZA] = { /* SME ZA */
-		.core_note_type = NT_ARM_ZA,
+		USER_REGSET_NOTE_TYPE(ARM_ZA),
 		/*
 		 * ZA is a single register but it's variably sized and
 		 * the ptrace core requires that the size of any data
@@ -1687,7 +1687,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = za_set,
 	},
 	[REGSET_ZT] = { /* SME ZT */
-		.core_note_type = NT_ARM_ZT,
+		USER_REGSET_NOTE_TYPE(ARM_ZT),
 		.n = 1,
 		.size = ZT_SIG_REG_BYTES,
 		.align = sizeof(u64),
@@ -1697,7 +1697,7 @@ static const struct user_regset aarch64_regsets[] = {
 #endif
 #ifdef CONFIG_ARM64_PTR_AUTH
 	[REGSET_PAC_MASK] = {
-		.core_note_type = NT_ARM_PAC_MASK,
+		USER_REGSET_NOTE_TYPE(ARM_PAC_MASK),
 		.n = sizeof(struct user_pac_mask) / sizeof(u64),
 		.size = sizeof(u64),
 		.align = sizeof(u64),
@@ -1705,7 +1705,7 @@ static const struct user_regset aarch64_regsets[] = {
 		/* this cannot be set dynamically */
 	},
 	[REGSET_PAC_ENABLED_KEYS] = {
-		.core_note_type = NT_ARM_PAC_ENABLED_KEYS,
+		USER_REGSET_NOTE_TYPE(ARM_PAC_ENABLED_KEYS),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1714,7 +1714,7 @@ static const struct user_regset aarch64_regsets[] = {
 	},
 #ifdef CONFIG_CHECKPOINT_RESTORE
 	[REGSET_PACA_KEYS] = {
-		.core_note_type = NT_ARM_PACA_KEYS,
+		USER_REGSET_NOTE_TYPE(ARM_PACA_KEYS),
 		.n = sizeof(struct user_pac_address_keys) / sizeof(__uint128_t),
 		.size = sizeof(__uint128_t),
 		.align = sizeof(__uint128_t),
@@ -1722,7 +1722,7 @@ static const struct user_regset aarch64_regsets[] = {
 		.set = pac_address_keys_set,
 	},
 	[REGSET_PACG_KEYS] = {
-		.core_note_type = NT_ARM_PACG_KEYS,
+		USER_REGSET_NOTE_TYPE(ARM_PACG_KEYS),
 		.n = sizeof(struct user_pac_generic_keys) / sizeof(__uint128_t),
 		.size = sizeof(__uint128_t),
 		.align = sizeof(__uint128_t),
@@ -1733,7 +1733,7 @@ static const struct user_regset aarch64_regsets[] = {
 #endif
 #ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
 	[REGSET_TAGGED_ADDR_CTRL] = {
-		.core_note_type = NT_ARM_TAGGED_ADDR_CTRL,
+		USER_REGSET_NOTE_TYPE(ARM_TAGGED_ADDR_CTRL),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1743,7 +1743,7 @@ static const struct user_regset aarch64_regsets[] = {
 #endif
 #ifdef CONFIG_ARM64_POE
 	[REGSET_POE] = {
-		.core_note_type = NT_ARM_POE,
+		USER_REGSET_NOTE_TYPE(ARM_POE),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1753,7 +1753,7 @@ static const struct user_regset aarch64_regsets[] = {
 #endif
 #ifdef CONFIG_ARM64_GCS
 	[REGSET_GCS] = {
-		.core_note_type = NT_ARM_GCS,
+		USER_REGSET_NOTE_TYPE(ARM_GCS),
 		.n = sizeof(struct user_gcs) / sizeof(u64),
 		.size = sizeof(u64),
 		.align = sizeof(u64),
@@ -1943,7 +1943,7 @@ static int compat_tls_set(struct task_struct *target,
 
 static const struct user_regset aarch32_regsets[] = {
 	[REGSET_COMPAT_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = COMPAT_ELF_NGREG,
 		.size = sizeof(compat_elf_greg_t),
 		.align = sizeof(compat_elf_greg_t),
@@ -1951,7 +1951,7 @@ static const struct user_regset aarch32_regsets[] = {
 		.set = compat_gpr_set
 	},
 	[REGSET_COMPAT_VFP] = {
-		.core_note_type = NT_ARM_VFP,
+		USER_REGSET_NOTE_TYPE(ARM_VFP),
 		.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
 		.size = sizeof(compat_ulong_t),
 		.align = sizeof(compat_ulong_t),
@@ -1968,7 +1968,7 @@ static const struct user_regset_view user_aarch32_view = {
 
 static const struct user_regset aarch32_ptrace_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = COMPAT_ELF_NGREG,
 		.size = sizeof(compat_elf_greg_t),
 		.align = sizeof(compat_elf_greg_t),
@@ -1976,7 +1976,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
 		.set = compat_gpr_set
 	},
 	[REGSET_FPR] = {
-		.core_note_type = NT_ARM_VFP,
+		USER_REGSET_NOTE_TYPE(ARM_VFP),
 		.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
 		.size = sizeof(compat_ulong_t),
 		.align = sizeof(compat_ulong_t),
@@ -1984,7 +1984,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
 		.set = compat_vfp_set
 	},
 	[REGSET_TLS] = {
-		.core_note_type = NT_ARM_TLS,
+		USER_REGSET_NOTE_TYPE(ARM_TLS),
 		.n = 1,
 		.size = sizeof(compat_ulong_t),
 		.align = sizeof(compat_ulong_t),
@@ -1993,7 +1993,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
 	},
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 	[REGSET_HW_BREAK] = {
-		.core_note_type = NT_ARM_HW_BREAK,
+		USER_REGSET_NOTE_TYPE(ARM_HW_BREAK),
 		.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -2001,7 +2001,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
 		.set = hw_break_set,
 	},
 	[REGSET_HW_WATCH] = {
-		.core_note_type = NT_ARM_HW_WATCH,
+		USER_REGSET_NOTE_TYPE(ARM_HW_WATCH),
 		.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -2010,7 +2010,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
 	},
 #endif
 	[REGSET_SYSTEM_CALL] = {
-		.core_note_type = NT_ARM_SYSTEM_CALL,
+		USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL),
 		.n = 1,
 		.size = sizeof(int),
 		.align = sizeof(int),
-- 
2.34.1


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

* [PATCH 07/23] csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (5 preceding siblings ...)
  2025-07-01 13:55 ` [PATCH 06/23] arm64: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 08/23] hexagon: " Dave Martin
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Guo Ren, Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-csky

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-csky@vger.kernel.org
---
 arch/csky/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c
index 0f7e7b653c72..6bb685a2646b 100644
--- a/arch/csky/kernel/ptrace.c
+++ b/arch/csky/kernel/ptrace.c
@@ -166,7 +166,7 @@ static int fpr_set(struct task_struct *target,
 
 static const struct user_regset csky_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = sizeof(struct pt_regs) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -174,7 +174,7 @@ static const struct user_regset csky_regsets[] = {
 		.set = gpr_set,
 	},
 	[REGSET_FPR] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(struct user_fp) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
-- 
2.34.1


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

* [PATCH 08/23] hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (6 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 07/23] csky: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 09/23] LoongArch: " Dave Martin
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Brian Cain, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linux-hexagon

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Brian Cain <bcain@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-hexagon@vger.kernel.org
---
 arch/hexagon/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
index 905b06790ab7..2093eee143e1 100644
--- a/arch/hexagon/kernel/ptrace.c
+++ b/arch/hexagon/kernel/ptrace.c
@@ -137,7 +137,7 @@ enum hexagon_regset {
 
 static const struct user_regset hexagon_regsets[] = {
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = ELF_NGREG,
 		.size = sizeof(unsigned long),
 		.align = sizeof(unsigned long),
-- 
2.34.1


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

* [PATCH 09/23] LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (7 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 08/23] hexagon: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 10/23] m68k: " Dave Martin
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Huacai Chen, WANG Xuerui, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	loongarch

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: loongarch@lists.linux.dev
---
 arch/loongarch/kernel/ptrace.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/loongarch/kernel/ptrace.c b/arch/loongarch/kernel/ptrace.c
index 5e2402cfcab0..8edd0954e55a 100644
--- a/arch/loongarch/kernel/ptrace.c
+++ b/arch/loongarch/kernel/ptrace.c
@@ -864,7 +864,7 @@ enum loongarch_regset {
 
 static const struct user_regset loongarch64_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= ELF_NGREG,
 		.size		= sizeof(elf_greg_t),
 		.align		= sizeof(elf_greg_t),
@@ -872,7 +872,7 @@ static const struct user_regset loongarch64_regsets[] = {
 		.set		= gpr_set,
 	},
 	[REGSET_FPR] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= ELF_NFPREG,
 		.size		= sizeof(elf_fpreg_t),
 		.align		= sizeof(elf_fpreg_t),
@@ -880,7 +880,7 @@ static const struct user_regset loongarch64_regsets[] = {
 		.set		= fpr_set,
 	},
 	[REGSET_CPUCFG] = {
-		.core_note_type	= NT_LOONGARCH_CPUCFG,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_CPUCFG),
 		.n		= 64,
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
@@ -889,7 +889,7 @@ static const struct user_regset loongarch64_regsets[] = {
 	},
 #ifdef CONFIG_CPU_HAS_LSX
 	[REGSET_LSX] = {
-		.core_note_type	= NT_LOONGARCH_LSX,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_LSX),
 		.n		= NUM_FPU_REGS,
 		.size		= 16,
 		.align		= 16,
@@ -899,7 +899,7 @@ static const struct user_regset loongarch64_regsets[] = {
 #endif
 #ifdef CONFIG_CPU_HAS_LASX
 	[REGSET_LASX] = {
-		.core_note_type	= NT_LOONGARCH_LASX,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_LASX),
 		.n		= NUM_FPU_REGS,
 		.size		= 32,
 		.align		= 32,
@@ -909,7 +909,7 @@ static const struct user_regset loongarch64_regsets[] = {
 #endif
 #ifdef CONFIG_CPU_HAS_LBT
 	[REGSET_LBT] = {
-		.core_note_type	= NT_LOONGARCH_LBT,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_LBT),
 		.n		= 5,
 		.size		= sizeof(u64),
 		.align		= sizeof(u64),
@@ -919,7 +919,7 @@ static const struct user_regset loongarch64_regsets[] = {
 #endif
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
 	[REGSET_HW_BREAK] = {
-		.core_note_type = NT_LOONGARCH_HW_BREAK,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_HW_BREAK),
 		.n = sizeof(struct user_watch_state_v2) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -927,7 +927,7 @@ static const struct user_regset loongarch64_regsets[] = {
 		.set = hw_break_set,
 	},
 	[REGSET_HW_WATCH] = {
-		.core_note_type = NT_LOONGARCH_HW_WATCH,
+		USER_REGSET_NOTE_TYPE(LOONGARCH_HW_WATCH),
 		.n = sizeof(struct user_watch_state_v2) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
-- 
2.34.1


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

* [PATCH 10/23] m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (8 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 09/23] LoongArch: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-06  9:25   ` Geert Uytterhoeven
  2025-07-01 13:56 ` [PATCH 11/23] MIPS: " Dave Martin
                   ` (15 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Geert Uytterhoeven, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linux-m68k

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-m68k@lists.linux-m68k.org
---
 arch/m68k/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index c20d590e4297..cfa2df24eced 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -319,7 +319,7 @@ enum m68k_regset {
 
 static const struct user_regset m68k_user_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = ELF_NGREG,
 		.size = sizeof(u32),
 		.align = sizeof(u16),
@@ -327,7 +327,7 @@ static const struct user_regset m68k_user_regsets[] = {
 	},
 #ifdef CONFIG_FPU
 	[REGSET_FPU] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(struct user_m68kfp_struct) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
-- 
2.34.1


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

* [PATCH 11/23] MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (9 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 10/23] m68k: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 12/23] nios2: " Dave Martin
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Bogendoerfer, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linux-mips

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-mips@vger.kernel.org
---
 arch/mips/kernel/ptrace.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index b890d64d352c..3f4c94c88124 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -935,7 +935,7 @@ int regs_query_register_offset(const char *name)
 
 static const struct user_regset mips_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= ELF_NGREG,
 		.size		= sizeof(unsigned int),
 		.align		= sizeof(unsigned int),
@@ -943,7 +943,7 @@ static const struct user_regset mips_regsets[] = {
 		.set		= gpr32_set,
 	},
 	[REGSET_DSP] = {
-		.core_note_type	= NT_MIPS_DSP,
+		USER_REGSET_NOTE_TYPE(MIPS_DSP),
 		.n		= NUM_DSP_REGS + 1,
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
@@ -953,7 +953,7 @@ static const struct user_regset mips_regsets[] = {
 	},
 #ifdef CONFIG_MIPS_FP_SUPPORT
 	[REGSET_FPR] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= ELF_NFPREG,
 		.size		= sizeof(elf_fpreg_t),
 		.align		= sizeof(elf_fpreg_t),
@@ -961,7 +961,7 @@ static const struct user_regset mips_regsets[] = {
 		.set		= fpr_set,
 	},
 	[REGSET_FP_MODE] = {
-		.core_note_type	= NT_MIPS_FP_MODE,
+		USER_REGSET_NOTE_TYPE(MIPS_FP_MODE),
 		.n		= 1,
 		.size		= sizeof(int),
 		.align		= sizeof(int),
@@ -971,7 +971,7 @@ static const struct user_regset mips_regsets[] = {
 #endif
 #ifdef CONFIG_CPU_HAS_MSA
 	[REGSET_MSA] = {
-		.core_note_type	= NT_MIPS_MSA,
+		USER_REGSET_NOTE_TYPE(MIPS_MSA),
 		.n		= NUM_FPU_REGS + 1,
 		.size		= 16,
 		.align		= 16,
@@ -995,7 +995,7 @@ static const struct user_regset_view user_mips_view = {
 
 static const struct user_regset mips64_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= ELF_NGREG,
 		.size		= sizeof(unsigned long),
 		.align		= sizeof(unsigned long),
@@ -1003,7 +1003,7 @@ static const struct user_regset mips64_regsets[] = {
 		.set		= gpr64_set,
 	},
 	[REGSET_DSP] = {
-		.core_note_type	= NT_MIPS_DSP,
+		USER_REGSET_NOTE_TYPE(MIPS_DSP),
 		.n		= NUM_DSP_REGS + 1,
 		.size		= sizeof(u64),
 		.align		= sizeof(u64),
@@ -1013,7 +1013,7 @@ static const struct user_regset mips64_regsets[] = {
 	},
 #ifdef CONFIG_MIPS_FP_SUPPORT
 	[REGSET_FP_MODE] = {
-		.core_note_type	= NT_MIPS_FP_MODE,
+		USER_REGSET_NOTE_TYPE(MIPS_FP_MODE),
 		.n		= 1,
 		.size		= sizeof(int),
 		.align		= sizeof(int),
@@ -1021,7 +1021,7 @@ static const struct user_regset mips64_regsets[] = {
 		.set		= fp_mode_set,
 	},
 	[REGSET_FPR] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= ELF_NFPREG,
 		.size		= sizeof(elf_fpreg_t),
 		.align		= sizeof(elf_fpreg_t),
@@ -1031,7 +1031,7 @@ static const struct user_regset mips64_regsets[] = {
 #endif
 #ifdef CONFIG_CPU_HAS_MSA
 	[REGSET_MSA] = {
-		.core_note_type	= NT_MIPS_MSA,
+		USER_REGSET_NOTE_TYPE(MIPS_MSA),
 		.n		= NUM_FPU_REGS + 1,
 		.size		= 16,
 		.align		= 16,
-- 
2.34.1


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

* [PATCH 12/23] nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (10 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 11/23] MIPS: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 13/23] openrisc: " Dave Martin
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Dinh Nguyen, Oleg Nesterov, Kees Cook, Akihiko Odaki

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 arch/nios2/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/nios2/kernel/ptrace.c b/arch/nios2/kernel/ptrace.c
index 9221c15972e6..c88f5cabc0c1 100644
--- a/arch/nios2/kernel/ptrace.c
+++ b/arch/nios2/kernel/ptrace.c
@@ -95,7 +95,7 @@ enum nios2_regset {
 
 static const struct user_regset nios2_regsets[] = {
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = NUM_PTRACE_REG,
 		.size = sizeof(unsigned long),
 		.align = sizeof(unsigned long),
-- 
2.34.1


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

* [PATCH 13/23] openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (11 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 12/23] nios2: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 14/23] parisc: " Dave Martin
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jonas Bonn, Stefan Kristiansson, Stafford Horne, Oleg Nesterov,
	Kees Cook, Akihiko Odaki, linux-openrisc

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-openrisc@vger.kernel.org
---
 arch/openrisc/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 8430570d0620..552489b24855 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -124,7 +124,7 @@ enum or1k_regset {
 
 static const struct user_regset or1k_regsets[] = {
 	[REGSET_GENERAL] = {
-			    .core_note_type = NT_PRSTATUS,
+			    USER_REGSET_NOTE_TYPE(PRSTATUS),
 			    .n = ELF_NGREG,
 			    .size = sizeof(long),
 			    .align = sizeof(long),
@@ -133,7 +133,7 @@ static const struct user_regset or1k_regsets[] = {
 			    },
 #ifdef CONFIG_FPU
 	[REGSET_FPU] = {
-			    .core_note_type = NT_PRFPREG,
+			    USER_REGSET_NOTE_TYPE(PRFPREG),
 			    .n = sizeof(struct __or1k_fpu_state) / sizeof(long),
 			    .size = sizeof(long),
 			    .align = sizeof(long),
-- 
2.34.1


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

* [PATCH 14/23] parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (12 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 13/23] openrisc: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 15/23] powerpc/ptrace: " Dave Martin
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: James E.J. Bottomley, Helge Deller, Oleg Nesterov, Kees Cook,
	Akihiko Odaki, linux-parisc

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-parisc@vger.kernel.org
---
 arch/parisc/kernel/ptrace.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index ceb45f51d52e..8a17ab7e6e0b 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -562,12 +562,12 @@ static int gpr_set(struct task_struct *target,
 
 static const struct user_regset native_regsets[] = {
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
 		.size = sizeof(long), .align = sizeof(long),
 		.regset_get = gpr_get, .set = gpr_set
 	},
 	[REGSET_FP] = {
-		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
 		.size = sizeof(__u64), .align = sizeof(__u64),
 		.regset_get = fpr_get, .set = fpr_set
 	}
@@ -629,12 +629,12 @@ static int gpr32_set(struct task_struct *target,
  */
 static const struct user_regset compat_regsets[] = {
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
 		.size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
 		.regset_get = gpr32_get, .set = gpr32_set
 	},
 	[REGSET_FP] = {
-		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
 		.size = sizeof(__u64), .align = sizeof(__u64),
 		.regset_get = fpr_get, .set = fpr_set
 	}
-- 
2.34.1


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

* [PATCH 15/23] powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (13 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 14/23] parisc: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 16/23] riscv: ptrace: " Dave Martin
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Oleg Nesterov, Kees Cook, Akihiko Odaki,
	linuxppc-dev

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kernel/ptrace/ptrace-view.c | 74 ++++++++++++------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c
index c1819e0a6684..0310f9097e39 100644
--- a/arch/powerpc/kernel/ptrace/ptrace-view.c
+++ b/arch/powerpc/kernel/ptrace/ptrace-view.c
@@ -568,114 +568,114 @@ static int pkey_set(struct task_struct *target, const struct user_regset *regset
 
 static const struct user_regset native_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
 		.size = sizeof(long), .align = sizeof(long),
 		.regset_get = gpr_get, .set = gpr_set
 	},
 	[REGSET_FPR] = {
-		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
 		.size = sizeof(double), .align = sizeof(double),
 		.regset_get = fpr_get, .set = fpr_set
 	},
 #ifdef CONFIG_ALTIVEC
 	[REGSET_VMX] = {
-		.core_note_type = NT_PPC_VMX, .n = 34,
+		USER_REGSET_NOTE_TYPE(PPC_VMX), .n = 34,
 		.size = sizeof(vector128), .align = sizeof(vector128),
 		.active = vr_active, .regset_get = vr_get, .set = vr_set
 	},
 #endif
 #ifdef CONFIG_VSX
 	[REGSET_VSX] = {
-		.core_note_type = NT_PPC_VSX, .n = 32,
+		USER_REGSET_NOTE_TYPE(PPC_VSX), .n = 32,
 		.size = sizeof(double), .align = sizeof(double),
 		.active = vsr_active, .regset_get = vsr_get, .set = vsr_set
 	},
 #endif
 #ifdef CONFIG_SPE
 	[REGSET_SPE] = {
-		.core_note_type = NT_PPC_SPE, .n = 35,
+		USER_REGSET_NOTE_TYPE(PPC_SPE), .n = 35,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.active = evr_active, .regset_get = evr_get, .set = evr_set
 	},
 #endif
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	[REGSET_TM_CGPR] = {
-		.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n = ELF_NGREG,
 		.size = sizeof(long), .align = sizeof(long),
 		.active = tm_cgpr_active, .regset_get = tm_cgpr_get, .set = tm_cgpr_set
 	},
 	[REGSET_TM_CFPR] = {
-		.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n = ELF_NFPREG,
 		.size = sizeof(double), .align = sizeof(double),
 		.active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
 	},
 	[REGSET_TM_CVMX] = {
-		.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n = ELF_NVMX,
 		.size = sizeof(vector128), .align = sizeof(vector128),
 		.active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
 	},
 	[REGSET_TM_CVSX] = {
-		.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n = ELF_NVSX,
 		.size = sizeof(double), .align = sizeof(double),
 		.active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
 	},
 	[REGSET_TM_SPR] = {
-		.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n = ELF_NTMSPRREG,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
 	},
 	[REGSET_TM_CTAR] = {
-		.core_note_type = NT_PPC_TM_CTAR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
 	},
 	[REGSET_TM_CPPR] = {
-		.core_note_type = NT_PPC_TM_CPPR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
 	},
 	[REGSET_TM_CDSCR] = {
-		.core_note_type = NT_PPC_TM_CDSCR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
 	},
 #endif
 #ifdef CONFIG_PPC64
 	[REGSET_PPR] = {
-		.core_note_type = NT_PPC_PPR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_PPR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = ppr_get, .set = ppr_set
 	},
 	[REGSET_DSCR] = {
-		.core_note_type = NT_PPC_DSCR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_DSCR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = dscr_get, .set = dscr_set
 	},
 #endif
 #ifdef CONFIG_PPC_BOOK3S_64
 	[REGSET_TAR] = {
-		.core_note_type = NT_PPC_TAR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TAR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = tar_get, .set = tar_set
 	},
 	[REGSET_EBB] = {
-		.core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
+		USER_REGSET_NOTE_TYPE(PPC_EBB), .n = ELF_NEBB,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = ebb_active, .regset_get = ebb_get, .set = ebb_set
 	},
 	[REGSET_PMR] = {
-		.core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
+		USER_REGSET_NOTE_TYPE(PPC_PMU), .n = ELF_NPMU,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = pmu_active, .regset_get = pmu_get, .set = pmu_set
 	},
 	[REGSET_DEXCR] = {
-		.core_note_type = NT_PPC_DEXCR, .n = ELF_NDEXCR,
+		USER_REGSET_NOTE_TYPE(PPC_DEXCR), .n = ELF_NDEXCR,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = dexcr_active, .regset_get = dexcr_get
 	},
 #ifdef CONFIG_CHECKPOINT_RESTORE
 	[REGSET_HASHKEYR] = {
-		.core_note_type = NT_PPC_HASHKEYR, .n = ELF_NHASHKEYR,
+		USER_REGSET_NOTE_TYPE(PPC_HASHKEYR), .n = ELF_NHASHKEYR,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = hashkeyr_active, .regset_get = hashkeyr_get, .set = hashkeyr_set
 	},
@@ -683,7 +683,7 @@ static const struct user_regset native_regsets[] = {
 #endif
 #ifdef CONFIG_PPC_MEM_KEYS
 	[REGSET_PKEY] = {
-		.core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY,
+		USER_REGSET_NOTE_TYPE(PPC_PKEY), .n = ELF_NPKEY,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = pkey_active, .regset_get = pkey_get, .set = pkey_set
 	},
@@ -843,92 +843,92 @@ static int gpr32_set(struct task_struct *target,
  */
 static const struct user_regset compat_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
 		.size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
 		.regset_get = gpr32_get, .set = gpr32_set
 	},
 	[REGSET_FPR] = {
-		.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
 		.size = sizeof(double), .align = sizeof(double),
 		.regset_get = fpr_get, .set = fpr_set
 	},
 #ifdef CONFIG_ALTIVEC
 	[REGSET_VMX] = {
-		.core_note_type = NT_PPC_VMX, .n = 34,
+		USER_REGSET_NOTE_TYPE(PPC_VMX), .n = 34,
 		.size = sizeof(vector128), .align = sizeof(vector128),
 		.active = vr_active, .regset_get = vr_get, .set = vr_set
 	},
 #endif
 #ifdef CONFIG_SPE
 	[REGSET_SPE] = {
-		.core_note_type = NT_PPC_SPE, .n = 35,
+		USER_REGSET_NOTE_TYPE(PPC_SPE), .n = 35,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.active = evr_active, .regset_get = evr_get, .set = evr_set
 	},
 #endif
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
 	[REGSET_TM_CGPR] = {
-		.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n = ELF_NGREG,
 		.size = sizeof(long), .align = sizeof(long),
 		.active = tm_cgpr_active,
 		.regset_get = tm_cgpr32_get, .set = tm_cgpr32_set
 	},
 	[REGSET_TM_CFPR] = {
-		.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n = ELF_NFPREG,
 		.size = sizeof(double), .align = sizeof(double),
 		.active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
 	},
 	[REGSET_TM_CVMX] = {
-		.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n = ELF_NVMX,
 		.size = sizeof(vector128), .align = sizeof(vector128),
 		.active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
 	},
 	[REGSET_TM_CVSX] = {
-		.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n = ELF_NVSX,
 		.size = sizeof(double), .align = sizeof(double),
 		.active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
 	},
 	[REGSET_TM_SPR] = {
-		.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
+		USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n = ELF_NTMSPRREG,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
 	},
 	[REGSET_TM_CTAR] = {
-		.core_note_type = NT_PPC_TM_CTAR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
 	},
 	[REGSET_TM_CPPR] = {
-		.core_note_type = NT_PPC_TM_CPPR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
 	},
 	[REGSET_TM_CDSCR] = {
-		.core_note_type = NT_PPC_TM_CDSCR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
 	},
 #endif
 #ifdef CONFIG_PPC64
 	[REGSET_PPR] = {
-		.core_note_type = NT_PPC_PPR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_PPR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = ppr_get, .set = ppr_set
 	},
 	[REGSET_DSCR] = {
-		.core_note_type = NT_PPC_DSCR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_DSCR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = dscr_get, .set = dscr_set
 	},
 #endif
 #ifdef CONFIG_PPC_BOOK3S_64
 	[REGSET_TAR] = {
-		.core_note_type = NT_PPC_TAR, .n = 1,
+		USER_REGSET_NOTE_TYPE(PPC_TAR), .n = 1,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = tar_get, .set = tar_set
 	},
 	[REGSET_EBB] = {
-		.core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
+		USER_REGSET_NOTE_TYPE(PPC_EBB), .n = ELF_NEBB,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.active = ebb_active, .regset_get = ebb_get, .set = ebb_set
 	},
-- 
2.34.1


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

* [PATCH 16/23] riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (14 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 15/23] powerpc/ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 17/23] s390/ptrace: " Dave Martin
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-riscv

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-riscv@lists.infradead.org
---
 arch/riscv/kernel/ptrace.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index ea67e9fb7a58..8e86305831ea 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -186,7 +186,7 @@ static int tagged_addr_ctrl_set(struct task_struct *target,
 
 static const struct user_regset riscv_user_regset[] = {
 	[REGSET_X] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = ELF_NGREG,
 		.size = sizeof(elf_greg_t),
 		.align = sizeof(elf_greg_t),
@@ -195,7 +195,7 @@ static const struct user_regset riscv_user_regset[] = {
 	},
 #ifdef CONFIG_FPU
 	[REGSET_F] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = ELF_NFPREG,
 		.size = sizeof(elf_fpreg_t),
 		.align = sizeof(elf_fpreg_t),
@@ -205,7 +205,7 @@ static const struct user_regset riscv_user_regset[] = {
 #endif
 #ifdef CONFIG_RISCV_ISA_V
 	[REGSET_V] = {
-		.core_note_type = NT_RISCV_VECTOR,
+		USER_REGSET_NOTE_TYPE(RISCV_VECTOR),
 		.align = 16,
 		.n = ((32 * RISCV_MAX_VLENB) +
 		      sizeof(struct __riscv_v_regset_state)) / sizeof(__u32),
@@ -216,7 +216,7 @@ static const struct user_regset riscv_user_regset[] = {
 #endif
 #ifdef CONFIG_RISCV_ISA_SUPM
 	[REGSET_TAGGED_ADDR_CTRL] = {
-		.core_note_type = NT_RISCV_TAGGED_ADDR_CTRL,
+		USER_REGSET_NOTE_TYPE(RISCV_TAGGED_ADDR_CTRL),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -380,7 +380,7 @@ static int compat_riscv_gpr_set(struct task_struct *target,
 
 static const struct user_regset compat_riscv_user_regset[] = {
 	[REGSET_X] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = ELF_NGREG,
 		.size = sizeof(compat_elf_greg_t),
 		.align = sizeof(compat_elf_greg_t),
@@ -389,7 +389,7 @@ static const struct user_regset compat_riscv_user_regset[] = {
 	},
 #ifdef CONFIG_FPU
 	[REGSET_F] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = ELF_NFPREG,
 		.size = sizeof(elf_fpreg_t),
 		.align = sizeof(elf_fpreg_t),
-- 
2.34.1


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

* [PATCH 17/23] s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (15 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 16/23] riscv: ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-09 11:58   ` Alexander Gordeev
  2025-07-01 13:56 ` [PATCH 18/23] sh: ptrace: " Dave Martin
                   ` (8 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Oleg Nesterov, Kees Cook,
	Akihiko Odaki, linux-s390

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-s390@vger.kernel.org
---
 arch/s390/kernel/ptrace.c | 42 +++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index e1240f6b29fa..494216c4b4f3 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -1209,7 +1209,7 @@ static int s390_runtime_instr_set(struct task_struct *target,
 
 static const struct user_regset s390_regsets[] = {
 	{
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = sizeof(s390_regs) / sizeof(long),
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1217,7 +1217,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_regs_set,
 	},
 	{
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(s390_fp_regs) / sizeof(long),
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1225,7 +1225,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_fpregs_set,
 	},
 	{
-		.core_note_type = NT_S390_SYSTEM_CALL,
+		USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL),
 		.n = 1,
 		.size = sizeof(unsigned int),
 		.align = sizeof(unsigned int),
@@ -1233,7 +1233,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_system_call_set,
 	},
 	{
-		.core_note_type = NT_S390_LAST_BREAK,
+		USER_REGSET_NOTE_TYPE(S390_LAST_BREAK),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1241,7 +1241,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_last_break_set,
 	},
 	{
-		.core_note_type = NT_S390_TDB,
+		USER_REGSET_NOTE_TYPE(S390_TDB),
 		.n = 1,
 		.size = 256,
 		.align = 1,
@@ -1249,7 +1249,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_tdb_set,
 	},
 	{
-		.core_note_type = NT_S390_VXRS_LOW,
+		USER_REGSET_NOTE_TYPE(S390_VXRS_LOW),
 		.n = __NUM_VXRS_LOW,
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1257,7 +1257,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_vxrs_low_set,
 	},
 	{
-		.core_note_type = NT_S390_VXRS_HIGH,
+		USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH),
 		.n = __NUM_VXRS_HIGH,
 		.size = sizeof(__vector128),
 		.align = sizeof(__vector128),
@@ -1265,7 +1265,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_vxrs_high_set,
 	},
 	{
-		.core_note_type = NT_S390_GS_CB,
+		USER_REGSET_NOTE_TYPE(S390_GS_CB),
 		.n = sizeof(struct gs_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1273,7 +1273,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_gs_cb_set,
 	},
 	{
-		.core_note_type = NT_S390_GS_BC,
+		USER_REGSET_NOTE_TYPE(S390_GS_BC),
 		.n = sizeof(struct gs_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1281,7 +1281,7 @@ static const struct user_regset s390_regsets[] = {
 		.set = s390_gs_bc_set,
 	},
 	{
-		.core_note_type = NT_S390_RI_CB,
+		USER_REGSET_NOTE_TYPE(S390_RI_CB),
 		.n = sizeof(struct runtime_instr_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1413,7 +1413,7 @@ static int s390_compat_last_break_set(struct task_struct *target,
 
 static const struct user_regset s390_compat_regsets[] = {
 	{
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = sizeof(s390_compat_regs) / sizeof(compat_long_t),
 		.size = sizeof(compat_long_t),
 		.align = sizeof(compat_long_t),
@@ -1421,7 +1421,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_compat_regs_set,
 	},
 	{
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(s390_fp_regs) / sizeof(compat_long_t),
 		.size = sizeof(compat_long_t),
 		.align = sizeof(compat_long_t),
@@ -1429,7 +1429,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_fpregs_set,
 	},
 	{
-		.core_note_type = NT_S390_SYSTEM_CALL,
+		USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL),
 		.n = 1,
 		.size = sizeof(compat_uint_t),
 		.align = sizeof(compat_uint_t),
@@ -1437,7 +1437,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_system_call_set,
 	},
 	{
-		.core_note_type = NT_S390_LAST_BREAK,
+		USER_REGSET_NOTE_TYPE(S390_LAST_BREAK),
 		.n = 1,
 		.size = sizeof(long),
 		.align = sizeof(long),
@@ -1445,7 +1445,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_compat_last_break_set,
 	},
 	{
-		.core_note_type = NT_S390_TDB,
+		USER_REGSET_NOTE_TYPE(S390_TDB),
 		.n = 1,
 		.size = 256,
 		.align = 1,
@@ -1453,7 +1453,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_tdb_set,
 	},
 	{
-		.core_note_type = NT_S390_VXRS_LOW,
+		USER_REGSET_NOTE_TYPE(S390_VXRS_LOW),
 		.n = __NUM_VXRS_LOW,
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1461,7 +1461,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_vxrs_low_set,
 	},
 	{
-		.core_note_type = NT_S390_VXRS_HIGH,
+		USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH),
 		.n = __NUM_VXRS_HIGH,
 		.size = sizeof(__vector128),
 		.align = sizeof(__vector128),
@@ -1469,7 +1469,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_vxrs_high_set,
 	},
 	{
-		.core_note_type = NT_S390_HIGH_GPRS,
+		USER_REGSET_NOTE_TYPE(S390_HIGH_GPRS),
 		.n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t),
 		.size = sizeof(compat_long_t),
 		.align = sizeof(compat_long_t),
@@ -1477,7 +1477,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_compat_regs_high_set,
 	},
 	{
-		.core_note_type = NT_S390_GS_CB,
+		USER_REGSET_NOTE_TYPE(S390_GS_CB),
 		.n = sizeof(struct gs_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1485,7 +1485,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_gs_cb_set,
 	},
 	{
-		.core_note_type = NT_S390_GS_BC,
+		USER_REGSET_NOTE_TYPE(S390_GS_BC),
 		.n = sizeof(struct gs_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
@@ -1493,7 +1493,7 @@ static const struct user_regset s390_compat_regsets[] = {
 		.set = s390_gs_bc_set,
 	},
 	{
-		.core_note_type = NT_S390_RI_CB,
+		USER_REGSET_NOTE_TYPE(S390_RI_CB),
 		.n = sizeof(struct runtime_instr_cb) / sizeof(__u64),
 		.size = sizeof(__u64),
 		.align = sizeof(__u64),
-- 
2.34.1


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

* [PATCH 18/23] sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (16 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 17/23] s390/ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 19/23] sparc: " Dave Martin
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz,
	Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-sh

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-sh@vger.kernel.org
---
 arch/sh/kernel/ptrace_32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 36f50ad81e83..06f765d71a29 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -291,7 +291,7 @@ static const struct user_regset sh_regsets[] = {
 	 *	PC, PR, SR, GBR, MACH, MACL, TRA
 	 */
 	[REGSET_GENERAL] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= ELF_NGREG,
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -301,7 +301,7 @@ static const struct user_regset sh_regsets[] = {
 
 #ifdef CONFIG_SH_FPU
 	[REGSET_FPU] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= sizeof(struct user_fpu_struct) / sizeof(long),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
-- 
2.34.1


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

* [PATCH 19/23] sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (17 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 18/23] sh: ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 20/23] x86/ptrace: " Dave Martin
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: David S. Miller, Andreas Larsson, Oleg Nesterov, Kees Cook,
	Akihiko Odaki, sparclinux

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andreas Larsson <andreas@gaisler.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: sparclinux@vger.kernel.org
---
 arch/sparc/kernel/ptrace_32.c | 4 ++--
 arch/sparc/kernel/ptrace_64.c | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index c273ccebea46..c56333975fb1 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -218,7 +218,7 @@ static const struct user_regset sparc32_regsets[] = {
 	 *	PSR, PC, nPC, Y, WIM, TBR
 	 */
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = 38,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.regset_get = genregs32_get, .set = genregs32_set
@@ -234,7 +234,7 @@ static const struct user_regset sparc32_regsets[] = {
 	 *	FPU QUEUE (64 32-bit ints)
 	 */
 	[REGSET_FP] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = 99,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.regset_get = fpregs32_get, .set = fpregs32_set
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 4deba5b6eddb..9fc67fa9336f 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -420,7 +420,7 @@ static const struct user_regset sparc64_regsets[] = {
 	 *	TSTATE, TPC, TNPC, Y
 	 */
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = 36,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = genregs64_get, .set = genregs64_set
@@ -432,7 +432,7 @@ static const struct user_regset sparc64_regsets[] = {
 	 *	FPRS
 	 */
 	[REGSET_FP] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = 35,
 		.size = sizeof(u64), .align = sizeof(u64),
 		.regset_get = fpregs64_get, .set = fpregs64_set
@@ -750,7 +750,7 @@ static const struct user_regset sparc32_regsets[] = {
 	 *	PSR, PC, nPC, Y, WIM, TBR
 	 */
 	[REGSET_GENERAL] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = 38,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.regset_get = genregs32_get, .set = genregs32_set
@@ -766,7 +766,7 @@ static const struct user_regset sparc32_regsets[] = {
 	 *	FPU QUEUE (64 32-bit ints)
 	 */
 	[REGSET_FP] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = 99,
 		.size = sizeof(u32), .align = sizeof(u32),
 		.regset_get = fpregs32_get, .set = fpregs32_set
-- 
2.34.1


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

* [PATCH 20/23] x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (18 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 19/23] sparc: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 21/23] um: ptrace: " Dave Martin
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Oleg Nesterov, Kees Cook, Akihiko Odaki, x86

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: x86@kernel.org
---
 arch/x86/kernel/ptrace.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 095f04bdabdc..3dcadc13f09a 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1236,7 +1236,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
 
 static struct user_regset x86_64_regsets[] __ro_after_init = {
 	[REGSET64_GENERAL] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= sizeof(struct user_regs_struct) / sizeof(long),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -1244,7 +1244,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
 		.set		= genregs_set
 	},
 	[REGSET64_FP] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= sizeof(struct fxregs_state) / sizeof(long),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -1253,7 +1253,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
 		.set		= xfpregs_set
 	},
 	[REGSET64_XSTATE] = {
-		.core_note_type	= NT_X86_XSTATE,
+		USER_REGSET_NOTE_TYPE(X86_XSTATE),
 		.size		= sizeof(u64),
 		.align		= sizeof(u64),
 		.active		= xstateregs_active,
@@ -1261,7 +1261,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
 		.set		= xstateregs_set
 	},
 	[REGSET64_IOPERM] = {
-		.core_note_type	= NT_386_IOPERM,
+		USER_REGSET_NOTE_TYPE(386_IOPERM),
 		.n		= IO_BITMAP_LONGS,
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -1270,7 +1270,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
 	},
 #ifdef CONFIG_X86_USER_SHADOW_STACK
 	[REGSET64_SSP] = {
-		.core_note_type	= NT_X86_SHSTK,
+		USER_REGSET_NOTE_TYPE(X86_SHSTK),
 		.n		= 1,
 		.size		= sizeof(u64),
 		.align		= sizeof(u64),
@@ -1297,7 +1297,7 @@ static const struct user_regset_view user_x86_64_view = {
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
 static struct user_regset x86_32_regsets[] __ro_after_init = {
 	[REGSET32_GENERAL] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= sizeof(struct user_regs_struct32) / sizeof(u32),
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
@@ -1305,7 +1305,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
 		.set		= genregs32_set
 	},
 	[REGSET32_FP] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= sizeof(struct user_i387_ia32_struct) / sizeof(u32),
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
@@ -1314,7 +1314,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
 		.set		= fpregs_set
 	},
 	[REGSET32_XFP] = {
-		.core_note_type	= NT_PRXFPREG,
+		USER_REGSET_NOTE_TYPE(PRXFPREG),
 		.n		= sizeof(struct fxregs_state) / sizeof(u32),
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
@@ -1323,7 +1323,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
 		.set		= xfpregs_set
 	},
 	[REGSET32_XSTATE] = {
-		.core_note_type	= NT_X86_XSTATE,
+		USER_REGSET_NOTE_TYPE(X86_XSTATE),
 		.size		= sizeof(u64),
 		.align		= sizeof(u64),
 		.active		= xstateregs_active,
@@ -1331,7 +1331,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
 		.set		= xstateregs_set
 	},
 	[REGSET32_TLS] = {
-		.core_note_type	= NT_386_TLS,
+		USER_REGSET_NOTE_TYPE(386_TLS),
 		.n		= GDT_ENTRY_TLS_ENTRIES,
 		.bias		= GDT_ENTRY_TLS_MIN,
 		.size		= sizeof(struct user_desc),
@@ -1341,7 +1341,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
 		.set		= regset_tls_set
 	},
 	[REGSET32_IOPERM] = {
-		.core_note_type	= NT_386_IOPERM,
+		USER_REGSET_NOTE_TYPE(386_IOPERM),
 		.n		= IO_BITMAP_BYTES / sizeof(u32),
 		.size		= sizeof(u32),
 		.align		= sizeof(u32),
-- 
2.34.1


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

* [PATCH 21/23] um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (19 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 20/23] x86/ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-04 11:58   ` Johannes Berg
  2025-07-01 13:56 ` [PATCH 22/23] xtensa: " Dave Martin
                   ` (4 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Richard Weinberger, Anton Ivanov, Johannes Berg, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-um, x86

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-um@lists.infradead.org
Cc: x86@kernel.org
---
 arch/x86/um/ptrace.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/um/ptrace.c b/arch/x86/um/ptrace.c
index 3275870330fe..c982ab7103f1 100644
--- a/arch/x86/um/ptrace.c
+++ b/arch/x86/um/ptrace.c
@@ -236,7 +236,7 @@ static int generic_fpregs_set(struct task_struct *target,
 
 static struct user_regset uml_regsets[] __ro_after_init = {
 	[REGSET_GENERAL] = {
-		.core_note_type	= NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n		= sizeof(struct user_regs_struct) / sizeof(long),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -246,7 +246,7 @@ static struct user_regset uml_regsets[] __ro_after_init = {
 #ifdef CONFIG_X86_32
 	/* Old FP registers, they are needed in signal frames */
 	[REGSET_FP_LEGACY] = {
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= sizeof(struct user_i387_ia32_struct) / sizeof(long),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
@@ -257,10 +257,10 @@ static struct user_regset uml_regsets[] __ro_after_init = {
 #endif
 	[REGSET_FP] = {
 #ifdef CONFIG_X86_32
-		.core_note_type	= NT_PRXFPREG,
+		USER_REGSET_NOTE_TYPE(PRXFPREG),
 		.n		= sizeof(struct user32_fxsr_struct) / sizeof(long),
 #else
-		.core_note_type	= NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n		= sizeof(struct user_i387_struct) / sizeof(long),
 #endif
 		.size		= sizeof(long),
@@ -270,7 +270,7 @@ static struct user_regset uml_regsets[] __ro_after_init = {
 		.set		= generic_fpregs_set,
 	},
 	[REGSET_XSTATE] = {
-		.core_note_type	= NT_X86_XSTATE,
+		USER_REGSET_NOTE_TYPE(X86_XSTATE),
 		.size		= sizeof(long),
 		.align		= sizeof(long),
 		.active		= generic_fpregs_active,
-- 
2.34.1


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

* [PATCH 22/23] xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (20 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 21/23] um: ptrace: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-01 13:56 ` [PATCH 23/23] binfmt_elf: Warn on missing or suspicious " Dave Martin
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chris Zankel, Max Filippov, Oleg Nesterov, Kees Cook,
	Akihiko Odaki

Instead of having the core code guess the note name for each regset,
use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 arch/xtensa/kernel/ptrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 9056cd1a8302..ff0600a0584c 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -193,7 +193,7 @@ enum xtensa_regset {
 
 static const struct user_regset xtensa_regsets[] = {
 	[REGSET_GPR] = {
-		.core_note_type = NT_PRSTATUS,
+		USER_REGSET_NOTE_TYPE(PRSTATUS),
 		.n = sizeof(struct user_pt_regs) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
@@ -201,7 +201,7 @@ static const struct user_regset xtensa_regsets[] = {
 		.set = gpr_set,
 	},
 	[REGSET_TIE] = {
-		.core_note_type = NT_PRFPREG,
+		USER_REGSET_NOTE_TYPE(PRFPREG),
 		.n = sizeof(elf_xtregs_t) / sizeof(u32),
 		.size = sizeof(u32),
 		.align = sizeof(u32),
-- 
2.34.1


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

* [PATCH 23/23] binfmt_elf: Warn on missing or suspicious regset note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (21 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 22/23] xtensa: " Dave Martin
@ 2025-07-01 13:56 ` Dave Martin
  2025-07-05 15:14   ` Kees Cook
  2025-07-09  5:05 ` [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump " Akihiko Odaki
                   ` (2 subsequent siblings)
  25 siblings, 1 reply; 36+ messages in thread
From: Dave Martin @ 2025-07-01 13:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: Oleg Nesterov, Kees Cook, Akihiko Odaki

Now that all regset definitions declare an explicit note name, warn if
the note name is missing when generating a core dump.  Simplify the
fallback to always guess "LINUX", which is appropriate for all
Linux-specific notes (i.e., all newly added notes, for a long time
now).  The one standard exception (PR_FPREG) will no longer have an
"unexpected" note name overridden, but a warning will still be emitted.

Also warn if the specified note name doesn't match the legacy
pattern -- but don't bother to override the name in this case.  This
warning can be removed in future if new note types emerge that require
a specific note name that is not "LINUX".

No functional change, beyond the extra noise in dmesg and not
overriding an unexpected note name for PR_FPREG any more.

Now that all upstream arches are ported to use USER_REGSET_NOTE_TYPE(),
new regsets created by copy-pasting existing code should end up correct
by construction.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>

---

***NOTE***

This patch is included here for completeness, but I expect to repost it
in a future cycle, once the arch patches have gone in.

Un-migrated arches will trigger WARNs with this patch applied, and
arches that don't specify codedump note names will always get
"LINUX" -- since the whole point is to stop guessing the note name in
the core code.

On _unpatched_ arches (only) this is a potential ABI break for the
NT_PRFPREG note (which, for historical reasons, is a "CORE" note even
though it is OS-specific on most or all arches).

Cheers
---Dave
---
 fs/binfmt_elf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 89063d1d9e9a..92cf005468b5 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1750,8 +1750,13 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
 		if (is_fpreg)
 			SET_PR_FPVALID(&t->prstatus);
 
-		if (!note_name)
-			note_name = is_fpreg ? NN_PRFPREG : "LINUX";
+		/* There should be a note name, but if not, guess: */
+		if (WARN_ON_ONCE(!note_name))
+			note_name = "LINUX";
+		else
+			/* Warn on non-legacy-compatible names, for now. */
+			WARN_ON_ONCE(strcmp(note_name,
+					    is_fpreg ? "CORE" : "LINUX"));
 
 		__fill_note(&t->notes[note_iter], note_name, note_type,
 			    ret, data);
-- 
2.34.1


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

* Re: [PATCH 21/23] um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:56 ` [PATCH 21/23] um: ptrace: " Dave Martin
@ 2025-07-04 11:58   ` Johannes Berg
  2025-07-04 16:46     ` Dave Martin
  0 siblings, 1 reply; 36+ messages in thread
From: Johannes Berg @ 2025-07-04 11:58 UTC (permalink / raw)
  To: Dave Martin, linux-kernel
  Cc: Richard Weinberger, Anton Ivanov, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Oleg Nesterov,
	Kees Cook, Akihiko Odaki, linux-um, x86

On Tue, 2025-07-01 at 14:56 +0100, Dave Martin wrote:
> Instead of having the core code guess the note name for each regset,
> use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.
> 

Seems to work according to the test in the cover letter. Since it's part
of a larger series and this patch doesn't build by itself, I'll assume
you want to take them all together through some other tree, so:

Acked-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Johannes Berg <johannes@sipsolutions.net>

johannes

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

* Re: [PATCH 21/23] um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-04 11:58   ` Johannes Berg
@ 2025-07-04 16:46     ` Dave Martin
  0 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-04 16:46 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-kernel, Richard Weinberger, Anton Ivanov, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, H. Peter Anvin,
	Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-um, x86

Hi,

On Fri, Jul 04, 2025 at 01:58:57PM +0200, Johannes Berg wrote:
> On Tue, 2025-07-01 at 14:56 +0100, Dave Martin wrote:
> > Instead of having the core code guess the note name for each regset,
> > use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.
> > 
> 
> Seems to work according to the test in the cover letter. Since it's part
> of a larger series and this patch doesn't build by itself, I'll assume
> you want to take them all together through some other tree, so:
> 
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
> Tested-by: Johannes Berg <johannes@sipsolutions.net>
> 
> johannes

Thanks!

Cheers
---Dave

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

* Re: [PATCH 23/23] binfmt_elf: Warn on missing or suspicious regset note names
  2025-07-01 13:56 ` [PATCH 23/23] binfmt_elf: Warn on missing or suspicious " Dave Martin
@ 2025-07-05 15:14   ` Kees Cook
  2025-07-07 11:03     ` Dave Martin
  0 siblings, 1 reply; 36+ messages in thread
From: Kees Cook @ 2025-07-05 15:14 UTC (permalink / raw)
  To: Dave Martin, linux-kernel; +Cc: Oleg Nesterov, Akihiko Odaki



On July 1, 2025 6:56:16 AM PDT, Dave Martin <Dave.Martin@arm.com> wrote:
>Un-migrated arches will trigger WARNs with this patch applied, and
>arches that don't specify codedump note names will always get
>"LINUX" -- since the whole point is to stop guessing the note name in
>the core code.
>
>On _unpatched_ arches (only) this is a potential ABI break for the
>NT_PRFPREG note (which, for historical reasons, is a "CORE" note even
>though it is OS-specific on most or all arches).

After all your arch patches, aren't all the archs using the correct values? Is the WARN for new or out-of-tree archs?

-Kees

-- 
Kees Cook

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

* Re: [PATCH 10/23] m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:56 ` [PATCH 10/23] m68k: " Dave Martin
@ 2025-07-06  9:25   ` Geert Uytterhoeven
  2025-07-07 10:54     ` Dave Martin
  0 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2025-07-06  9:25 UTC (permalink / raw)
  To: Dave Martin
  Cc: linux-kernel, Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-m68k

On Tue, 1 Jul 2025 at 15:56, Dave Martin <Dave.Martin@arm.com> wrote:
> Instead of having the core code guess the note name for each regset,
> use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.
>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 10/23] m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-06  9:25   ` Geert Uytterhoeven
@ 2025-07-07 10:54     ` Dave Martin
  0 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-07 10:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, Oleg Nesterov, Kees Cook, Akihiko Odaki, linux-m68k

On Sun, Jul 06, 2025 at 11:25:21AM +0200, Geert Uytterhoeven wrote:
> On Tue, 1 Jul 2025 at 15:56, Dave Martin <Dave.Martin@arm.com> wrote:
> > Instead of having the core code guess the note name for each regset,
> > use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.
> >
> > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Gr{oetje,eeting}s,
> 
>                         Geert

[...]

Thanks!

---Dave

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

* Re: [PATCH 23/23] binfmt_elf: Warn on missing or suspicious regset note names
  2025-07-05 15:14   ` Kees Cook
@ 2025-07-07 11:03     ` Dave Martin
  0 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-07 11:03 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-kernel, Oleg Nesterov, Akihiko Odaki

On Sat, Jul 05, 2025 at 08:14:33AM -0700, Kees Cook wrote:
> 
> 
> On July 1, 2025 6:56:16 AM PDT, Dave Martin <Dave.Martin@arm.com> wrote:
> >Un-migrated arches will trigger WARNs with this patch applied, and
> >arches that don't specify codedump note names will always get
> >"LINUX" -- since the whole point is to stop guessing the note name in
> >the core code.
> >
> >On _unpatched_ arches (only) this is a potential ABI break for the
> >NT_PRFPREG note (which, for historical reasons, is a "CORE" note even
> >though it is OS-specific on most or all arches).
> 
> After all your arch patches, aren't all the archs using the correct
> values? Is the WARN for new or out-of-tree archs?
> 
> -Kees

[...]

If there are in-flight series where someone adds a new arch (?) or more
likely adds a new regset to an existing arch, then we might hit this.

In practice, all per-arch regsets apart from NT_PRFPREG use the name
"LINUX", so defaulting to this if the name is not specified will hardly
ever be a problem -- unless there really is a new arch out of tree that
is going to merge imminently.

I'm happy to simplify the check here if people prefer.

Cheers
---Dave

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

* Re: [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (22 preceding siblings ...)
  2025-07-01 13:56 ` [PATCH 23/23] binfmt_elf: Warn on missing or suspicious " Dave Martin
@ 2025-07-09  5:05 ` Akihiko Odaki
  2025-07-15  5:37 ` Kees Cook
  2025-08-10 21:12 ` patchwork-bot+linux-riscv
  25 siblings, 0 replies; 36+ messages in thread
From: Akihiko Odaki @ 2025-07-09  5:05 UTC (permalink / raw)
  To: Dave Martin, linux-kernel
  Cc: David S. Miller, H. Peter Anvin, James E.J. Bottomley, Albert Ou,
	Alexander Gordeev, Alexandre Ghiti, Andreas Larsson, Anton Ivanov,
	Borislav Petkov, Brian Cain, Catalin Marinas, Chris Zankel,
	Christian Borntraeger, Christophe Leroy, Dave Hansen, Dinh Nguyen,
	Geert Uytterhoeven, Guo Ren, Heiko Carstens, Helge Deller,
	Huacai Chen, Ingo Molnar, Johannes Berg,
	John Paul Adrian Glaubitz, Jonas Bonn, Kees Cook,
	Madhavan Srinivasan, Max Filippov, Michael Ellerman,
	Nicholas Piggin, Oleg Nesterov, Palmer Dabbelt, Paul Walmsley,
	Rich Felker, Richard Weinberger, Russell King, Stafford Horne,
	Stefan Kristiansson, Sven Schnelle, Thomas Bogendoerfer,
	Thomas Gleixner, Vasily Gorbik, Vineet Gupta, WANG Xuerui,
	Will Deacon, Yoshinori Sato, linux-arch, linux-arm-kernel,
	linux-csky, linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
	linux-parisc, linux-riscv, linux-s390, linux-sh, linux-snps-arc,
	linux-um, linuxppc-dev, loongarch, sparclinux, x86

On 2025/07/01 22:55, Dave Martin wrote:
> This series aims to clean up an aspect of coredump generation:
> 
> ELF coredumps contain a set of notes describing the state of machine
> registers and other information about the dumped process.
> 
> Notes are identified by a numeric identifier n_type and a "name"
> string, although this terminology is somewhat misleading.  Officially,
> the "name" of a note is really an "originator" or namespace identifier
> that indicates how to interpret n_type [1], although in practice it is
> often used more loosely.
> 
> Either way, each kind of note needs _both_ a specific "name" string and
> a specific n_type to identify it robustly.
> 
> To centralise this knowledge in one place and avoid the need for ad-hoc
> code to guess the correct name for a given note, commit 7da8e4ad4df0
> ("elf: Define note name macros") [2] added an explicit NN_<foo> #define
> in elf.h to give the name corresponding to each named note type
> NT_<foo>.
> 
> Now that the note name for each note is specified explicitly, the
> remaining guesswork for determining the note name for common and
> arch-specific regsets in ELF core dumps can be eliminated.
> 
> This series aims to do just that:
> 
>   * Patch 2 adds a user_regset field to specify the note name, and a
>     helper macro to populate it correctly alongside the note type.
> 
>   * Patch 3 ports away the ad-hoc note names in the common coredump
>     code.
> 
>   * Patches 4-22 make the arch-specific changes.  (This is pretty
>     mechanical for most arches.)
> 
>   * The final patch adds a WARN() when no note name is specified,
>     and simplifies the fallback guess.  This should only be applied
>     when all arches have ported across.
> 
> See the individual patches for details.
> 
> 
> Testing:
> 
>   * x86, arm64: Booted in a VM and triggered a core dump with no WARN(),
>     and verified that the dumped notes are the same.
> 
>   * arm: Build-tested only (for now).
> 
>   * Other arches: not tested yet
> 
> Any help with testing is appreciated.  If the following generates the
> same notes (as dumped by readelf -n core) and doesn't trigger a WARN,
> then we are probably good.
> 
> $ sleep 60 &
> $ kill -QUIT $!
> 
> (Register content might differ between runs, but it should be safe to
> ignore that -- this series only deals with the note names and types.)
> 
> Cheers
> ---Dave
> 
> 
> [1] System V Application Binary Interface, Edition 4.1,
> Section 5 (Program Loading and Dynamic Linking) -> "Note Section"
> 
> https://refspecs.linuxfoundation.org/elf/gabi41.pdf
> 
> [2] elf: Define note name macros
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/uapi/linux/elf.h?id=7da8e4ad4df0dd12f37357af62ce1b63e75ae2e6
> 
> 
> Dave Martin (23):
>    regset: Fix kerneldoc for struct regset_get() in user_regset
>    regset: Add explicit core note name in struct user_regset
>    binfmt_elf: Dump non-arch notes with strictly matching name and type
>    ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    ARM: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
>    xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note
>      names
>    binfmt_elf: Warn on missing or suspicious regset note names
> 
>   arch/arc/kernel/ptrace.c                 |  4 +-
>   arch/arm/kernel/ptrace.c                 |  6 +-
>   arch/arm64/kernel/ptrace.c               | 52 ++++++++---------
>   arch/csky/kernel/ptrace.c                |  4 +-
>   arch/hexagon/kernel/ptrace.c             |  2 +-
>   arch/loongarch/kernel/ptrace.c           | 16 ++---
>   arch/m68k/kernel/ptrace.c                |  4 +-
>   arch/mips/kernel/ptrace.c                | 20 +++----
>   arch/nios2/kernel/ptrace.c               |  2 +-
>   arch/openrisc/kernel/ptrace.c            |  4 +-
>   arch/parisc/kernel/ptrace.c              |  8 +--
>   arch/powerpc/kernel/ptrace/ptrace-view.c | 74 ++++++++++++------------
>   arch/riscv/kernel/ptrace.c               | 12 ++--
>   arch/s390/kernel/ptrace.c                | 42 +++++++-------
>   arch/sh/kernel/ptrace_32.c               |  4 +-
>   arch/sparc/kernel/ptrace_32.c            |  4 +-
>   arch/sparc/kernel/ptrace_64.c            |  8 +--
>   arch/x86/kernel/ptrace.c                 | 22 +++----
>   arch/x86/um/ptrace.c                     | 10 ++--
>   arch/xtensa/kernel/ptrace.c              |  4 +-
>   fs/binfmt_elf.c                          | 36 +++++++-----
>   fs/binfmt_elf_fdpic.c                    | 17 +++---
>   include/linux/regset.h                   | 12 +++-
>   23 files changed, 194 insertions(+), 173 deletions(-)
> 
> 
> base-commit: 86731a2a651e58953fc949573895f2fa6d456841

For the whole series:
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

Regards,
Akihiko Odaki

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

* Re: [PATCH 02/23] regset: Add explicit core note name in struct user_regset
  2025-07-01 13:55 ` [PATCH 02/23] regset: Add explicit core note name in struct user_regset Dave Martin
@ 2025-07-09 11:57   ` Alexander Gordeev
  0 siblings, 0 replies; 36+ messages in thread
From: Alexander Gordeev @ 2025-07-09 11:57 UTC (permalink / raw)
  To: Dave Martin; +Cc: linux-kernel, Oleg Nesterov, Kees Cook, Akihiko Odaki

On Tue, Jul 01, 2025 at 02:55:55PM +0100, Dave Martin wrote:
> There is currently hard-coded logic spread around the tree for
> determining the note name for regset notes emitted in coredumps.
> 
> Now that the names are declared explicitly in <uapi/elf.h>, this can be
> simplified.
> 
> In preparation for getting rid of the special-case logic, add an
> explicit core_note_name field in struct user_regset for specifying the
> note name explicitly.  To help avoid mistakes, a convenience macro
> USER_REGSET_NOTE_TYPE() is provided to set .core_note_type and
> .core_note_name based on the note type.
> 
> When dumping core, use the new field to set the note name, if the
> regset specifies it.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Kees Cook <kees@kernel.org>
> Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>  fs/binfmt_elf.c        |  8 ++++++--
>  include/linux/regset.h | 10 ++++++++++
>  2 files changed, 16 insertions(+), 2 deletions(-)

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> # s390

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

* Re: [PATCH 17/23] s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
  2025-07-01 13:56 ` [PATCH 17/23] s390/ptrace: " Dave Martin
@ 2025-07-09 11:58   ` Alexander Gordeev
  0 siblings, 0 replies; 36+ messages in thread
From: Alexander Gordeev @ 2025-07-09 11:58 UTC (permalink / raw)
  To: Dave Martin
  Cc: linux-kernel, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Sven Schnelle, Oleg Nesterov, Kees Cook,
	Akihiko Odaki, linux-s390

On Tue, Jul 01, 2025 at 02:56:10PM +0100, Dave Martin wrote:
> Instead of having the core code guess the note name for each regset,
> use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h.
> 
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> Cc: Heiko Carstens <hca@linux.ibm.com>
> Cc: Vasily Gorbik <gor@linux.ibm.com>
> Cc: Alexander Gordeev <agordeev@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
> Cc: Sven Schnelle <svens@linux.ibm.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Kees Cook <kees@kernel.org>
> Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
> Cc: linux-s390@vger.kernel.org
> ---
>  arch/s390/kernel/ptrace.c | 42 +++++++++++++++++++--------------------
>  1 file changed, 21 insertions(+), 21 deletions(-)

Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>

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

* Re: [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (23 preceding siblings ...)
  2025-07-09  5:05 ` [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump " Akihiko Odaki
@ 2025-07-15  5:37 ` Kees Cook
  2025-07-15 10:32   ` Dave Martin
  2025-08-10 21:12 ` patchwork-bot+linux-riscv
  25 siblings, 1 reply; 36+ messages in thread
From: Kees Cook @ 2025-07-15  5:37 UTC (permalink / raw)
  To: linux-kernel, Dave Martin
  Cc: Kees Cook, David S. Miller, H. Peter Anvin, James E.J. Bottomley,
	Akihiko Odaki, Albert Ou, Alexander Gordeev, Alexandre Ghiti,
	Andreas Larsson, Anton Ivanov, Borislav Petkov, Brian Cain,
	Catalin Marinas, Chris Zankel, Christian Borntraeger,
	Christophe Leroy, Dave Hansen, Dinh Nguyen, Geert Uytterhoeven,
	Guo Ren, Heiko Carstens, Helge Deller, Huacai Chen, Ingo Molnar,
	Johannes Berg, John Paul Adrian Glaubitz, Jonas Bonn,
	Madhavan Srinivasan, Max Filippov, Michael Ellerman,
	Nicholas Piggin, Oleg Nesterov, Palmer Dabbelt, Paul Walmsley,
	Rich Felker, Richard Weinberger, Russell King, Stafford Horne,
	Stefan Kristiansson, Sven Schnelle, Thomas Bogendoerfer,
	Thomas Gleixner, Vasily Gorbik, Vineet Gupta, WANG Xuerui,
	Will Deacon, Yoshinori Sato, linux-arch, linux-arm-kernel,
	linux-csky, linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
	linux-parisc, linux-riscv, linux-s390, linux-sh, linux-snps-arc,
	linux-um, linuxppc-dev, loongarch, sparclinux, x86

On Tue, 01 Jul 2025 14:55:53 +0100, Dave Martin wrote:
> This series aims to clean up an aspect of coredump generation:
> 
> ELF coredumps contain a set of notes describing the state of machine
> registers and other information about the dumped process.
> 
> Notes are identified by a numeric identifier n_type and a "name"
> string, although this terminology is somewhat misleading.  Officially,
> the "name" of a note is really an "originator" or namespace identifier
> that indicates how to interpret n_type [1], although in practice it is
> often used more loosely.
> 
> [...]

Applied to for-next/execve, thanks!

[01/23] regset: Fix kerneldoc for struct regset_get() in user_regset
        https://git.kernel.org/kees/c/6fd9e1aa0784
[02/23] regset: Add explicit core note name in struct user_regset
        https://git.kernel.org/kees/c/85a7f9cbf8a8
[03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type
        https://git.kernel.org/kees/c/9674a1be4dd5
[04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/237dc8d79627
[05/23] ARM: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/49b849d11cd1
[06/23] arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/87b0d081dc98
[07/23] csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/2c2fb861fc59
[08/23] hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/55821111b1b3
[09/23] LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/1260e3b13584
[10/23] m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/e572168e8d2a
[11/23] MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/18bd88faa246
[12/23] nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/8368cd0e4636
[13/23] openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/10cd957a895f
[14/23] parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/92acdd819b5d
[15/23] powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/307035acefbd
[16/23] riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/c9502cc7bef5
[17/23] s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/d6a883cb40fc
[18/23] sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/afe74eecd88f
[19/23] sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/c9d4cb25e94e
[20/23] x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/3de0414dec7b
[21/23] um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/40d3a88594b5
[22/23] xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
        https://git.kernel.org/kees/c/cb32fb722f4b
[23/23] binfmt_elf: Warn on missing or suspicious regset note names
        https://git.kernel.org/kees/c/a55128d392e8

Take care,

-- 
Kees Cook


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

* Re: [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names
  2025-07-15  5:37 ` Kees Cook
@ 2025-07-15 10:32   ` Dave Martin
  0 siblings, 0 replies; 36+ messages in thread
From: Dave Martin @ 2025-07-15 10:32 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, David S. Miller, H. Peter Anvin,
	James E.J. Bottomley, Akihiko Odaki, Albert Ou, Alexander Gordeev,
	Alexandre Ghiti, Andreas Larsson, Anton Ivanov, Borislav Petkov,
	Brian Cain, Catalin Marinas, Chris Zankel, Christian Borntraeger,
	Christophe Leroy, Dave Hansen, Dinh Nguyen, Geert Uytterhoeven,
	Guo Ren, Heiko Carstens, Helge Deller, Huacai Chen, Ingo Molnar,
	Johannes Berg, John Paul Adrian Glaubitz, Jonas Bonn,
	Madhavan Srinivasan, Max Filippov, Michael Ellerman,
	Nicholas Piggin, Oleg Nesterov, Palmer Dabbelt, Paul Walmsley,
	Rich Felker, Richard Weinberger, Russell King, Stafford Horne,
	Stefan Kristiansson, Sven Schnelle, Thomas Bogendoerfer,
	Thomas Gleixner, Vasily Gorbik, Vineet Gupta, WANG Xuerui,
	Will Deacon, Yoshinori Sato, linux-arch, linux-arm-kernel,
	linux-csky, linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
	linux-parisc, linux-riscv, linux-s390, linux-sh, linux-snps-arc,
	linux-um, linuxppc-dev, loongarch, sparclinux, x86

On Mon, Jul 14, 2025 at 10:37:11PM -0700, Kees Cook wrote:
> On Tue, 01 Jul 2025 14:55:53 +0100, Dave Martin wrote:
> > This series aims to clean up an aspect of coredump generation:
> > 
> > ELF coredumps contain a set of notes describing the state of machine
> > registers and other information about the dumped process.
> > 
> > Notes are identified by a numeric identifier n_type and a "name"
> > string, although this terminology is somewhat misleading.  Officially,
> > the "name" of a note is really an "originator" or namespace identifier
> > that indicates how to interpret n_type [1], although in practice it is
> > often used more loosely.
> > 
> > [...]
> 
> Applied to for-next/execve, thanks!
> 
> [01/23] regset: Fix kerneldoc for struct regset_get() in user_regset
>         https://git.kernel.org/kees/c/6fd9e1aa0784

[...]

> [23/23] binfmt_elf: Warn on missing or suspicious regset note names
>         https://git.kernel.org/kees/c/a55128d392e8
> 
> Take care,
> 
> -- 
> Kees Cook

Thanks!

Assuming nobody screams about things going wrong in next, I'll plan to
water down the paranoid check in binfmt_elf.c:fill_thread_core_info().

Anyone copy-pasting a new arch after this is in mainline shouldn't fall
foul of this.

Cheers
---Dave

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

* Re: [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names
  2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
                   ` (24 preceding siblings ...)
  2025-07-15  5:37 ` Kees Cook
@ 2025-08-10 21:12 ` patchwork-bot+linux-riscv
  25 siblings, 0 replies; 36+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-08-10 21:12 UTC (permalink / raw)
  To: Dave Martin
  Cc: linux-riscv, linux-kernel, davem, hpa, James.Bottomley,
	akihiko.odaki, aou, agordeev, alex, andreas, anton.ivanov, bp,
	bcain, catalin.marinas, chris, borntraeger, christophe.leroy,
	dave.hansen, dinguyen, geert, guoren, hca, deller, chenhuacai,
	mingo, johannes, glaubitz, jonas, kees, maddy, jcmvbkbc, mpe,
	npiggin, oleg, palmer, paul.walmsley, dalias, richard, linux,
	shorne, stefan.kristiansson, svens, tsbogend, tglx, gor, vgupta,
	kernel, will, ysato, linux-arch, linux-arm-kernel, linux-csky,
	linux-hexagon, linux-m68k, linux-mips, linux-openrisc,
	linux-parisc, linux-s390, linux-sh, linux-snps-arc, linux-um,
	linuxppc-dev, loongarch, sparclinux, x86

Hello:

This patch was applied to riscv/linux.git (fixes)
by Kees Cook <kees@kernel.org>:

On Tue,  1 Jul 2025 14:55:53 +0100 you wrote:
> This series aims to clean up an aspect of coredump generation:
> 
> ELF coredumps contain a set of notes describing the state of machine
> registers and other information about the dumped process.
> 
> Notes are identified by a numeric identifier n_type and a "name"
> string, although this terminology is somewhat misleading.  Officially,
> the "name" of a note is really an "originator" or namespace identifier
> that indicates how to interpret n_type [1], although in practice it is
> often used more loosely.
> 
> [...]

Here is the summary with links:
  - [16/23] riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
    https://git.kernel.org/riscv/c/c9502cc7bef5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-08-10 21:12 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 13:55 [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump note names Dave Martin
2025-07-01 13:55 ` [PATCH 01/23] regset: Fix kerneldoc for struct regset_get() in user_regset Dave Martin
2025-07-01 13:55 ` [PATCH 02/23] regset: Add explicit core note name in struct user_regset Dave Martin
2025-07-09 11:57   ` Alexander Gordeev
2025-07-01 13:55 ` [PATCH 03/23] binfmt_elf: Dump non-arch notes with strictly matching name and type Dave Martin
2025-07-01 13:55 ` [PATCH 04/23] ARC: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names Dave Martin
2025-07-01 13:55 ` [PATCH 05/23] ARM: " Dave Martin
2025-07-01 13:55 ` [PATCH 06/23] arm64: " Dave Martin
2025-07-01 13:56 ` [PATCH 07/23] csky: " Dave Martin
2025-07-01 13:56 ` [PATCH 08/23] hexagon: " Dave Martin
2025-07-01 13:56 ` [PATCH 09/23] LoongArch: " Dave Martin
2025-07-01 13:56 ` [PATCH 10/23] m68k: " Dave Martin
2025-07-06  9:25   ` Geert Uytterhoeven
2025-07-07 10:54     ` Dave Martin
2025-07-01 13:56 ` [PATCH 11/23] MIPS: " Dave Martin
2025-07-01 13:56 ` [PATCH 12/23] nios2: " Dave Martin
2025-07-01 13:56 ` [PATCH 13/23] openrisc: " Dave Martin
2025-07-01 13:56 ` [PATCH 14/23] parisc: " Dave Martin
2025-07-01 13:56 ` [PATCH 15/23] powerpc/ptrace: " Dave Martin
2025-07-01 13:56 ` [PATCH 16/23] riscv: ptrace: " Dave Martin
2025-07-01 13:56 ` [PATCH 17/23] s390/ptrace: " Dave Martin
2025-07-09 11:58   ` Alexander Gordeev
2025-07-01 13:56 ` [PATCH 18/23] sh: ptrace: " Dave Martin
2025-07-01 13:56 ` [PATCH 19/23] sparc: " Dave Martin
2025-07-01 13:56 ` [PATCH 20/23] x86/ptrace: " Dave Martin
2025-07-01 13:56 ` [PATCH 21/23] um: ptrace: " Dave Martin
2025-07-04 11:58   ` Johannes Berg
2025-07-04 16:46     ` Dave Martin
2025-07-01 13:56 ` [PATCH 22/23] xtensa: " Dave Martin
2025-07-01 13:56 ` [PATCH 23/23] binfmt_elf: Warn on missing or suspicious " Dave Martin
2025-07-05 15:14   ` Kees Cook
2025-07-07 11:03     ` Dave Martin
2025-07-09  5:05 ` [PATCH 00/23] binfmt_elf,arch/*: Use elf.h for coredump " Akihiko Odaki
2025-07-15  5:37 ` Kees Cook
2025-07-15 10:32   ` Dave Martin
2025-08-10 21:12 ` patchwork-bot+linux-riscv

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 NNTP newsgroup(s).