On Mon, Apr 28, 2025 at 12:34:27PM -0700, Linus Torvalds wrote: > And yes, this really is a very potential and real security issue. In > the kernel I don't think we have this ever happening, partly because a > lot of configurations use gcc which afaik doesn't have this particular > horrendous model of UD.
I see more and more people use clang, in a large part because of Rust. Anyway, I've seen clang pull this stop-codegen-on-UB trick before (link was upstream in the thread) and yes, it is horrific crap. At the time I proposed emitting at the very least a UD2 instruction rather than just straight up stopping code gen, but I think your proposal for a code-gen knob to just not do this 'optimisation' at all is much better.