summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2023-09-11 22:40:02 +0300
committerVasily Gorbik <gor@linux.ibm.com>2023-09-19 14:26:56 +0300
commit4b440e01da51da0cc651c06a036b8914b7b61ccf (patch)
tree1561e8c910fc4e383a1b10242e6f1c8c03ee5736
parent80725978260ff823e1c442e75d66cf1b61684bba (diff)
downloadlinux-4b440e01da51da0cc651c06a036b8914b7b61ccf.tar.xz
s390/kprobes,ptrace: open code struct per_reg
Open code struct per_regs within kprobes and ptrace code, since at both locations a struct per_regs is passed to __local_ctl_load() and __local_ctl_store() which prevents to implement type checking for both functions. Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r--arch/s390/kernel/kprobes.c11
-rw-r--r--arch/s390/kernel/ptrace.c13
2 files changed, 19 insertions, 5 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index ef556b93596d..d4c2ece4f839 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -224,7 +224,14 @@ static void enable_singlestep(struct kprobe_ctlblk *kcb,
struct pt_regs *regs,
unsigned long ip)
{
- struct per_regs per_kprobe;
+ union {
+ unsigned long regs[3];
+ struct {
+ unsigned long control;
+ unsigned long start;
+ unsigned long end;
+ };
+ } per_kprobe;
/* Set up the PER control registers %cr9-%cr11 */
per_kprobe.control = PER_EVENT_IFETCH;
@@ -237,7 +244,7 @@ static void enable_singlestep(struct kprobe_ctlblk *kcb,
(PSW_MASK_PER | PSW_MASK_IO | PSW_MASK_EXT);
/* Set PER control regs, turns on single step for the given address */
- __local_ctl_load(9, 11, per_kprobe);
+ __local_ctl_load(9, 11, per_kprobe.regs);
regs->psw.mask |= PSW_MASK_PER;
regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT);
regs->psw.addr = ip;
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index c03fda09f689..1e1de907f24d 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -41,10 +41,17 @@ void update_cr_regs(struct task_struct *task)
{
struct pt_regs *regs = task_pt_regs(task);
struct thread_struct *thread = &task->thread;
- struct per_regs old, new;
union ctlreg0 cr0_old, cr0_new;
union ctlreg2 cr2_old, cr2_new;
int cr0_changed, cr2_changed;
+ union {
+ unsigned long regs[3];
+ struct {
+ unsigned long control;
+ unsigned long start;
+ unsigned long end;
+ };
+ } old, new;
local_ctl_store(0, &cr0_old.val);
local_ctl_store(2, &cr2_old.val);
@@ -104,9 +111,9 @@ void update_cr_regs(struct task_struct *task)
return;
}
regs->psw.mask |= PSW_MASK_PER;
- __local_ctl_store(9, 11, old);
+ __local_ctl_store(9, 11, old.regs);
if (memcmp(&new, &old, sizeof(struct per_regs)) != 0)
- __local_ctl_load(9, 11, new);
+ __local_ctl_load(9, 11, new.regs);
}
void user_enable_single_step(struct task_struct *task)