]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
authorDave Martin <Dave.Martin@arm.com>
Tue, 1 Jul 2025 13:56:04 +0000 (14:56 +0100)
committerKees Cook <kees@kernel.org>
Tue, 15 Jul 2025 05:27:47 +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: 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
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20250701135616.29630-12-Dave.Martin@arm.com
Signed-off-by: Kees Cook <kees@kernel.org>
arch/mips/kernel/ptrace.c

index b890d64d352ca2daf4fcafce764afec6110f7bb0..3f4c94c8812417f51f0c866cb949120282865e7a 100644 (file)
@@ -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,