<div dir="ltr">Hi Josh,<div><br></div><div>First of all, a big thanks for your swift reply.</div><div><br></div><div>The issue got resolved :). I had been building the "complex" module wrongly. I was building the third argument of create-diff-object (which is the .ko file) with KCFLAGS="-ffunction-sections -fdata-sections" set. This is not to be done apparently. I unset the KCFLAGS while building the .ko file and everything went smoothly.</div><div><br></div><div>Thanks again :).</div><div><br></div><div>Regards,</div><div>Somdeep Das</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 7:59 PM, Josh Poimboeuf <span dir="ltr"><<a href="mailto:jpoimboe@redhat.com" target="_blank">jpoimboe@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Jun 11, 2015 at 07:44:59PM +0530, Somdeep Das wrote:<br>
> Hi,<br>
><br>
> I have been trying out kpatch for some time now. I was able to create,<br>
> install and load a patch successfully for my simple device driver. So far<br>
> so good. Next, I tried to patch a bit more complex kernel module having<br>
> multiple object files. I then created and installed the patch using the<br>
> kpatch tools but while loading the patch I am hitting an issue. Kpatch is<br>
> reporting the following error:<br>
> kpatch: can't set ftrace filter at address <some address><br>
><br>
> I did some investigation and reached to a conclusion that<br>
> ftrace_match_addr() is returning -22 (-EINVAL) as ftrace_location() is<br>
> failing to find the target function’s address in ftrace table.<br>
><br>
> I would be really grateful if I can get any help on resolving this issue.<br>
<br>
</div></div>Hi Somdeep,<br>
<br>
Most kernel and module functions have a "call mcount" instruction as the<br>
beginning, which is the ftrace hook which kpatch needs in order to patch<br>
a function.<br>
<br>
"objdump -d" should show something like the following:<br>
<br>
0000000000000000 <drm_getmagic>:<br>
       0:       e8 00 00 00 00          callq  5 <drm_getmagic+0x5><br>
<br>
(Ignore the <drm_getmagic+0x5> target.  objdump isn't smart enough to<br>
understand ELF relocations.  But it should always be a "e8 00 00 00 00"<br>
instruction.)<br>
<br>
It sounds like the function you're trying to patch doesn't have an<br>
ftrace hook at the beginning for some reason.  Did you do anything<br>
"different" when building the more complex module?  Or any chance the<br>
function was annotated with "notrace"?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Josh<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">50|V|[)33|></div>
</div>