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


Groups > linux.kernel > #1587474

Re: [PATCH] x86: Implement __WARN using UD0

From hpa@zytor.com
Newsgroups linux.kernel
Subject Re: [PATCH] x86: Implement __WARN using UD0
Date 2017-02-24 10:50 +0100
Message-ID <tekFJ-6GV-31@gated-at.bofh.it> (permalink)
References <te1D4-1LK-9@gated-at.bofh.it> <te2pr-2oI-1@gated-at.bofh.it> <te329-2EY-13@gated-at.bofh.it> <teiXg-5sB-5@gated-at.bofh.it> <tejzY-5Xe-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On February 24, 2017 12:31:15 AM PST, Peter Zijlstra <peterz@infradead.org> wrote:
>On Fri, Feb 24, 2017 at 08:43:25AM +0100, Ingo Molnar wrote:
>> The only high level question is whether we trust the trap machinery
>to generate 
>> WARN_ON()s. I believe we do.
>> 
>> BTW.: why not use INT3 instead of all these weird #UD opcodes? It's a
>single byte 
>> opcode and we can do a quick exception table search in do_debug().
>This way we'll 
>> also have irqs disabled which might help getting the message out
>before any irq 
>> handler comes in and muddies the waters.
>> 
>> In a sense WARN_ON()s and BUG_ON()s can be considered permanently
>installed 
>> in-line kprobes, with a special, built-in handler.
>
>I've actually been looking into that. There's a bunch of 'fun' details
>that I've been checking, but I think I can make that happen.
>
>My initial patch extended the existing UD2 BUG trap to include the
>WARN,
>this is what many other architectures already do. Arjan then complained
>that some emulators terminate on UD2 and could I please not use that
>for
>WARN, at which point Borislav called my attention to UD0/UD1.
>
>So I made the UD0 change and posted (fwiw, there's a lost refresh in
>the
>patch I posted and it will not actually work).
>
>I think I'll post an update of said patch and then attempt to do the
>INT3 thing in a later patch -- that will require at least one new knob
>in the generic BUG code ...
>
>> BTW. #2: side note, GCC generated crap code here. Why didn't it do:
>
>I've seen GCC do 'wonderful' things the past few weeks. Absolutely mind
>boggling stuff.

Terminating on UD2 is really obnoxious, btw. JMPE, ICEBP/INT1, some I/O port or MSR would be appropriate choices for that, but UD2 is rude in the extreme.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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


Thread

[PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 14:30 +0100
  Re: [PATCH] x86: Implement __WARN using UD0 Arjan van de Ven <arjan@linux.intel.com> - 2017-02-23 15:20 +0100
    Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 16:00 +0100
      Re: [PATCH] x86: Implement __WARN using UD0 Ingo Molnar <mingo@kernel.org> - 2017-02-24 09:00 +0100
        Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-24 09:40 +0100
          Re: [PATCH] x86: Implement __WARN using UD0 Ingo Molnar <mingo@kernel.org> - 2017-02-24 10:20 +0100
            Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-24 10:50 +0100
              Re: [PATCH] x86: Implement __WARN using UD0 "H. Peter Anvin" <hpa@zytor.com> - 2017-02-24 12:50 +0100
            Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-24 12:50 +0100
              Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-25 11:50 +0100
                Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-25 19:00 +0100
                Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-25 20:40 +0100
                Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-25 21:40 +0100
                Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-25 21:50 +0100
          Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-24 10:20 +0100
          Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-24 10:50 +0100
  Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 15:20 +0100
    Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 16:00 +0100
    Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-23 16:20 +0100
      Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 16:30 +0100
        Re: [PATCH] x86: Implement __WARN using UD0 hpa@zytor.com - 2017-02-23 16:40 +0100
          Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-23 17:10 +0100
  Re: [PATCH] x86: Implement __WARN using UD0 Josh Poimboeuf <jpoimboe@redhat.com> - 2017-02-23 15:20 +0100
    Re: [PATCH] x86: Implement __WARN using UD0 Borislav Petkov <bp@alien8.de> - 2017-02-23 15:30 +0100
    Re: [PATCH] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-23 15:40 +0100
  [PATCH -v2] x86: Implement __WARN using UD0 Peter Zijlstra <peterz@infradead.org> - 2017-02-24 12:20 +0100
    [RFC][PATCH] bug: Add _ONCE logic to report_bug() Peter Zijlstra <peterz@infradead.org> - 2017-02-25 10:10 +0100
      Re: [RFC][PATCH] bug: Add _ONCE logic to report_bug() Ingo Molnar <mingo@kernel.org> - 2017-02-25 10:20 +0100
        Re: [RFC][PATCH] bug: Add _ONCE logic to report_bug() Peter Zijlstra <peterz@infradead.org> - 2017-02-25 11:50 +0100

csiph-web