Skip to content

Commit d900c4c

Browse files
committed
Merge tag 'execve-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull execve updates from Kees Cook: - Introduce regular REGSET note macros arch-wide (Dave Martin) - Remove arbitrary 4K limitation of program header size (Yin Fengwei) - Reorder function qualifiers for copy_clone_args_from_user() (Dishank Jogi) * tag 'execve-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (25 commits) fork: reorder function qualifiers for copy_clone_args_from_user binfmt_elf: remove the 4k limitation of program header size binfmt_elf: Warn on missing or suspicious regset note names xtensa: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names um: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names x86/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names sparc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names sh: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names s390/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names riscv: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names powerpc/ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names parisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names nios2: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names MIPS: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names m68k: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names LoongArch: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names hexagon: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names csky: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names arm64: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names ...
2 parents ced1b9e + 7f71195 commit d900c4c

24 files changed

Lines changed: 196 additions & 175 deletions

File tree

arch/arc/kernel/ptrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ enum arc_getset {
284284

285285
static const struct user_regset arc_regsets[] = {
286286
[REGSET_CMN] = {
287-
.core_note_type = NT_PRSTATUS,
287+
USER_REGSET_NOTE_TYPE(PRSTATUS),
288288
.n = ELF_NGREG,
289289
.size = sizeof(unsigned long),
290290
.align = sizeof(unsigned long),
@@ -293,7 +293,7 @@ static const struct user_regset arc_regsets[] = {
293293
},
294294
#ifdef CONFIG_ISA_ARCV2
295295
[REGSET_ARCV2] = {
296-
.core_note_type = NT_ARC_V2,
296+
USER_REGSET_NOTE_TYPE(ARC_V2),
297297
.n = ELF_ARCV2REG,
298298
.size = sizeof(unsigned long),
299299
.align = sizeof(unsigned long),

arch/arm/kernel/ptrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ enum arm_regset {
677677

678678
static const struct user_regset arm_regsets[] = {
679679
[REGSET_GPR] = {
680-
.core_note_type = NT_PRSTATUS,
680+
USER_REGSET_NOTE_TYPE(PRSTATUS),
681681
.n = ELF_NGREG,
682682
.size = sizeof(u32),
683683
.align = sizeof(u32),
@@ -689,7 +689,7 @@ static const struct user_regset arm_regsets[] = {
689689
* For the FPA regs in fpstate, the real fields are a mixture
690690
* of sizes, so pretend that the registers are word-sized:
691691
*/
692-
.core_note_type = NT_PRFPREG,
692+
USER_REGSET_NOTE_TYPE(PRFPREG),
693693
.n = sizeof(struct user_fp) / sizeof(u32),
694694
.size = sizeof(u32),
695695
.align = sizeof(u32),
@@ -702,7 +702,7 @@ static const struct user_regset arm_regsets[] = {
702702
* Pretend that the VFP regs are word-sized, since the FPSCR is
703703
* a single word dangling at the end of struct user_vfp:
704704
*/
705-
.core_note_type = NT_ARM_VFP,
705+
USER_REGSET_NOTE_TYPE(ARM_VFP),
706706
.n = ARM_VFPREGS_SIZE / sizeof(u32),
707707
.size = sizeof(u32),
708708
.align = sizeof(u32),

arch/arm64/kernel/ptrace.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,15 +1586,15 @@ enum aarch64_regset {
15861586

15871587
static const struct user_regset aarch64_regsets[] = {
15881588
[REGSET_GPR] = {
1589-
.core_note_type = NT_PRSTATUS,
1589+
USER_REGSET_NOTE_TYPE(PRSTATUS),
15901590
.n = sizeof(struct user_pt_regs) / sizeof(u64),
15911591
.size = sizeof(u64),
15921592
.align = sizeof(u64),
15931593
.regset_get = gpr_get,
15941594
.set = gpr_set
15951595
},
15961596
[REGSET_FPR] = {
1597-
.core_note_type = NT_PRFPREG,
1597+
USER_REGSET_NOTE_TYPE(PRFPREG),
15981598
.n = sizeof(struct user_fpsimd_state) / sizeof(u32),
15991599
/*
16001600
* We pretend we have 32-bit registers because the fpsr and
@@ -1607,7 +1607,7 @@ static const struct user_regset aarch64_regsets[] = {
16071607
.set = fpr_set
16081608
},
16091609
[REGSET_TLS] = {
1610-
.core_note_type = NT_ARM_TLS,
1610+
USER_REGSET_NOTE_TYPE(ARM_TLS),
16111611
.n = 2,
16121612
.size = sizeof(void *),
16131613
.align = sizeof(void *),
@@ -1616,15 +1616,15 @@ static const struct user_regset aarch64_regsets[] = {
16161616
},
16171617
#ifdef CONFIG_HAVE_HW_BREAKPOINT
16181618
[REGSET_HW_BREAK] = {
1619-
.core_note_type = NT_ARM_HW_BREAK,
1619+
USER_REGSET_NOTE_TYPE(ARM_HW_BREAK),
16201620
.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
16211621
.size = sizeof(u32),
16221622
.align = sizeof(u32),
16231623
.regset_get = hw_break_get,
16241624
.set = hw_break_set,
16251625
},
16261626
[REGSET_HW_WATCH] = {
1627-
.core_note_type = NT_ARM_HW_WATCH,
1627+
USER_REGSET_NOTE_TYPE(ARM_HW_WATCH),
16281628
.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
16291629
.size = sizeof(u32),
16301630
.align = sizeof(u32),
@@ -1633,15 +1633,15 @@ static const struct user_regset aarch64_regsets[] = {
16331633
},
16341634
#endif
16351635
[REGSET_SYSTEM_CALL] = {
1636-
.core_note_type = NT_ARM_SYSTEM_CALL,
1636+
USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL),
16371637
.n = 1,
16381638
.size = sizeof(int),
16391639
.align = sizeof(int),
16401640
.regset_get = system_call_get,
16411641
.set = system_call_set,
16421642
},
16431643
[REGSET_FPMR] = {
1644-
.core_note_type = NT_ARM_FPMR,
1644+
USER_REGSET_NOTE_TYPE(ARM_FPMR),
16451645
.n = 1,
16461646
.size = sizeof(u64),
16471647
.align = sizeof(u64),
@@ -1650,7 +1650,7 @@ static const struct user_regset aarch64_regsets[] = {
16501650
},
16511651
#ifdef CONFIG_ARM64_SVE
16521652
[REGSET_SVE] = { /* Scalable Vector Extension */
1653-
.core_note_type = NT_ARM_SVE,
1653+
USER_REGSET_NOTE_TYPE(ARM_SVE),
16541654
.n = DIV_ROUND_UP(SVE_PT_SIZE(ARCH_SVE_VQ_MAX,
16551655
SVE_PT_REGS_SVE),
16561656
SVE_VQ_BYTES),
@@ -1662,7 +1662,7 @@ static const struct user_regset aarch64_regsets[] = {
16621662
#endif
16631663
#ifdef CONFIG_ARM64_SME
16641664
[REGSET_SSVE] = { /* Streaming mode SVE */
1665-
.core_note_type = NT_ARM_SSVE,
1665+
USER_REGSET_NOTE_TYPE(ARM_SSVE),
16661666
.n = DIV_ROUND_UP(SVE_PT_SIZE(SME_VQ_MAX, SVE_PT_REGS_SVE),
16671667
SVE_VQ_BYTES),
16681668
.size = SVE_VQ_BYTES,
@@ -1671,7 +1671,7 @@ static const struct user_regset aarch64_regsets[] = {
16711671
.set = ssve_set,
16721672
},
16731673
[REGSET_ZA] = { /* SME ZA */
1674-
.core_note_type = NT_ARM_ZA,
1674+
USER_REGSET_NOTE_TYPE(ARM_ZA),
16751675
/*
16761676
* ZA is a single register but it's variably sized and
16771677
* the ptrace core requires that the size of any data
@@ -1687,7 +1687,7 @@ static const struct user_regset aarch64_regsets[] = {
16871687
.set = za_set,
16881688
},
16891689
[REGSET_ZT] = { /* SME ZT */
1690-
.core_note_type = NT_ARM_ZT,
1690+
USER_REGSET_NOTE_TYPE(ARM_ZT),
16911691
.n = 1,
16921692
.size = ZT_SIG_REG_BYTES,
16931693
.align = sizeof(u64),
@@ -1697,15 +1697,15 @@ static const struct user_regset aarch64_regsets[] = {
16971697
#endif
16981698
#ifdef CONFIG_ARM64_PTR_AUTH
16991699
[REGSET_PAC_MASK] = {
1700-
.core_note_type = NT_ARM_PAC_MASK,
1700+
USER_REGSET_NOTE_TYPE(ARM_PAC_MASK),
17011701
.n = sizeof(struct user_pac_mask) / sizeof(u64),
17021702
.size = sizeof(u64),
17031703
.align = sizeof(u64),
17041704
.regset_get = pac_mask_get,
17051705
/* this cannot be set dynamically */
17061706
},
17071707
[REGSET_PAC_ENABLED_KEYS] = {
1708-
.core_note_type = NT_ARM_PAC_ENABLED_KEYS,
1708+
USER_REGSET_NOTE_TYPE(ARM_PAC_ENABLED_KEYS),
17091709
.n = 1,
17101710
.size = sizeof(long),
17111711
.align = sizeof(long),
@@ -1714,15 +1714,15 @@ static const struct user_regset aarch64_regsets[] = {
17141714
},
17151715
#ifdef CONFIG_CHECKPOINT_RESTORE
17161716
[REGSET_PACA_KEYS] = {
1717-
.core_note_type = NT_ARM_PACA_KEYS,
1717+
USER_REGSET_NOTE_TYPE(ARM_PACA_KEYS),
17181718
.n = sizeof(struct user_pac_address_keys) / sizeof(__uint128_t),
17191719
.size = sizeof(__uint128_t),
17201720
.align = sizeof(__uint128_t),
17211721
.regset_get = pac_address_keys_get,
17221722
.set = pac_address_keys_set,
17231723
},
17241724
[REGSET_PACG_KEYS] = {
1725-
.core_note_type = NT_ARM_PACG_KEYS,
1725+
USER_REGSET_NOTE_TYPE(ARM_PACG_KEYS),
17261726
.n = sizeof(struct user_pac_generic_keys) / sizeof(__uint128_t),
17271727
.size = sizeof(__uint128_t),
17281728
.align = sizeof(__uint128_t),
@@ -1733,7 +1733,7 @@ static const struct user_regset aarch64_regsets[] = {
17331733
#endif
17341734
#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
17351735
[REGSET_TAGGED_ADDR_CTRL] = {
1736-
.core_note_type = NT_ARM_TAGGED_ADDR_CTRL,
1736+
USER_REGSET_NOTE_TYPE(ARM_TAGGED_ADDR_CTRL),
17371737
.n = 1,
17381738
.size = sizeof(long),
17391739
.align = sizeof(long),
@@ -1743,7 +1743,7 @@ static const struct user_regset aarch64_regsets[] = {
17431743
#endif
17441744
#ifdef CONFIG_ARM64_POE
17451745
[REGSET_POE] = {
1746-
.core_note_type = NT_ARM_POE,
1746+
USER_REGSET_NOTE_TYPE(ARM_POE),
17471747
.n = 1,
17481748
.size = sizeof(long),
17491749
.align = sizeof(long),
@@ -1753,7 +1753,7 @@ static const struct user_regset aarch64_regsets[] = {
17531753
#endif
17541754
#ifdef CONFIG_ARM64_GCS
17551755
[REGSET_GCS] = {
1756-
.core_note_type = NT_ARM_GCS,
1756+
USER_REGSET_NOTE_TYPE(ARM_GCS),
17571757
.n = sizeof(struct user_gcs) / sizeof(u64),
17581758
.size = sizeof(u64),
17591759
.align = sizeof(u64),
@@ -1943,15 +1943,15 @@ static int compat_tls_set(struct task_struct *target,
19431943

19441944
static const struct user_regset aarch32_regsets[] = {
19451945
[REGSET_COMPAT_GPR] = {
1946-
.core_note_type = NT_PRSTATUS,
1946+
USER_REGSET_NOTE_TYPE(PRSTATUS),
19471947
.n = COMPAT_ELF_NGREG,
19481948
.size = sizeof(compat_elf_greg_t),
19491949
.align = sizeof(compat_elf_greg_t),
19501950
.regset_get = compat_gpr_get,
19511951
.set = compat_gpr_set
19521952
},
19531953
[REGSET_COMPAT_VFP] = {
1954-
.core_note_type = NT_ARM_VFP,
1954+
USER_REGSET_NOTE_TYPE(ARM_VFP),
19551955
.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
19561956
.size = sizeof(compat_ulong_t),
19571957
.align = sizeof(compat_ulong_t),
@@ -1968,23 +1968,23 @@ static const struct user_regset_view user_aarch32_view = {
19681968

19691969
static const struct user_regset aarch32_ptrace_regsets[] = {
19701970
[REGSET_GPR] = {
1971-
.core_note_type = NT_PRSTATUS,
1971+
USER_REGSET_NOTE_TYPE(PRSTATUS),
19721972
.n = COMPAT_ELF_NGREG,
19731973
.size = sizeof(compat_elf_greg_t),
19741974
.align = sizeof(compat_elf_greg_t),
19751975
.regset_get = compat_gpr_get,
19761976
.set = compat_gpr_set
19771977
},
19781978
[REGSET_FPR] = {
1979-
.core_note_type = NT_ARM_VFP,
1979+
USER_REGSET_NOTE_TYPE(ARM_VFP),
19801980
.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
19811981
.size = sizeof(compat_ulong_t),
19821982
.align = sizeof(compat_ulong_t),
19831983
.regset_get = compat_vfp_get,
19841984
.set = compat_vfp_set
19851985
},
19861986
[REGSET_TLS] = {
1987-
.core_note_type = NT_ARM_TLS,
1987+
USER_REGSET_NOTE_TYPE(ARM_TLS),
19881988
.n = 1,
19891989
.size = sizeof(compat_ulong_t),
19901990
.align = sizeof(compat_ulong_t),
@@ -1993,15 +1993,15 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
19931993
},
19941994
#ifdef CONFIG_HAVE_HW_BREAKPOINT
19951995
[REGSET_HW_BREAK] = {
1996-
.core_note_type = NT_ARM_HW_BREAK,
1996+
USER_REGSET_NOTE_TYPE(ARM_HW_BREAK),
19971997
.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
19981998
.size = sizeof(u32),
19991999
.align = sizeof(u32),
20002000
.regset_get = hw_break_get,
20012001
.set = hw_break_set,
20022002
},
20032003
[REGSET_HW_WATCH] = {
2004-
.core_note_type = NT_ARM_HW_WATCH,
2004+
USER_REGSET_NOTE_TYPE(ARM_HW_WATCH),
20052005
.n = sizeof(struct user_hwdebug_state) / sizeof(u32),
20062006
.size = sizeof(u32),
20072007
.align = sizeof(u32),
@@ -2010,7 +2010,7 @@ static const struct user_regset aarch32_ptrace_regsets[] = {
20102010
},
20112011
#endif
20122012
[REGSET_SYSTEM_CALL] = {
2013-
.core_note_type = NT_ARM_SYSTEM_CALL,
2013+
USER_REGSET_NOTE_TYPE(ARM_SYSTEM_CALL),
20142014
.n = 1,
20152015
.size = sizeof(int),
20162016
.align = sizeof(int),

arch/csky/kernel/ptrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ static int fpr_set(struct task_struct *target,
166166

167167
static const struct user_regset csky_regsets[] = {
168168
[REGSET_GPR] = {
169-
.core_note_type = NT_PRSTATUS,
169+
USER_REGSET_NOTE_TYPE(PRSTATUS),
170170
.n = sizeof(struct pt_regs) / sizeof(u32),
171171
.size = sizeof(u32),
172172
.align = sizeof(u32),
173173
.regset_get = gpr_get,
174174
.set = gpr_set,
175175
},
176176
[REGSET_FPR] = {
177-
.core_note_type = NT_PRFPREG,
177+
USER_REGSET_NOTE_TYPE(PRFPREG),
178178
.n = sizeof(struct user_fp) / sizeof(u32),
179179
.size = sizeof(u32),
180180
.align = sizeof(u32),

arch/hexagon/kernel/ptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ enum hexagon_regset {
137137

138138
static const struct user_regset hexagon_regsets[] = {
139139
[REGSET_GENERAL] = {
140-
.core_note_type = NT_PRSTATUS,
140+
USER_REGSET_NOTE_TYPE(PRSTATUS),
141141
.n = ELF_NGREG,
142142
.size = sizeof(unsigned long),
143143
.align = sizeof(unsigned long),

arch/loongarch/kernel/ptrace.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -864,23 +864,23 @@ enum loongarch_regset {
864864

865865
static const struct user_regset loongarch64_regsets[] = {
866866
[REGSET_GPR] = {
867-
.core_note_type = NT_PRSTATUS,
867+
USER_REGSET_NOTE_TYPE(PRSTATUS),
868868
.n = ELF_NGREG,
869869
.size = sizeof(elf_greg_t),
870870
.align = sizeof(elf_greg_t),
871871
.regset_get = gpr_get,
872872
.set = gpr_set,
873873
},
874874
[REGSET_FPR] = {
875-
.core_note_type = NT_PRFPREG,
875+
USER_REGSET_NOTE_TYPE(PRFPREG),
876876
.n = ELF_NFPREG,
877877
.size = sizeof(elf_fpreg_t),
878878
.align = sizeof(elf_fpreg_t),
879879
.regset_get = fpr_get,
880880
.set = fpr_set,
881881
},
882882
[REGSET_CPUCFG] = {
883-
.core_note_type = NT_LOONGARCH_CPUCFG,
883+
USER_REGSET_NOTE_TYPE(LOONGARCH_CPUCFG),
884884
.n = 64,
885885
.size = sizeof(u32),
886886
.align = sizeof(u32),
@@ -889,7 +889,7 @@ static const struct user_regset loongarch64_regsets[] = {
889889
},
890890
#ifdef CONFIG_CPU_HAS_LSX
891891
[REGSET_LSX] = {
892-
.core_note_type = NT_LOONGARCH_LSX,
892+
USER_REGSET_NOTE_TYPE(LOONGARCH_LSX),
893893
.n = NUM_FPU_REGS,
894894
.size = 16,
895895
.align = 16,
@@ -899,7 +899,7 @@ static const struct user_regset loongarch64_regsets[] = {
899899
#endif
900900
#ifdef CONFIG_CPU_HAS_LASX
901901
[REGSET_LASX] = {
902-
.core_note_type = NT_LOONGARCH_LASX,
902+
USER_REGSET_NOTE_TYPE(LOONGARCH_LASX),
903903
.n = NUM_FPU_REGS,
904904
.size = 32,
905905
.align = 32,
@@ -909,7 +909,7 @@ static const struct user_regset loongarch64_regsets[] = {
909909
#endif
910910
#ifdef CONFIG_CPU_HAS_LBT
911911
[REGSET_LBT] = {
912-
.core_note_type = NT_LOONGARCH_LBT,
912+
USER_REGSET_NOTE_TYPE(LOONGARCH_LBT),
913913
.n = 5,
914914
.size = sizeof(u64),
915915
.align = sizeof(u64),
@@ -919,15 +919,15 @@ static const struct user_regset loongarch64_regsets[] = {
919919
#endif
920920
#ifdef CONFIG_HAVE_HW_BREAKPOINT
921921
[REGSET_HW_BREAK] = {
922-
.core_note_type = NT_LOONGARCH_HW_BREAK,
922+
USER_REGSET_NOTE_TYPE(LOONGARCH_HW_BREAK),
923923
.n = sizeof(struct user_watch_state_v2) / sizeof(u32),
924924
.size = sizeof(u32),
925925
.align = sizeof(u32),
926926
.regset_get = hw_break_get,
927927
.set = hw_break_set,
928928
},
929929
[REGSET_HW_WATCH] = {
930-
.core_note_type = NT_LOONGARCH_HW_WATCH,
930+
USER_REGSET_NOTE_TYPE(LOONGARCH_HW_WATCH),
931931
.n = sizeof(struct user_watch_state_v2) / sizeof(u32),
932932
.size = sizeof(u32),
933933
.align = sizeof(u32),

arch/m68k/kernel/ptrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,15 @@ enum m68k_regset {
319319

320320
static const struct user_regset m68k_user_regsets[] = {
321321
[REGSET_GPR] = {
322-
.core_note_type = NT_PRSTATUS,
322+
USER_REGSET_NOTE_TYPE(PRSTATUS),
323323
.n = ELF_NGREG,
324324
.size = sizeof(u32),
325325
.align = sizeof(u16),
326326
.regset_get = m68k_regset_get,
327327
},
328328
#ifdef CONFIG_FPU
329329
[REGSET_FPU] = {
330-
.core_note_type = NT_PRFPREG,
330+
USER_REGSET_NOTE_TYPE(PRFPREG),
331331
.n = sizeof(struct user_m68kfp_struct) / sizeof(u32),
332332
.size = sizeof(u32),
333333
.align = sizeof(u32),

0 commit comments

Comments
 (0)