Re: [PATCH 6/6] ptrace: PTRACE_DETACH should doflush_ptrace_hw_breakpoint(child)

From: Oleg Nesterov
Date: Tue Apr 30 2013 - 13:55:20 EST


On 04/30, Frederic Weisbecker wrote:
>
> On Mon, Apr 29, 2013 at 06:40:38PM +0200, Oleg Nesterov wrote:
>
> > No, I think this (minor) problem is very old... At least, when I look
> > at 2.6.26 code I do not see anything which coould clear db regs on
> > detach.
>
> Ok, if so then the conversion to perf hasn't changed much the picture I think.

God knows ;) afaik there are not too much users.

But fyi, this conversion fixed some problems. For example, the content
of db registers we copied by copy_process iirc.

And, I didn't verify this, it seems that the old code didn't set _RF
bit so PTRACE_CONT should probably trigger the same bp again...

> The breakpoints have just stayed persistent across
> tracers.

Yes.

And. This conversion allows us to implement the generic arch-independent
PTRACE_GET/SET_HWBP api, the current PTRACE_{PEEK,POKE}USR(u_debugreg)
api is really awkward.

> > Btw. perhaps flush_ptrace_hw_breakpoint() should also clear the
> > virtual registers like thread.debugreg7 ? Even without this patch,
> > flush_ is also called exec.
>
> Yeah makes sense.

OK, and probably debugreg6 too, but I need to recheck.


Thanks Frederic for your review!

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/