Commit e32b3b82 authored by Qing Zhang's avatar Qing Zhang Committed by Huacai Chen

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: default avatarQing Zhang <zhangqing@loongson.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent ff9f3d7a
...@@ -546,7 +546,7 @@ static int hw_break_get(struct task_struct *target, ...@@ -546,7 +546,7 @@ static int hw_break_get(struct task_struct *target,
membuf_write(&to, &info, sizeof(info)); membuf_write(&to, &info, sizeof(info));
/* (address, ctrl) registers */ /* (address, mask, ctrl) registers */
while (to.left) { while (to.left) {
ret = ptrace_hbp_get_addr(note_type, target, idx, &addr); ret = ptrace_hbp_get_addr(note_type, target, idx, &addr);
if (ret) if (ret)
...@@ -584,7 +584,7 @@ static int hw_break_set(struct task_struct *target, ...@@ -584,7 +584,7 @@ static int hw_break_set(struct task_struct *target,
offset = offsetof(struct user_watch_state, dbg_regs); offset = offsetof(struct user_watch_state, dbg_regs);
user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset); user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset);
/* (address, ctrl) registers */ /* (address, mask, ctrl) registers */
limit = regset->n * regset->size; limit = regset->n * regset->size;
while (count && offset < limit) { while (count && offset < limit) {
if (count < PTRACE_HBP_ADDR_SZ) if (count < PTRACE_HBP_ADDR_SZ)
...@@ -604,7 +604,7 @@ static int hw_break_set(struct task_struct *target, ...@@ -604,7 +604,7 @@ static int hw_break_set(struct task_struct *target,
break; break;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask,
offset, offset + PTRACE_HBP_ADDR_SZ); offset, offset + PTRACE_HBP_MASK_SZ);
if (ret) if (ret)
return ret; return ret;
...@@ -613,8 +613,8 @@ static int hw_break_set(struct task_struct *target, ...@@ -613,8 +613,8 @@ static int hw_break_set(struct task_struct *target,
return ret; return ret;
offset += PTRACE_HBP_MASK_SZ; offset += PTRACE_HBP_MASK_SZ;
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &mask, ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl,
offset, offset + PTRACE_HBP_MASK_SZ); offset, offset + PTRACE_HBP_CTRL_SZ);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment