LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Jan Beulich <jbeulich@novell.com>,
	tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: fix typo(?) in step.c
Date: Thu,  6 Mar 2008 04:16:48 -0800 (PST)	[thread overview]
Message-ID: <20080306121648.A53FA2700FD@magilla.localdomain> (raw)
In-Reply-To: Ingo Molnar's message of  Thursday, 6 March 2008 12:34:13 +0100 <20080306113413.GD17906@elte.hu>

> my interpretation of the bug would be that we fail to mask out the 
> block-step MSR bit [because we mask out bit 25 instead of bit 1], and 
> hence the bug would cause that MSR bit to stay enabled in other tasks 
> too.

The wrong bit is in calls to write_debugctlmsr, only used when setting up a
thread to step.  It does not affect context switch, so it would never have
an effect on other tasks as you suggest here.

> So in theory the bug should manifest itself as block-step mode never 
> clearing itself, once activated. 

That doesn't happen in the trivial sense of "never", because in the normal
case an actual block-step exception happens and that makes the hardware
clear BTF from the MSR (as well as TF from eflags).  So it would only come
up in a more obscure case.  That is, you set up for block-step but didn't
actually finish the user-mode instruction block.  e.g. interrupted by a
signal or faulting instruction.  The child stops again but not by SIGTRAP,
and next time you don't block-step it.  Then, the BTF bit stays set in
thread.debugctlmsr and gets switched back in when the child runs again.
If you then resume with single-step instead, it will block-step because
BTF is set, but you wanted instruction-step.  Like I said, I didn't
produce a case that behaved that way.  I may be overlooking something.
But that's the scenario I imagine.

> (but this would never leak into other tasks because we've got the
> thread.debugctlmsr abstraction that protects them)

Correct.


Thanks,
Roland

  reply	other threads:[~2008-03-06 12:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  8:36 Jan Beulich
2008-03-05 13:41 ` Ingo Molnar
2008-03-06  7:52   ` Roland McGrath
2008-03-06 11:28     ` Ingo Molnar
2008-03-06 12:03       ` Roland McGrath
2008-03-06 13:11         ` Ingo Molnar
2008-03-10 11:53           ` Jan Beulich
2008-03-11  3:44             ` Roland McGrath
2008-03-06 11:34     ` Ingo Molnar
2008-03-06 12:16       ` Roland McGrath [this message]
2008-03-06 13:13         ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080306121648.A53FA2700FD@magilla.localdomain \
    --to=roland@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH] x86: fix typo(?) in step.c' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).