Skip to content

Commit 1751981

Browse files
jgoulywilldeacon
authored andcommitted
arm64/ptrace: add support for FEAT_POE
Add a regset for POE containing POR_EL0. Signed-off-by: Joey Gouly <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Mark Brown <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 9160f7e commit 1751981

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

arch/arm64/kernel/ptrace.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,39 @@ static int tagged_addr_ctrl_set(struct task_struct *target, const struct
14401440
}
14411441
#endif
14421442

1443+
#ifdef CONFIG_ARM64_POE
1444+
static int poe_get(struct task_struct *target,
1445+
const struct user_regset *regset,
1446+
struct membuf to)
1447+
{
1448+
if (!system_supports_poe())
1449+
return -EINVAL;
1450+
1451+
return membuf_write(&to, &target->thread.por_el0,
1452+
sizeof(target->thread.por_el0));
1453+
}
1454+
1455+
static int poe_set(struct task_struct *target, const struct
1456+
user_regset *regset, unsigned int pos,
1457+
unsigned int count, const void *kbuf, const
1458+
void __user *ubuf)
1459+
{
1460+
int ret;
1461+
long ctrl;
1462+
1463+
if (!system_supports_poe())
1464+
return -EINVAL;
1465+
1466+
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl, 0, -1);
1467+
if (ret)
1468+
return ret;
1469+
1470+
target->thread.por_el0 = ctrl;
1471+
1472+
return 0;
1473+
}
1474+
#endif
1475+
14431476
enum aarch64_regset {
14441477
REGSET_GPR,
14451478
REGSET_FPR,
@@ -1469,6 +1502,9 @@ enum aarch64_regset {
14691502
#ifdef CONFIG_ARM64_TAGGED_ADDR_ABI
14701503
REGSET_TAGGED_ADDR_CTRL,
14711504
#endif
1505+
#ifdef CONFIG_ARM64_POE
1506+
REGSET_POE
1507+
#endif
14721508
};
14731509

14741510
static const struct user_regset aarch64_regsets[] = {
@@ -1628,6 +1664,16 @@ static const struct user_regset aarch64_regsets[] = {
16281664
.set = tagged_addr_ctrl_set,
16291665
},
16301666
#endif
1667+
#ifdef CONFIG_ARM64_POE
1668+
[REGSET_POE] = {
1669+
.core_note_type = NT_ARM_POE,
1670+
.n = 1,
1671+
.size = sizeof(long),
1672+
.align = sizeof(long),
1673+
.regset_get = poe_get,
1674+
.set = poe_set,
1675+
},
1676+
#endif
16311677
};
16321678

16331679
static const struct user_regset_view user_aarch64_view = {

include/uapi/linux/elf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ typedef struct elf64_shdr {
441441
#define NT_ARM_ZA 0x40c /* ARM SME ZA registers */
442442
#define NT_ARM_ZT 0x40d /* ARM SME ZT registers */
443443
#define NT_ARM_FPMR 0x40e /* ARM floating point mode register */
444+
#define NT_ARM_POE 0x40f /* ARM POE registers */
444445
#define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */
445446
#define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */
446447
#define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */

0 commit comments

Comments
 (0)