Re: [PATCH] x86: Implement __WARN using UD0

From: Borislav Petkov
Date: Sat Feb 25 2017 - 05:49:37 EST


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.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.