Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1220412

Re: Dealing with the NMI mess

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: Dealing with the NMI mess
Date 2015-09-08 00:00 +0200
Message-ID <q6cCe-1cp-11@gated-at.bofh.it> (permalink)
References (11 earlier) <q5ZOG-8nj-21@gated-at.bofh.it> <q61Qu-2MN-19@gated-at.bofh.it> <q685A-3mv-19@gated-at.bofh.it> <q68oW-3J3-23@gated-at.bofh.it> <q6aqJ-6zw-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Sep 7, 2015 at 12:30 PM, Maciej W. Rozycki <macro@linux-mips.org> wrote:
> On Mon, 7 Sep 2015, Andy Lutomirski wrote:
>
>> >  These are all implementation-specific details, including the INT1
>> > instruction, which is why I am not at all surprised that they are omitted
>> > from architecture manuals.
>>
>> That bit is BS, though.  The INT1 instruction, executed in user mode
>> (CPL3) with no hardware debugger attached, will enter the kernel
>> through a gate at vector 1, *even if that gate has DPL == 0*.
>>
>> If there's an instruction that bypasses hardware protection
>> mechanisms, then Intel should document it rather than relying on OS
>> writers to know enough folklore to get it right.
>>
>> Heck, SDM Volume 3 6.12.1.1 says "The processor checks the DPL of the
>> interrupt or trap gate only if an exception or interrupt is generated
>> with an INT n, INT 3, or INTO instruction."  It does not say "the
>> processor does not check the DPL of the interrupt or trap gate if the
>> exception or interrupt is generated with the undocumented ICEBP
>> instruction."
>
>  It does not have to be mentioned, because it's implied by how the #DB
> exception is propagated: regardless of its origin it never checks the DPL.
> And user-mode software may well use POPF at any time to set the TF bit in
> the flags register to the same effect, so the OS needs to be prepared for
> a #DB exception it hasn't scheduled itself anyway.

Not really.

int $1 checks DPL.  Setting TF results in saved TF set and the
corresponding bit in DR6 set as well.  Triggering a #DB using the
debug registers requires active OS help.

So operating systems need to handle a #DB without no indicated cause
without spewing warnings or crashing, and there is no indication
whatsoever in the SDM or APM that this is the case.

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Dealing with the NMI mess "Maciej W. Rozycki" <macro@linux-mips.org> - 2015-09-07 07:40 +0200
  Re: Dealing with the NMI mess Ingo Molnar <mingo@kernel.org> - 2015-09-07 09:50 +0200
    Re: Dealing with the NMI mess "Maciej W. Rozycki" <macro@linux-mips.org> - 2015-09-07 10:20 +0200
      Re: Dealing with the NMI mess Paolo Bonzini <pbonzini@redhat.com> - 2015-09-07 12:30 +0200
        Re: Dealing with the NMI mess "Maciej W. Rozycki" <macro@linux-mips.org> - 2015-09-07 19:10 +0200
          Re: Dealing with the NMI mess Andy Lutomirski <luto@amacapital.net> - 2015-09-07 19:30 +0200
            Re: Dealing with the NMI mess "Maciej W. Rozycki" <macro@linux-mips.org> - 2015-09-07 21:40 +0200
              Re: Dealing with the NMI mess Andy Lutomirski <luto@amacapital.net> - 2015-09-08 00:00 +0200
                Re: Dealing with the NMI mess "Maciej W. Rozycki" <macro@linux-mips.org> - 2015-09-08 18:30 +0200

csiph-web