]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
authorDave Martin <Dave.Martin@arm.com>
Tue, 1 Jul 2025 13:56:09 +0000 (14:56 +0100)
committerKees Cook <kees@kernel.org>
Tue, 15 Jul 2025 05:27:48 +0000 (22:27 -0700)
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>
arch/riscv/kernel/ptrace.c

index ea67e9fb7a583683b922fe2c017ea61f3bc848db..8e86305831ea4f356d9fe4968d66140b5a0ccb8b 100644 (file)
@@ -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),