[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170223152309.GF6515@twins.programming.kicks-ass.net>
Date: Thu, 23 Feb 2017 16:23:09 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: hpa@...or.com
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, arjan@...ux.intel.com, bp@...en8.de,
jpoimboe@...hat.com, richard.weinberger@...il.com
Subject: Re: [PATCH] x86: Implement __WARN using UD0
On Thu, Feb 23, 2017 at 07:09:05AM -0800, hpa@...or.com wrote:
> Well, it only matters if the instruction extends past a segment
> boundary or page. However, the CPU instruction decoder will consume a
> modrm for UD1, and so using just the two opcode bytes may cause a #PF
> or #GP when a #UD was intended.
It also matters if you want the decoded instruction stream to make
sense.
If for instance I use UD1 without the ModRM byte for WARN, objtool gets
mighty confused because the instruction stream doesn't decode properly.
objtool will also consume the extra byte and then the next instruction
is offset and decodes wrong and it stresses out.
Similarly, if you were to do objdump (and objdump were to actually
correctly decode UD1) then the resulting asm would make no sense.
The kernel will work 'fine', because even without ModRM it will #UD, and
the #UD handler will IP+=2 and all is well, but it becomes impossible to
actually decode the function..
Powered by blists - more mailing lists