[kpatch] can't set ftrace filter

Somdeep Das somdeep at gmail.com
Fri Jun 12 15:40:15 UTC 2015


Hi Josh,

Yes, I'm indeed calling create-diff-object directly to patch my own module.
All the steps are taken from the kpatch bundle itself
(kpatch-master/test/testmod/) and can be summarized as follows:

1) Write a module (let's say orange.c)
2) Build orange.ko WITHOUT KCFLAGS="-ffunction-sections -fdata-sections"
and preserve it somewhere, may be as orange.ko.sacrosanct

You may start using the module orange.ko.sacrosanct

3) Build orange.o WITH KCFLAGS="-ffunction-sections -fdata-sections" and
copy orange.o as orange.o.orig
4) Make your desired changes in orange.c and again build orange.o WITH
KCFLAGS="-ffunction-sections -fdata-sections" and copy it as
orange.o.patched

Now we have all the necessary ingredients.

5) Now run the following sequentially:

    create-diff-object orange.o.orig orange.o.patched orange.ko.sacrosanct
output.o

    Copy output.o to kpatch-master/kmod/patch

    md5sum output.o | awk '{printf "%s\0", $1}' > checksum.tmp

    objcopy --add-section .kpatch.checksum=checksum.tmp --set-section-flags
.kpatch.checksum=alloc,load,contents,readonly output.o

    rm -f checksum.tmp

    KBUILD_EXTRA_SYMBOLS="$(readlink -e ../../kmod/core/Module.symvers)"
make

In the kpatch-master/kmod/patch directory, a new kernel object will get
created, let's call it kpatch-orange-patch.ko

6) Run: kpatch install kpatch-oranange-patch.ko

7) Run: kpatch load kpatch-oranange-patch.ko

Enjoy...

Regards,
Somdeep Das


On Fri, Jun 12, 2015 at 8:03 PM, Josh Poimboeuf <jpoimboe at redhat.com> wrote:

> On Fri, Jun 12, 2015 at 11:42:00AM +0530, Somdeep Das wrote:
> > Hi Josh,
> >
> > First of all, a big thanks for your swift reply.
> >
> > 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.
> >
> > Thanks again :).
>
> Glad it worked!  It sounds like you're calling create-diff-object
> directly, in order to create a patch for an out-of-tree module.  Is that
> right?  If so, nicely done.  Would you mind sharing the steps you took?
> That might be some good info for the README.  Or could possibly even be
> a nice feature to add to kpatch-build.
>
>
> --
> Josh
>



-- 
50|V|[)33|>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/kpatch/attachments/20150612/0f6c8083/attachment.htm>


More information about the kpatch mailing list