On 03/30/2017 08:11 PM, sam wrote:
> On Thu, Mar 30, 2017 at 01:46:19PM -0400, Joe Lawrence wrote:
>> On 03/30/2017 12:16 PM, sam wrote:
>>> Hi All,
>>> Here is an issue:
>>>
>>> root@sm-machine:/home/sam/Downloads/linux-4.8# kpatch load kpatch-2.ko 
>>> loading patch module: kpatch-2.ko
>>> insmod: ERROR: could not insert module kpatch-2.ko: Invalid module
>>> format
>>> kpatch: failed to load module kpatch-2.ko
>>>
>>>
>>> The patch file as follows:
>>> --- ./fs/proc/meminfo.c 2017-03-31 00:00:23.558772349 +0800
>>> +++ ../linux-4.8_ori/fs/proc/meminfo.c  2017-03-30 00:22:06.113318048
>>> +0800
>>> @@ -54,7 +54,7 @@
>>> * Tagged format, for easy grepping and expansion.
>>> */
>>> seq_printf(m,
>>>         -               "SamMemTotal:       %8lu kB\n"
>>>         +               "MemTotal:       %8lu kB\n"

This patch looks backwards... shouldn't it be changing "MemTotal" to
"SamMemTotal"?

> Here is the message from dmesg when I run "kpatch load kpatch-2.ko":
> [29769.346303] kpatch_2: disagrees about version of symbol module_layout

That usually indicates that vmlinux isn't what kpatch-build thinks it is.

> And here is the process that I generate kpatch-2.ko:
> ***************
> #!/bin/bash
> #echo "[the modified  file] [ the original file ] [ patch file ]"
> diff -u $1 $2  > $3
> kpatch-build -s .  -v ./vmlinux  -t vmlinux --skip-gcc-check $3
> *******
> Here is the modinfo output:
> 
> root@sm-machine:/home/sam/Downloads/linux-4.8# modinfo kpatch-2.ko 
> filename:       /home/sam/Downloads/linux-4.8/kpatch-2.ko
> livepatch:      Y
> license:        GPL
> depends:        
> vermagic:       4.8.0 SMP mod_unload modversions 
> root@sm-machine:/home/sam/Downloads/linux-4.8# 

I think somehow the vmlinux you are pointing kpatch-build to is not the
same as the one that you are currently running.

Can you extract a refreshed kernel build / tree and try again?  Also
fixup 2.patch accordingly.

Thanks,

-- Joe

_______________________________________________
kpatch mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/kpatch

Reply via email to