On Mon, 10 Jun 2024 at 18:09, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > Doing it in general is actually very very painful. Feel free to try - > but I can almost guarantee that you will throw out the "Keep It Simple > Stupid" approach and your patch will be twice the size if you do some > "rewrite the whole instruction" stuff. > > I really think there's a fundamental advantage to keeping things simple. I guess the KISS approach would be to have a debug mode that just adds an 'int3' instruction *after* the constant. And then the constant rewriting rewrites the constant and just changes the 'int3' into the standard single-byte 'nop' instruction. That wouldn't be complicated, and the cost would be minimal. But I don't see it being worth it, at least not for the current use where the unrewritten constant will just cause an oops on use. Linus