[lkml]   [2020]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [LTP] [x86/entry] 2bbc68f837:
> do_debug is a bit of a red herring here. ptrace should not be able to
> put a breakpoint on a kernel address, period. I would just pick a
> fixed address that's in the kernel text range or even just in the
> pre-KASLR text range and make sure it gets rejected. Maybe try a few
> different addresses for good measure.

I've looked at the code and it seems like this would be a bit more
complicated since the breakpoint is set by an accident in a race and the
call still fails. Which is why the test triggers the breakpoint and
causes infinite loop in the kernel...

I guess that we could instead read back the address with
PTRACE_PEEKUSER, so something as:

break_addr = ptrace(PTRACE_PEEKUSER, child_pid,
(void *)offsetof(struct user, u_debugreg[0]),

if (break_addr == kernel_addr)
tst_res(TFAIL, "ptrace() set break on a kernel address");

Cyril Hrubis

 \ /
  Last update: 2020-08-12 11:31    [W:0.082 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site