Skip to content

Commit e32b3b8

Browse files
zhangqingmychenhuacai
authored andcommitted
LoongArch: Adjust user_regset_copyin parameter to the correct offset
Ensure that user_watch_state can be set correctly by the user. Signed-off-by: Qing Zhang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent ff9f3d7 commit e32b3b8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/loongarch/kernel/ptrace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ static int hw_break_get(struct task_struct *target,
546546

547547
membuf_write(&to, &info, sizeof(info));
548548

549-
/* (address, ctrl) registers */
549+
/* (address, mask, ctrl) registers */
550550
while (to.left) {
551551
ret = ptrace_hbp_get_addr(note_type, target, idx, &addr);
552552
if (ret)
@@ -584,7 +584,7 @@ static int hw_break_set(struct task_struct *target,
584584
offset = offsetof(struct user_watch_state, dbg_regs);
585585
user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
586586

587-
/* (address, ctrl) registers */
587+
/* (address, mask, ctrl) registers */
588588
limit = regset->n * regset->size;
589589
while (count && offset < limit) {
590590
if (count < PTRACE_HBP_ADDR_SZ)
@@ -604,7 +604,7 @@ static int hw_break_set(struct task_struct *target,
604604
break;
605605

606606
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask,
607-
offset, offset + PTRACE_HBP_ADDR_SZ);
607+
offset, offset + PTRACE_HBP_MASK_SZ);
608608
if (ret)
609609
return ret;
610610

@@ -613,8 +613,8 @@ static int hw_break_set(struct task_struct *target,
613613
return ret;
614614
offset += PTRACE_HBP_MASK_SZ;
615615

616-
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask,
617-
offset, offset + PTRACE_HBP_MASK_SZ);
616+
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl,
617+
offset, offset + PTRACE_HBP_CTRL_SZ);
618618
if (ret)
619619
return ret;
620620

0 commit comments

Comments
 (0)