Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names

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
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20250701135616.29630-22-Dave.Martin@arm.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Dave Martin and committed by
Kees Cook
40d3a885 3de0414d

+5 -5
+5 -5
arch/x86/um/ptrace.c
··· 236 236 237 237 static struct user_regset uml_regsets[] __ro_after_init = { 238 238 [REGSET_GENERAL] = { 239 - .core_note_type = NT_PRSTATUS, 239 + USER_REGSET_NOTE_TYPE(PRSTATUS), 240 240 .n = sizeof(struct user_regs_struct) / sizeof(long), 241 241 .size = sizeof(long), 242 242 .align = sizeof(long), ··· 246 246 #ifdef CONFIG_X86_32 247 247 /* Old FP registers, they are needed in signal frames */ 248 248 [REGSET_FP_LEGACY] = { 249 - .core_note_type = NT_PRFPREG, 249 + USER_REGSET_NOTE_TYPE(PRFPREG), 250 250 .n = sizeof(struct user_i387_ia32_struct) / sizeof(long), 251 251 .size = sizeof(long), 252 252 .align = sizeof(long), ··· 257 257 #endif 258 258 [REGSET_FP] = { 259 259 #ifdef CONFIG_X86_32 260 - .core_note_type = NT_PRXFPREG, 260 + USER_REGSET_NOTE_TYPE(PRXFPREG), 261 261 .n = sizeof(struct user32_fxsr_struct) / sizeof(long), 262 262 #else 263 - .core_note_type = NT_PRFPREG, 263 + USER_REGSET_NOTE_TYPE(PRFPREG), 264 264 .n = sizeof(struct user_i387_struct) / sizeof(long), 265 265 #endif 266 266 .size = sizeof(long), ··· 270 270 .set = generic_fpregs_set, 271 271 }, 272 272 [REGSET_XSTATE] = { 273 - .core_note_type = NT_X86_XSTATE, 273 + USER_REGSET_NOTE_TYPE(X86_XSTATE), 274 274 .size = sizeof(long), 275 275 .align = sizeof(long), 276 276 .active = generic_fpregs_active,