]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names
authorDave Martin <Dave.Martin@arm.com>
Tue, 1 Jul 2025 13:56:10 +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: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: linux-s390@vger.kernel.org
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/20250701135616.29630-18-Dave.Martin@arm.com
Signed-off-by: Kees Cook <kees@kernel.org>
arch/s390/kernel/ptrace.c

index e1240f6b29fad1e35e2f83fbaa4196b5ad823b07..494216c4b4f3d33656665585f5a4bef0eec311a2 100644 (file)
@@ -1209,7 +1209,7 @@ static int s390_runtime_instr_set(struct task_struct *target,
 
 static const struct user_regset s390_regsets[] = {
        {
-               .core_note_type = NT_PRSTATUS,
+               USER_REGSET_NOTE_TYPE(PRSTATUS),
                .n = sizeof(s390_regs) / sizeof(long),
                .size = sizeof(long),
                .align = sizeof(long),
@@ -1217,7 +1217,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_regs_set,
        },
        {
-               .core_note_type = NT_PRFPREG,
+               USER_REGSET_NOTE_TYPE(PRFPREG),
                .n = sizeof(s390_fp_regs) / sizeof(long),
                .size = sizeof(long),
                .align = sizeof(long),
@@ -1225,7 +1225,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_fpregs_set,
        },
        {
-               .core_note_type = NT_S390_SYSTEM_CALL,
+               USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL),
                .n = 1,
                .size = sizeof(unsigned int),
                .align = sizeof(unsigned int),
@@ -1233,7 +1233,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_system_call_set,
        },
        {
-               .core_note_type = NT_S390_LAST_BREAK,
+               USER_REGSET_NOTE_TYPE(S390_LAST_BREAK),
                .n = 1,
                .size = sizeof(long),
                .align = sizeof(long),
@@ -1241,7 +1241,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_last_break_set,
        },
        {
-               .core_note_type = NT_S390_TDB,
+               USER_REGSET_NOTE_TYPE(S390_TDB),
                .n = 1,
                .size = 256,
                .align = 1,
@@ -1249,7 +1249,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_tdb_set,
        },
        {
-               .core_note_type = NT_S390_VXRS_LOW,
+               USER_REGSET_NOTE_TYPE(S390_VXRS_LOW),
                .n = __NUM_VXRS_LOW,
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1257,7 +1257,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_vxrs_low_set,
        },
        {
-               .core_note_type = NT_S390_VXRS_HIGH,
+               USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH),
                .n = __NUM_VXRS_HIGH,
                .size = sizeof(__vector128),
                .align = sizeof(__vector128),
@@ -1265,7 +1265,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_vxrs_high_set,
        },
        {
-               .core_note_type = NT_S390_GS_CB,
+               USER_REGSET_NOTE_TYPE(S390_GS_CB),
                .n = sizeof(struct gs_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1273,7 +1273,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_gs_cb_set,
        },
        {
-               .core_note_type = NT_S390_GS_BC,
+               USER_REGSET_NOTE_TYPE(S390_GS_BC),
                .n = sizeof(struct gs_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1281,7 +1281,7 @@ static const struct user_regset s390_regsets[] = {
                .set = s390_gs_bc_set,
        },
        {
-               .core_note_type = NT_S390_RI_CB,
+               USER_REGSET_NOTE_TYPE(S390_RI_CB),
                .n = sizeof(struct runtime_instr_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1413,7 +1413,7 @@ static int s390_compat_last_break_set(struct task_struct *target,
 
 static const struct user_regset s390_compat_regsets[] = {
        {
-               .core_note_type = NT_PRSTATUS,
+               USER_REGSET_NOTE_TYPE(PRSTATUS),
                .n = sizeof(s390_compat_regs) / sizeof(compat_long_t),
                .size = sizeof(compat_long_t),
                .align = sizeof(compat_long_t),
@@ -1421,7 +1421,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_compat_regs_set,
        },
        {
-               .core_note_type = NT_PRFPREG,
+               USER_REGSET_NOTE_TYPE(PRFPREG),
                .n = sizeof(s390_fp_regs) / sizeof(compat_long_t),
                .size = sizeof(compat_long_t),
                .align = sizeof(compat_long_t),
@@ -1429,7 +1429,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_fpregs_set,
        },
        {
-               .core_note_type = NT_S390_SYSTEM_CALL,
+               USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL),
                .n = 1,
                .size = sizeof(compat_uint_t),
                .align = sizeof(compat_uint_t),
@@ -1437,7 +1437,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_system_call_set,
        },
        {
-               .core_note_type = NT_S390_LAST_BREAK,
+               USER_REGSET_NOTE_TYPE(S390_LAST_BREAK),
                .n = 1,
                .size = sizeof(long),
                .align = sizeof(long),
@@ -1445,7 +1445,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_compat_last_break_set,
        },
        {
-               .core_note_type = NT_S390_TDB,
+               USER_REGSET_NOTE_TYPE(S390_TDB),
                .n = 1,
                .size = 256,
                .align = 1,
@@ -1453,7 +1453,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_tdb_set,
        },
        {
-               .core_note_type = NT_S390_VXRS_LOW,
+               USER_REGSET_NOTE_TYPE(S390_VXRS_LOW),
                .n = __NUM_VXRS_LOW,
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1461,7 +1461,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_vxrs_low_set,
        },
        {
-               .core_note_type = NT_S390_VXRS_HIGH,
+               USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH),
                .n = __NUM_VXRS_HIGH,
                .size = sizeof(__vector128),
                .align = sizeof(__vector128),
@@ -1469,7 +1469,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_vxrs_high_set,
        },
        {
-               .core_note_type = NT_S390_HIGH_GPRS,
+               USER_REGSET_NOTE_TYPE(S390_HIGH_GPRS),
                .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t),
                .size = sizeof(compat_long_t),
                .align = sizeof(compat_long_t),
@@ -1477,7 +1477,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_compat_regs_high_set,
        },
        {
-               .core_note_type = NT_S390_GS_CB,
+               USER_REGSET_NOTE_TYPE(S390_GS_CB),
                .n = sizeof(struct gs_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1485,7 +1485,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_gs_cb_set,
        },
        {
-               .core_note_type = NT_S390_GS_BC,
+               USER_REGSET_NOTE_TYPE(S390_GS_BC),
                .n = sizeof(struct gs_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),
@@ -1493,7 +1493,7 @@ static const struct user_regset s390_compat_regsets[] = {
                .set = s390_gs_bc_set,
        },
        {
-               .core_note_type = NT_S390_RI_CB,
+               USER_REGSET_NOTE_TYPE(S390_RI_CB),
                .n = sizeof(struct runtime_instr_cb) / sizeof(__u64),
                .size = sizeof(__u64),
                .align = sizeof(__u64),