Re: [REGRESSION 5.8] x86/entry: DR0 break-on-write not working

From: Josh Poimboeuf
Date: Wed Aug 19 2020 - 23:46:51 EST


On Wed, Aug 19, 2020 at 05:14:18PM -0700, Andy Lutomirski wrote:
> On Wed, Aug 19, 2020 at 3:47 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> > What amazes me is that it successfully schedules back to the end of the
> > #DB handler finish and everything keeps working.
> >
> > Do we not have assertions in the scheduler to catch this?
>
> You almost nailed it.
>
> I'm pretty sure you have the buggy sequence of events right, but for
> the wrong reason. There's nothing wrong with scheduling when
> delivering SIGTRAP, but it's definitely wrong to blindly save and
> restore DR7 around scheduling and around ptrace invocations. Remember
> this is an entry from user mode, so it runs on the user stack.

Wow, I had no idea user #DB's run on the task stack. The scheduling
from #DB blew my mind :-) What's the purpose of that?

--
Josh