Skip to content

Commit 3de0414

Browse files
Dave Martinkees
authored andcommitted
x86/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 Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Kees Cook <kees@kernel.org> Cc: Akihiko Odaki <akihiko.odaki@daynix.com> Cc: x86@kernel.org Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Link: https://lore.kernel.org/r/20250701135616.29630-21-Dave.Martin@arm.com Signed-off-by: Kees Cook <kees@kernel.org>
1 parent c9d4cb2 commit 3de0414

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

arch/x86/kernel/ptrace.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,15 +1236,15 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
12361236

12371237
static struct user_regset x86_64_regsets[] __ro_after_init = {
12381238
[REGSET64_GENERAL] = {
1239-
.core_note_type = NT_PRSTATUS,
1239+
USER_REGSET_NOTE_TYPE(PRSTATUS),
12401240
.n = sizeof(struct user_regs_struct) / sizeof(long),
12411241
.size = sizeof(long),
12421242
.align = sizeof(long),
12431243
.regset_get = genregs_get,
12441244
.set = genregs_set
12451245
},
12461246
[REGSET64_FP] = {
1247-
.core_note_type = NT_PRFPREG,
1247+
USER_REGSET_NOTE_TYPE(PRFPREG),
12481248
.n = sizeof(struct fxregs_state) / sizeof(long),
12491249
.size = sizeof(long),
12501250
.align = sizeof(long),
@@ -1253,15 +1253,15 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
12531253
.set = xfpregs_set
12541254
},
12551255
[REGSET64_XSTATE] = {
1256-
.core_note_type = NT_X86_XSTATE,
1256+
USER_REGSET_NOTE_TYPE(X86_XSTATE),
12571257
.size = sizeof(u64),
12581258
.align = sizeof(u64),
12591259
.active = xstateregs_active,
12601260
.regset_get = xstateregs_get,
12611261
.set = xstateregs_set
12621262
},
12631263
[REGSET64_IOPERM] = {
1264-
.core_note_type = NT_386_IOPERM,
1264+
USER_REGSET_NOTE_TYPE(386_IOPERM),
12651265
.n = IO_BITMAP_LONGS,
12661266
.size = sizeof(long),
12671267
.align = sizeof(long),
@@ -1270,7 +1270,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = {
12701270
},
12711271
#ifdef CONFIG_X86_USER_SHADOW_STACK
12721272
[REGSET64_SSP] = {
1273-
.core_note_type = NT_X86_SHSTK,
1273+
USER_REGSET_NOTE_TYPE(X86_SHSTK),
12741274
.n = 1,
12751275
.size = sizeof(u64),
12761276
.align = sizeof(u64),
@@ -1297,15 +1297,15 @@ static const struct user_regset_view user_x86_64_view = {
12971297
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
12981298
static struct user_regset x86_32_regsets[] __ro_after_init = {
12991299
[REGSET32_GENERAL] = {
1300-
.core_note_type = NT_PRSTATUS,
1300+
USER_REGSET_NOTE_TYPE(PRSTATUS),
13011301
.n = sizeof(struct user_regs_struct32) / sizeof(u32),
13021302
.size = sizeof(u32),
13031303
.align = sizeof(u32),
13041304
.regset_get = genregs32_get,
13051305
.set = genregs32_set
13061306
},
13071307
[REGSET32_FP] = {
1308-
.core_note_type = NT_PRFPREG,
1308+
USER_REGSET_NOTE_TYPE(PRFPREG),
13091309
.n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
13101310
.size = sizeof(u32),
13111311
.align = sizeof(u32),
@@ -1314,7 +1314,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
13141314
.set = fpregs_set
13151315
},
13161316
[REGSET32_XFP] = {
1317-
.core_note_type = NT_PRXFPREG,
1317+
USER_REGSET_NOTE_TYPE(PRXFPREG),
13181318
.n = sizeof(struct fxregs_state) / sizeof(u32),
13191319
.size = sizeof(u32),
13201320
.align = sizeof(u32),
@@ -1323,15 +1323,15 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
13231323
.set = xfpregs_set
13241324
},
13251325
[REGSET32_XSTATE] = {
1326-
.core_note_type = NT_X86_XSTATE,
1326+
USER_REGSET_NOTE_TYPE(X86_XSTATE),
13271327
.size = sizeof(u64),
13281328
.align = sizeof(u64),
13291329
.active = xstateregs_active,
13301330
.regset_get = xstateregs_get,
13311331
.set = xstateregs_set
13321332
},
13331333
[REGSET32_TLS] = {
1334-
.core_note_type = NT_386_TLS,
1334+
USER_REGSET_NOTE_TYPE(386_TLS),
13351335
.n = GDT_ENTRY_TLS_ENTRIES,
13361336
.bias = GDT_ENTRY_TLS_MIN,
13371337
.size = sizeof(struct user_desc),
@@ -1341,7 +1341,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = {
13411341
.set = regset_tls_set
13421342
},
13431343
[REGSET32_IOPERM] = {
1344-
.core_note_type = NT_386_IOPERM,
1344+
USER_REGSET_NOTE_TYPE(386_IOPERM),
13451345
.n = IO_BITMAP_BYTES / sizeof(u32),
13461346
.size = sizeof(u32),
13471347
.align = sizeof(u32),

0 commit comments

Comments
 (0)