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

s390/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: 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>

authored by

Dave Martin and committed by
Kees Cook
d6a883cb c9502cc7

+21 -21
+21 -21
arch/s390/kernel/ptrace.c
··· 1209 1209 1210 1210 static const struct user_regset s390_regsets[] = { 1211 1211 { 1212 - .core_note_type = NT_PRSTATUS, 1212 + USER_REGSET_NOTE_TYPE(PRSTATUS), 1213 1213 .n = sizeof(s390_regs) / sizeof(long), 1214 1214 .size = sizeof(long), 1215 1215 .align = sizeof(long), ··· 1217 1217 .set = s390_regs_set, 1218 1218 }, 1219 1219 { 1220 - .core_note_type = NT_PRFPREG, 1220 + USER_REGSET_NOTE_TYPE(PRFPREG), 1221 1221 .n = sizeof(s390_fp_regs) / sizeof(long), 1222 1222 .size = sizeof(long), 1223 1223 .align = sizeof(long), ··· 1225 1225 .set = s390_fpregs_set, 1226 1226 }, 1227 1227 { 1228 - .core_note_type = NT_S390_SYSTEM_CALL, 1228 + USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL), 1229 1229 .n = 1, 1230 1230 .size = sizeof(unsigned int), 1231 1231 .align = sizeof(unsigned int), ··· 1233 1233 .set = s390_system_call_set, 1234 1234 }, 1235 1235 { 1236 - .core_note_type = NT_S390_LAST_BREAK, 1236 + USER_REGSET_NOTE_TYPE(S390_LAST_BREAK), 1237 1237 .n = 1, 1238 1238 .size = sizeof(long), 1239 1239 .align = sizeof(long), ··· 1241 1241 .set = s390_last_break_set, 1242 1242 }, 1243 1243 { 1244 - .core_note_type = NT_S390_TDB, 1244 + USER_REGSET_NOTE_TYPE(S390_TDB), 1245 1245 .n = 1, 1246 1246 .size = 256, 1247 1247 .align = 1, ··· 1249 1249 .set = s390_tdb_set, 1250 1250 }, 1251 1251 { 1252 - .core_note_type = NT_S390_VXRS_LOW, 1252 + USER_REGSET_NOTE_TYPE(S390_VXRS_LOW), 1253 1253 .n = __NUM_VXRS_LOW, 1254 1254 .size = sizeof(__u64), 1255 1255 .align = sizeof(__u64), ··· 1257 1257 .set = s390_vxrs_low_set, 1258 1258 }, 1259 1259 { 1260 - .core_note_type = NT_S390_VXRS_HIGH, 1260 + USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH), 1261 1261 .n = __NUM_VXRS_HIGH, 1262 1262 .size = sizeof(__vector128), 1263 1263 .align = sizeof(__vector128), ··· 1265 1265 .set = s390_vxrs_high_set, 1266 1266 }, 1267 1267 { 1268 - .core_note_type = NT_S390_GS_CB, 1268 + USER_REGSET_NOTE_TYPE(S390_GS_CB), 1269 1269 .n = sizeof(struct gs_cb) / sizeof(__u64), 1270 1270 .size = sizeof(__u64), 1271 1271 .align = sizeof(__u64), ··· 1273 1273 .set = s390_gs_cb_set, 1274 1274 }, 1275 1275 { 1276 - .core_note_type = NT_S390_GS_BC, 1276 + USER_REGSET_NOTE_TYPE(S390_GS_BC), 1277 1277 .n = sizeof(struct gs_cb) / sizeof(__u64), 1278 1278 .size = sizeof(__u64), 1279 1279 .align = sizeof(__u64), ··· 1281 1281 .set = s390_gs_bc_set, 1282 1282 }, 1283 1283 { 1284 - .core_note_type = NT_S390_RI_CB, 1284 + USER_REGSET_NOTE_TYPE(S390_RI_CB), 1285 1285 .n = sizeof(struct runtime_instr_cb) / sizeof(__u64), 1286 1286 .size = sizeof(__u64), 1287 1287 .align = sizeof(__u64), ··· 1413 1413 1414 1414 static const struct user_regset s390_compat_regsets[] = { 1415 1415 { 1416 - .core_note_type = NT_PRSTATUS, 1416 + USER_REGSET_NOTE_TYPE(PRSTATUS), 1417 1417 .n = sizeof(s390_compat_regs) / sizeof(compat_long_t), 1418 1418 .size = sizeof(compat_long_t), 1419 1419 .align = sizeof(compat_long_t), ··· 1421 1421 .set = s390_compat_regs_set, 1422 1422 }, 1423 1423 { 1424 - .core_note_type = NT_PRFPREG, 1424 + USER_REGSET_NOTE_TYPE(PRFPREG), 1425 1425 .n = sizeof(s390_fp_regs) / sizeof(compat_long_t), 1426 1426 .size = sizeof(compat_long_t), 1427 1427 .align = sizeof(compat_long_t), ··· 1429 1429 .set = s390_fpregs_set, 1430 1430 }, 1431 1431 { 1432 - .core_note_type = NT_S390_SYSTEM_CALL, 1432 + USER_REGSET_NOTE_TYPE(S390_SYSTEM_CALL), 1433 1433 .n = 1, 1434 1434 .size = sizeof(compat_uint_t), 1435 1435 .align = sizeof(compat_uint_t), ··· 1437 1437 .set = s390_system_call_set, 1438 1438 }, 1439 1439 { 1440 - .core_note_type = NT_S390_LAST_BREAK, 1440 + USER_REGSET_NOTE_TYPE(S390_LAST_BREAK), 1441 1441 .n = 1, 1442 1442 .size = sizeof(long), 1443 1443 .align = sizeof(long), ··· 1445 1445 .set = s390_compat_last_break_set, 1446 1446 }, 1447 1447 { 1448 - .core_note_type = NT_S390_TDB, 1448 + USER_REGSET_NOTE_TYPE(S390_TDB), 1449 1449 .n = 1, 1450 1450 .size = 256, 1451 1451 .align = 1, ··· 1453 1453 .set = s390_tdb_set, 1454 1454 }, 1455 1455 { 1456 - .core_note_type = NT_S390_VXRS_LOW, 1456 + USER_REGSET_NOTE_TYPE(S390_VXRS_LOW), 1457 1457 .n = __NUM_VXRS_LOW, 1458 1458 .size = sizeof(__u64), 1459 1459 .align = sizeof(__u64), ··· 1461 1461 .set = s390_vxrs_low_set, 1462 1462 }, 1463 1463 { 1464 - .core_note_type = NT_S390_VXRS_HIGH, 1464 + USER_REGSET_NOTE_TYPE(S390_VXRS_HIGH), 1465 1465 .n = __NUM_VXRS_HIGH, 1466 1466 .size = sizeof(__vector128), 1467 1467 .align = sizeof(__vector128), ··· 1469 1469 .set = s390_vxrs_high_set, 1470 1470 }, 1471 1471 { 1472 - .core_note_type = NT_S390_HIGH_GPRS, 1472 + USER_REGSET_NOTE_TYPE(S390_HIGH_GPRS), 1473 1473 .n = sizeof(s390_compat_regs_high) / sizeof(compat_long_t), 1474 1474 .size = sizeof(compat_long_t), 1475 1475 .align = sizeof(compat_long_t), ··· 1477 1477 .set = s390_compat_regs_high_set, 1478 1478 }, 1479 1479 { 1480 - .core_note_type = NT_S390_GS_CB, 1480 + USER_REGSET_NOTE_TYPE(S390_GS_CB), 1481 1481 .n = sizeof(struct gs_cb) / sizeof(__u64), 1482 1482 .size = sizeof(__u64), 1483 1483 .align = sizeof(__u64), ··· 1485 1485 .set = s390_gs_cb_set, 1486 1486 }, 1487 1487 { 1488 - .core_note_type = NT_S390_GS_BC, 1488 + USER_REGSET_NOTE_TYPE(S390_GS_BC), 1489 1489 .n = sizeof(struct gs_cb) / sizeof(__u64), 1490 1490 .size = sizeof(__u64), 1491 1491 .align = sizeof(__u64), ··· 1493 1493 .set = s390_gs_bc_set, 1494 1494 }, 1495 1495 { 1496 - .core_note_type = NT_S390_RI_CB, 1496 + USER_REGSET_NOTE_TYPE(S390_RI_CB), 1497 1497 .n = sizeof(struct runtime_instr_cb) / sizeof(__u64), 1498 1498 .size = sizeof(__u64), 1499 1499 .align = sizeof(__u64),