Thread (42 messages) flat view 42 messages, 10 authors, 2016-02-10

Re: [PATCH v6 8/9] Implement kernel live patching for ppc64le (ABIv2)

From: Petr Mladek <pmladek@suse.com>
Date: 2016-02-02 16:47:21
Also in: lkml

On Tue 2016-02-02 16:45:23, Torsten Duwe wrote:
On Tue, Feb 02, 2016 at 01:12:24PM +0100, Petr Mladek wrote:
quoted
Hmm, the size of the offset is not a constant. In particular, leaf
functions do not set TOC before the mcount location.
To be slightly more precise, a leaf function that additionally uses
no global data. No global function calls, no global data access =>
no need to load the TOC.
Thanks for explanation.
 
quoted
The result is that kernel crashes when trying to trace leaf function
The trampoline *requires* a proper TOC pointer to find the remote function
entry point. If you jump onto the trampoline with the TOC from the caller's
caller you'll grab some address from somewhere and jump into nirvana.
The dmesg messages suggested someting like this.

quoted
By other words, it seems that the code generated with -mprofile-kernel
option has been buggy in all gcc versions.
Either that or we need bigger trampolines for everybody.

Michael, should we grow every module trampoline to always load R2,
or fix GCC to recognise the generated bl _mcount as a global function call?
Anton, what do you think?
BTW: Is the trampoline used also for classic probes? If not, we might need
a trampoline for them as well.

Note that TOC is not set only when the problematic functions are
compiled with --mprofile-kernel. I still see the TOC stuff when
compiling only with -pg.


Best Regards,
Petr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help