[RFC] Kernel livepatching support in GCC

Andi Kleen ak@linux.intel.com
Tue Jun 9 15:53:00 GMT 2015

> > As I am bit concerned with performance why require nops there? Add a
> > byte count number >= requested thats boundary of next instruction. When
> > lifepatching for return you need to copy this followed by jump back to next
> > instruction. Then gcc could fill that with instructions that don't
> > depend on address, fill with nops as trivial first implementation.
> > 
> > Would that be possible?
> So instead of placing NOPs to be overwritten you intend to simply overwrite the existing code after
> making a backup of it? 

This is how Linux k/uprobes work. But it only works for a subset of instructions and is
fairly complicated because you need a complete decoder that is able to adjust any program counter
relative data offsets. Having a patch area is far easier and more reliable.

ak@linux.intel.com -- Speaking for myself only

More information about the Gcc mailing list