Re: [PATCH] x86: Implement __WARN using UD0

From: hpa
Date: Sat Feb 25 2017 - 12:57:29 EST


On February 25, 2017 2:38:08 AM PST, Borislav Petkov <bp@xxxxxxxxx> wrote:
>On Fri, Feb 24, 2017 at 11:41:33AM +0100, Peter Zijlstra wrote:
>> So yes, its tricky but it could be done. A new single byte #UD
>> instruction would be much nicer though.
>
>Btw, if we did a new insn which means new functionality instead of
>"stealing" an invalid one, we would have to have a fallback for all
>those current CPUs which don't support it, which means, alternatives
>patching.
>
>Perhaps it would be better to take one of the invalid ones and future
>hw can then extend it and actually make it into a special OS-INT
>instruction which is small enough to be inline and can, if hit, run a
>handler where you do fixup.
>
>And then that insn could even have a immed8 arg which you can use to
>pass info from the call site. IOW, something like
>
> ...
> OSINT $12
> ...
>
>and handler inspects opcode and does things based on it...
>
>Oh well.

You mean like the INT instruction?
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.