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

MIPS: 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: 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>

authored by

Dave Martin and committed by
Kees Cook
18bd88fa e572168e

+10 -10
+10 -10
arch/mips/kernel/ptrace.c
··· 935 935 936 936 static const struct user_regset mips_regsets[] = { 937 937 [REGSET_GPR] = { 938 - .core_note_type = NT_PRSTATUS, 938 + USER_REGSET_NOTE_TYPE(PRSTATUS), 939 939 .n = ELF_NGREG, 940 940 .size = sizeof(unsigned int), 941 941 .align = sizeof(unsigned int), ··· 943 943 .set = gpr32_set, 944 944 }, 945 945 [REGSET_DSP] = { 946 - .core_note_type = NT_MIPS_DSP, 946 + USER_REGSET_NOTE_TYPE(MIPS_DSP), 947 947 .n = NUM_DSP_REGS + 1, 948 948 .size = sizeof(u32), 949 949 .align = sizeof(u32), ··· 953 953 }, 954 954 #ifdef CONFIG_MIPS_FP_SUPPORT 955 955 [REGSET_FPR] = { 956 - .core_note_type = NT_PRFPREG, 956 + USER_REGSET_NOTE_TYPE(PRFPREG), 957 957 .n = ELF_NFPREG, 958 958 .size = sizeof(elf_fpreg_t), 959 959 .align = sizeof(elf_fpreg_t), ··· 961 961 .set = fpr_set, 962 962 }, 963 963 [REGSET_FP_MODE] = { 964 - .core_note_type = NT_MIPS_FP_MODE, 964 + USER_REGSET_NOTE_TYPE(MIPS_FP_MODE), 965 965 .n = 1, 966 966 .size = sizeof(int), 967 967 .align = sizeof(int), ··· 971 971 #endif 972 972 #ifdef CONFIG_CPU_HAS_MSA 973 973 [REGSET_MSA] = { 974 - .core_note_type = NT_MIPS_MSA, 974 + USER_REGSET_NOTE_TYPE(MIPS_MSA), 975 975 .n = NUM_FPU_REGS + 1, 976 976 .size = 16, 977 977 .align = 16, ··· 995 995 996 996 static const struct user_regset mips64_regsets[] = { 997 997 [REGSET_GPR] = { 998 - .core_note_type = NT_PRSTATUS, 998 + USER_REGSET_NOTE_TYPE(PRSTATUS), 999 999 .n = ELF_NGREG, 1000 1000 .size = sizeof(unsigned long), 1001 1001 .align = sizeof(unsigned long), ··· 1003 1003 .set = gpr64_set, 1004 1004 }, 1005 1005 [REGSET_DSP] = { 1006 - .core_note_type = NT_MIPS_DSP, 1006 + USER_REGSET_NOTE_TYPE(MIPS_DSP), 1007 1007 .n = NUM_DSP_REGS + 1, 1008 1008 .size = sizeof(u64), 1009 1009 .align = sizeof(u64), ··· 1013 1013 }, 1014 1014 #ifdef CONFIG_MIPS_FP_SUPPORT 1015 1015 [REGSET_FP_MODE] = { 1016 - .core_note_type = NT_MIPS_FP_MODE, 1016 + USER_REGSET_NOTE_TYPE(MIPS_FP_MODE), 1017 1017 .n = 1, 1018 1018 .size = sizeof(int), 1019 1019 .align = sizeof(int), ··· 1021 1021 .set = fp_mode_set, 1022 1022 }, 1023 1023 [REGSET_FPR] = { 1024 - .core_note_type = NT_PRFPREG, 1024 + USER_REGSET_NOTE_TYPE(PRFPREG), 1025 1025 .n = ELF_NFPREG, 1026 1026 .size = sizeof(elf_fpreg_t), 1027 1027 .align = sizeof(elf_fpreg_t), ··· 1031 1031 #endif 1032 1032 #ifdef CONFIG_CPU_HAS_MSA 1033 1033 [REGSET_MSA] = { 1034 - .core_note_type = NT_MIPS_MSA, 1034 + USER_REGSET_NOTE_TYPE(MIPS_MSA), 1035 1035 .n = NUM_FPU_REGS + 1, 1036 1036 .size = 16, 1037 1037 .align = 16,