On Fri, 15 Apr 2016, Michael Matz wrote: > On Thu, 14 Apr 2016, Maxim Kuvyrkov wrote: > > > It appears that implementing -fprolog-pad=N option in GCC will not > > enable kernel live-patching support for AArch64. The proposal for the > > option was to make GCC output a given number of NOPs at the beginning of > > each function, and then the kernel could use that NOP pad to insert > > whatever instructions it needs. The modification of kernel instruction > > stream needs to be done atomically, and, unfortunately, it seems the > > kernel can use only architecture-provided atomicity primitives -- i.e., > > changing at most 8 bytes at a time. > > Replace first nop with a breakpoint, handle rest of patching in breakpoint > handler, patch breakpoint insn last, no need to atomically patch multiple > instructions.
Alternatively: replace first nop with a short forward branch that jumps over the rest of the pad, patch rest of the pad, patch the initial forward branch. Alexander