Skip to content

Commit a81ce79

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 ptrace fix from Catalin Marinas. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: ptrace: avoid using HW_BREAKPOINT_EMPTY for disabled events
2 parents df36ac1 + cdc27c2 commit a81ce79

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

arch/arm64/kernel/ptrace.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -214,31 +214,29 @@ static int ptrace_hbp_fill_attr_ctrl(unsigned int note_type,
214214
{
215215
int err, len, type, disabled = !ctrl.enabled;
216216

217-
if (disabled) {
218-
len = 0;
219-
type = HW_BREAKPOINT_EMPTY;
220-
} else {
221-
err = arch_bp_generic_fields(ctrl, &len, &type);
222-
if (err)
223-
return err;
224-
225-
switch (note_type) {
226-
case NT_ARM_HW_BREAK:
227-
if ((type & HW_BREAKPOINT_X) != type)
228-
return -EINVAL;
229-
break;
230-
case NT_ARM_HW_WATCH:
231-
if ((type & HW_BREAKPOINT_RW) != type)
232-
return -EINVAL;
233-
break;
234-
default:
217+
attr->disabled = disabled;
218+
if (disabled)
219+
return 0;
220+
221+
err = arch_bp_generic_fields(ctrl, &len, &type);
222+
if (err)
223+
return err;
224+
225+
switch (note_type) {
226+
case NT_ARM_HW_BREAK:
227+
if ((type & HW_BREAKPOINT_X) != type)
235228
return -EINVAL;
236-
}
229+
break;
230+
case NT_ARM_HW_WATCH:
231+
if ((type & HW_BREAKPOINT_RW) != type)
232+
return -EINVAL;
233+
break;
234+
default:
235+
return -EINVAL;
237236
}
238237

239238
attr->bp_len = len;
240239
attr->bp_type = type;
241-
attr->disabled = disabled;
242240

243241
return 0;
244242
}

0 commit comments

Comments
 (0)