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

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

authored by

Dave Martin and committed by
Kees Cook
c9502cc7 307035ac

+6 -6
+6 -6
arch/riscv/kernel/ptrace.c
··· 186 186 187 187 static const struct user_regset riscv_user_regset[] = { 188 188 [REGSET_X] = { 189 - .core_note_type = NT_PRSTATUS, 189 + USER_REGSET_NOTE_TYPE(PRSTATUS), 190 190 .n = ELF_NGREG, 191 191 .size = sizeof(elf_greg_t), 192 192 .align = sizeof(elf_greg_t), ··· 195 195 }, 196 196 #ifdef CONFIG_FPU 197 197 [REGSET_F] = { 198 - .core_note_type = NT_PRFPREG, 198 + USER_REGSET_NOTE_TYPE(PRFPREG), 199 199 .n = ELF_NFPREG, 200 200 .size = sizeof(elf_fpreg_t), 201 201 .align = sizeof(elf_fpreg_t), ··· 205 205 #endif 206 206 #ifdef CONFIG_RISCV_ISA_V 207 207 [REGSET_V] = { 208 - .core_note_type = NT_RISCV_VECTOR, 208 + USER_REGSET_NOTE_TYPE(RISCV_VECTOR), 209 209 .align = 16, 210 210 .n = ((32 * RISCV_MAX_VLENB) + 211 211 sizeof(struct __riscv_v_regset_state)) / sizeof(__u32), ··· 216 216 #endif 217 217 #ifdef CONFIG_RISCV_ISA_SUPM 218 218 [REGSET_TAGGED_ADDR_CTRL] = { 219 - .core_note_type = NT_RISCV_TAGGED_ADDR_CTRL, 219 + USER_REGSET_NOTE_TYPE(RISCV_TAGGED_ADDR_CTRL), 220 220 .n = 1, 221 221 .size = sizeof(long), 222 222 .align = sizeof(long), ··· 380 380 381 381 static const struct user_regset compat_riscv_user_regset[] = { 382 382 [REGSET_X] = { 383 - .core_note_type = NT_PRSTATUS, 383 + USER_REGSET_NOTE_TYPE(PRSTATUS), 384 384 .n = ELF_NGREG, 385 385 .size = sizeof(compat_elf_greg_t), 386 386 .align = sizeof(compat_elf_greg_t), ··· 389 389 }, 390 390 #ifdef CONFIG_FPU 391 391 [REGSET_F] = { 392 - .core_note_type = NT_PRFPREG, 392 + USER_REGSET_NOTE_TYPE(PRFPREG), 393 393 .n = ELF_NFPREG, 394 394 .size = sizeof(elf_fpreg_t), 395 395 .align = sizeof(elf_fpreg_t),