On Fri, Sep 30, 2016 at 12:01:47PM +0200, Jose E. Marchesi wrote: > > In case anybody missed it, the Linux kernel side to make use > of this has also been finished meanwhile. Of course it can not > be accepted without compiler support; and this feature patch > is much more versatile than just Linux kernel live patching > on a single architecture. > > How is this supposed to be exploited atomically in RISC arches such as > sparc? In such architectures you usually need to patch several > instructions to load an absolute address into a register.
We had some disucssions in the context of arm64: https://gcc.gnu.org/ml/gcc-patches/2016-04/msg01093.html But I don't think that we reached a final consensus at that time. Thanks, -Takahiro AKASHI > If a general mechanism is what is intended I would suggest to offer the > possibility of extending the nops _before_ the function entry point, > like in: > > (a) nop ! Load address > nop ! Load address > nop ! Load address > nop ! Load address > nop ! Jump to loaded address. > entry: > (b) nop ! PC-relative jump to (a) > save %sp, bleh, %sp > ... > > So after the live-patcher patches the loading of the destination address > and the jump, it can atomically patch (b) to effectively replace the > implementation of `entry'. > > Wdyt? >