Skip to content

Commit 307035a

Browse files
Dave Martinkees
authored andcommitted
powerpc/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: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Kees Cook <kees@kernel.org> Cc: Akihiko Odaki <akihiko.odaki@daynix.com> Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Link: https://lore.kernel.org/r/20250701135616.29630-16-Dave.Martin@arm.com Signed-off-by: Kees Cook <kees@kernel.org>
1 parent 92acdd8 commit 307035a

1 file changed

Lines changed: 37 additions & 37 deletions

File tree

arch/powerpc/kernel/ptrace/ptrace-view.c

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -568,122 +568,122 @@ static int pkey_set(struct task_struct *target, const struct user_regset *regset
568568

569569
static const struct user_regset native_regsets[] = {
570570
[REGSET_GPR] = {
571-
.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
571+
USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
572572
.size = sizeof(long), .align = sizeof(long),
573573
.regset_get = gpr_get, .set = gpr_set
574574
},
575575
[REGSET_FPR] = {
576-
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
576+
USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
577577
.size = sizeof(double), .align = sizeof(double),
578578
.regset_get = fpr_get, .set = fpr_set
579579
},
580580
#ifdef CONFIG_ALTIVEC
581581
[REGSET_VMX] = {
582-
.core_note_type = NT_PPC_VMX, .n = 34,
582+
USER_REGSET_NOTE_TYPE(PPC_VMX), .n = 34,
583583
.size = sizeof(vector128), .align = sizeof(vector128),
584584
.active = vr_active, .regset_get = vr_get, .set = vr_set
585585
},
586586
#endif
587587
#ifdef CONFIG_VSX
588588
[REGSET_VSX] = {
589-
.core_note_type = NT_PPC_VSX, .n = 32,
589+
USER_REGSET_NOTE_TYPE(PPC_VSX), .n = 32,
590590
.size = sizeof(double), .align = sizeof(double),
591591
.active = vsr_active, .regset_get = vsr_get, .set = vsr_set
592592
},
593593
#endif
594594
#ifdef CONFIG_SPE
595595
[REGSET_SPE] = {
596-
.core_note_type = NT_PPC_SPE, .n = 35,
596+
USER_REGSET_NOTE_TYPE(PPC_SPE), .n = 35,
597597
.size = sizeof(u32), .align = sizeof(u32),
598598
.active = evr_active, .regset_get = evr_get, .set = evr_set
599599
},
600600
#endif
601601
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
602602
[REGSET_TM_CGPR] = {
603-
.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
603+
USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n = ELF_NGREG,
604604
.size = sizeof(long), .align = sizeof(long),
605605
.active = tm_cgpr_active, .regset_get = tm_cgpr_get, .set = tm_cgpr_set
606606
},
607607
[REGSET_TM_CFPR] = {
608-
.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
608+
USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n = ELF_NFPREG,
609609
.size = sizeof(double), .align = sizeof(double),
610610
.active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
611611
},
612612
[REGSET_TM_CVMX] = {
613-
.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
613+
USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n = ELF_NVMX,
614614
.size = sizeof(vector128), .align = sizeof(vector128),
615615
.active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
616616
},
617617
[REGSET_TM_CVSX] = {
618-
.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
618+
USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n = ELF_NVSX,
619619
.size = sizeof(double), .align = sizeof(double),
620620
.active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
621621
},
622622
[REGSET_TM_SPR] = {
623-
.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
623+
USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n = ELF_NTMSPRREG,
624624
.size = sizeof(u64), .align = sizeof(u64),
625625
.active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
626626
},
627627
[REGSET_TM_CTAR] = {
628-
.core_note_type = NT_PPC_TM_CTAR, .n = 1,
628+
USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n = 1,
629629
.size = sizeof(u64), .align = sizeof(u64),
630630
.active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
631631
},
632632
[REGSET_TM_CPPR] = {
633-
.core_note_type = NT_PPC_TM_CPPR, .n = 1,
633+
USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n = 1,
634634
.size = sizeof(u64), .align = sizeof(u64),
635635
.active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
636636
},
637637
[REGSET_TM_CDSCR] = {
638-
.core_note_type = NT_PPC_TM_CDSCR, .n = 1,
638+
USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n = 1,
639639
.size = sizeof(u64), .align = sizeof(u64),
640640
.active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
641641
},
642642
#endif
643643
#ifdef CONFIG_PPC64
644644
[REGSET_PPR] = {
645-
.core_note_type = NT_PPC_PPR, .n = 1,
645+
USER_REGSET_NOTE_TYPE(PPC_PPR), .n = 1,
646646
.size = sizeof(u64), .align = sizeof(u64),
647647
.regset_get = ppr_get, .set = ppr_set
648648
},
649649
[REGSET_DSCR] = {
650-
.core_note_type = NT_PPC_DSCR, .n = 1,
650+
USER_REGSET_NOTE_TYPE(PPC_DSCR), .n = 1,
651651
.size = sizeof(u64), .align = sizeof(u64),
652652
.regset_get = dscr_get, .set = dscr_set
653653
},
654654
#endif
655655
#ifdef CONFIG_PPC_BOOK3S_64
656656
[REGSET_TAR] = {
657-
.core_note_type = NT_PPC_TAR, .n = 1,
657+
USER_REGSET_NOTE_TYPE(PPC_TAR), .n = 1,
658658
.size = sizeof(u64), .align = sizeof(u64),
659659
.regset_get = tar_get, .set = tar_set
660660
},
661661
[REGSET_EBB] = {
662-
.core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
662+
USER_REGSET_NOTE_TYPE(PPC_EBB), .n = ELF_NEBB,
663663
.size = sizeof(u64), .align = sizeof(u64),
664664
.active = ebb_active, .regset_get = ebb_get, .set = ebb_set
665665
},
666666
[REGSET_PMR] = {
667-
.core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
667+
USER_REGSET_NOTE_TYPE(PPC_PMU), .n = ELF_NPMU,
668668
.size = sizeof(u64), .align = sizeof(u64),
669669
.active = pmu_active, .regset_get = pmu_get, .set = pmu_set
670670
},
671671
[REGSET_DEXCR] = {
672-
.core_note_type = NT_PPC_DEXCR, .n = ELF_NDEXCR,
672+
USER_REGSET_NOTE_TYPE(PPC_DEXCR), .n = ELF_NDEXCR,
673673
.size = sizeof(u64), .align = sizeof(u64),
674674
.active = dexcr_active, .regset_get = dexcr_get
675675
},
676676
#ifdef CONFIG_CHECKPOINT_RESTORE
677677
[REGSET_HASHKEYR] = {
678-
.core_note_type = NT_PPC_HASHKEYR, .n = ELF_NHASHKEYR,
678+
USER_REGSET_NOTE_TYPE(PPC_HASHKEYR), .n = ELF_NHASHKEYR,
679679
.size = sizeof(u64), .align = sizeof(u64),
680680
.active = hashkeyr_active, .regset_get = hashkeyr_get, .set = hashkeyr_set
681681
},
682682
#endif
683683
#endif
684684
#ifdef CONFIG_PPC_MEM_KEYS
685685
[REGSET_PKEY] = {
686-
.core_note_type = NT_PPC_PKEY, .n = ELF_NPKEY,
686+
USER_REGSET_NOTE_TYPE(PPC_PKEY), .n = ELF_NPKEY,
687687
.size = sizeof(u64), .align = sizeof(u64),
688688
.active = pkey_active, .regset_get = pkey_get, .set = pkey_set
689689
},
@@ -843,92 +843,92 @@ static int gpr32_set(struct task_struct *target,
843843
*/
844844
static const struct user_regset compat_regsets[] = {
845845
[REGSET_GPR] = {
846-
.core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
846+
USER_REGSET_NOTE_TYPE(PRSTATUS), .n = ELF_NGREG,
847847
.size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
848848
.regset_get = gpr32_get, .set = gpr32_set
849849
},
850850
[REGSET_FPR] = {
851-
.core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
851+
USER_REGSET_NOTE_TYPE(PRFPREG), .n = ELF_NFPREG,
852852
.size = sizeof(double), .align = sizeof(double),
853853
.regset_get = fpr_get, .set = fpr_set
854854
},
855855
#ifdef CONFIG_ALTIVEC
856856
[REGSET_VMX] = {
857-
.core_note_type = NT_PPC_VMX, .n = 34,
857+
USER_REGSET_NOTE_TYPE(PPC_VMX), .n = 34,
858858
.size = sizeof(vector128), .align = sizeof(vector128),
859859
.active = vr_active, .regset_get = vr_get, .set = vr_set
860860
},
861861
#endif
862862
#ifdef CONFIG_SPE
863863
[REGSET_SPE] = {
864-
.core_note_type = NT_PPC_SPE, .n = 35,
864+
USER_REGSET_NOTE_TYPE(PPC_SPE), .n = 35,
865865
.size = sizeof(u32), .align = sizeof(u32),
866866
.active = evr_active, .regset_get = evr_get, .set = evr_set
867867
},
868868
#endif
869869
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
870870
[REGSET_TM_CGPR] = {
871-
.core_note_type = NT_PPC_TM_CGPR, .n = ELF_NGREG,
871+
USER_REGSET_NOTE_TYPE(PPC_TM_CGPR), .n = ELF_NGREG,
872872
.size = sizeof(long), .align = sizeof(long),
873873
.active = tm_cgpr_active,
874874
.regset_get = tm_cgpr32_get, .set = tm_cgpr32_set
875875
},
876876
[REGSET_TM_CFPR] = {
877-
.core_note_type = NT_PPC_TM_CFPR, .n = ELF_NFPREG,
877+
USER_REGSET_NOTE_TYPE(PPC_TM_CFPR), .n = ELF_NFPREG,
878878
.size = sizeof(double), .align = sizeof(double),
879879
.active = tm_cfpr_active, .regset_get = tm_cfpr_get, .set = tm_cfpr_set
880880
},
881881
[REGSET_TM_CVMX] = {
882-
.core_note_type = NT_PPC_TM_CVMX, .n = ELF_NVMX,
882+
USER_REGSET_NOTE_TYPE(PPC_TM_CVMX), .n = ELF_NVMX,
883883
.size = sizeof(vector128), .align = sizeof(vector128),
884884
.active = tm_cvmx_active, .regset_get = tm_cvmx_get, .set = tm_cvmx_set
885885
},
886886
[REGSET_TM_CVSX] = {
887-
.core_note_type = NT_PPC_TM_CVSX, .n = ELF_NVSX,
887+
USER_REGSET_NOTE_TYPE(PPC_TM_CVSX), .n = ELF_NVSX,
888888
.size = sizeof(double), .align = sizeof(double),
889889
.active = tm_cvsx_active, .regset_get = tm_cvsx_get, .set = tm_cvsx_set
890890
},
891891
[REGSET_TM_SPR] = {
892-
.core_note_type = NT_PPC_TM_SPR, .n = ELF_NTMSPRREG,
892+
USER_REGSET_NOTE_TYPE(PPC_TM_SPR), .n = ELF_NTMSPRREG,
893893
.size = sizeof(u64), .align = sizeof(u64),
894894
.active = tm_spr_active, .regset_get = tm_spr_get, .set = tm_spr_set
895895
},
896896
[REGSET_TM_CTAR] = {
897-
.core_note_type = NT_PPC_TM_CTAR, .n = 1,
897+
USER_REGSET_NOTE_TYPE(PPC_TM_CTAR), .n = 1,
898898
.size = sizeof(u64), .align = sizeof(u64),
899899
.active = tm_tar_active, .regset_get = tm_tar_get, .set = tm_tar_set
900900
},
901901
[REGSET_TM_CPPR] = {
902-
.core_note_type = NT_PPC_TM_CPPR, .n = 1,
902+
USER_REGSET_NOTE_TYPE(PPC_TM_CPPR), .n = 1,
903903
.size = sizeof(u64), .align = sizeof(u64),
904904
.active = tm_ppr_active, .regset_get = tm_ppr_get, .set = tm_ppr_set
905905
},
906906
[REGSET_TM_CDSCR] = {
907-
.core_note_type = NT_PPC_TM_CDSCR, .n = 1,
907+
USER_REGSET_NOTE_TYPE(PPC_TM_CDSCR), .n = 1,
908908
.size = sizeof(u64), .align = sizeof(u64),
909909
.active = tm_dscr_active, .regset_get = tm_dscr_get, .set = tm_dscr_set
910910
},
911911
#endif
912912
#ifdef CONFIG_PPC64
913913
[REGSET_PPR] = {
914-
.core_note_type = NT_PPC_PPR, .n = 1,
914+
USER_REGSET_NOTE_TYPE(PPC_PPR), .n = 1,
915915
.size = sizeof(u64), .align = sizeof(u64),
916916
.regset_get = ppr_get, .set = ppr_set
917917
},
918918
[REGSET_DSCR] = {
919-
.core_note_type = NT_PPC_DSCR, .n = 1,
919+
USER_REGSET_NOTE_TYPE(PPC_DSCR), .n = 1,
920920
.size = sizeof(u64), .align = sizeof(u64),
921921
.regset_get = dscr_get, .set = dscr_set
922922
},
923923
#endif
924924
#ifdef CONFIG_PPC_BOOK3S_64
925925
[REGSET_TAR] = {
926-
.core_note_type = NT_PPC_TAR, .n = 1,
926+
USER_REGSET_NOTE_TYPE(PPC_TAR), .n = 1,
927927
.size = sizeof(u64), .align = sizeof(u64),
928928
.regset_get = tar_get, .set = tar_set
929929
},
930930
[REGSET_EBB] = {
931-
.core_note_type = NT_PPC_EBB, .n = ELF_NEBB,
931+
USER_REGSET_NOTE_TYPE(PPC_EBB), .n = ELF_NEBB,
932932
.size = sizeof(u64), .align = sizeof(u64),
933933
.active = ebb_active, .regset_get = ebb_get, .set = ebb_set
934934
},

0 commit comments

Comments
 (0)