dynup / kpatch

kpatch - live kernel patching
GNU General Public License v2.0
1.49k stars 305 forks source link

ERROR: rmpiggy.o: main: 2507: FILE symbol not found in base. Stripped? #708

Closed lilianli2020 closed 1 year ago

lilianli2020 commented 7 years ago
# cat my.patch 
Index: src/fs/proc/meminfo.c
===================================================================
--- src.orig/fs/proc/meminfo.c
+++ src/fs/proc/meminfo.c
@@ -95,7 +95,7 @@ static int meminfo_proc_show(struct seq_
        "Committed_AS:   %8lu kB\n"
        "VmallocTotal:   %8lu kB\n"
        "VmallocUsed:    %8lu kB\n"
-       "VmallocChunk:   %8lu kB\n"
+       "VMALLOCCHUNK:   %8lu kB\n"
 #ifdef CONFIG_MEMORY_FAILURE
        "HardwareCorrupted: %5lu kB\n"
 #endif

root@ubuntu:~# kpatch-build --skip-cleanup --skip-gcc-check -d -t vmlinux my.patch 
Skipping cleanup
WARNING: Skipping gcc version matching check (not recommended)
DEBUG mode enabled
+ shift
+ [[ 4 -gt 0 ]]
+ case "$1" in
+ TARGETS=' vmlinux'
+ shift
+ shift
+ [[ 2 -gt 0 ]]
+ case "$1" in
+ [[ -z my.patch ]]
++ readlink -f my.patch
+ PATCHFILE=/root/my.patch
+ [[ ! -f /root/my.patch ]]
+ break
+ mkdir -p /root/.kpatch/tmp
+ rm -rf '/root/.kpatch/tmp/*'
+ rm -f /root/.kpatch/build.log
+ [[ -n '' ]]
+ [[ 1 -eq 0 ]]
+ KVER=3.13.0
+ [[ 3.13.0-24-generic =~ - ]]
+ KREL=generic
+ KREL=generic
+ [[ -z  vmlinux ]]
++ basename /root/my.patch
+ PATCHNAME=my.patch
+ [[ my.patch =~ \.patch$ ]]
+ PATCHNAME=my
++ echo my
++ cut -c 1-48
+ PATCHNAME=my
+ source /etc/os-release
++ NAME=Ubuntu
++ VERSION='14.04, Trusty Tahr'
++ ID=ubuntu
++ ID_LIKE=debian
++ PRETTY_NAME='Ubuntu 14.04 LTS'
++ VERSION_ID=14.04
++ HOME_URL=http://www.ubuntu.com/
++ SUPPORT_URL=http://help.ubuntu.com/
++ BUG_REPORT_URL=http://bugs.launchpad.net/ubuntu/
+ DISTRO=ubuntu
+ [[ ubuntu = fedora ]]
+ [[ ubuntu = rhel ]]
+ [[ ubuntu = ol ]]
+ [[ ubuntu = centos ]]
+ [[ ubuntu = ubuntu ]]
+ [[ -z '' ]]
+ VMLINUX=/usr/lib/debug/boot/vmlinux-3.13.0-24-generic
+ [[ ubuntu = ubuntu ]]
+ [[ -e /usr/lib/debug/boot/vmlinux-3.13.0-24-generic ]]
+ export PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
+ PATH=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
+ find_dirs
+ [[ -e /usr/local/bin/create-diff-object ]]
+ [[ -e /usr/local/bin/../libexec/kpatch/create-diff-object ]]
++ readlink -f /usr/local/bin/../libexec/kpatch
+ TOOLSDIR=/usr/local/libexec/kpatch
++ readlink -f /usr/local/bin/../share/kpatch
+ DATADIR=/usr/local/share/kpatch
+ [[ 1 -eq 0 ]]
+ [[ -n '' ]]
+ [[ -e /root/.kpatch/src/.config ]]
+ [[ -e /root/.kpatch/version ]]
++ cat /root/.kpatch/version
+ [[ 3.13.0-24-generic = 3.13.0-24-generic ]]
+ echo 'Using cache at /root/.kpatch/src'
Using cache at /root/.kpatch/src
+ [[ -z '' ]]
+ CONFIGFILE=/root/.kpatch/src/.config
+ [[ ! -e /root/.kpatch/src/.config ]]
+ [[ /root/.kpatch/src/.config -ef /root/.kpatch/src/.config ]]
+ cp -f /root/.kpatch/src/.config /root/.kpatch/tmp
+ CONFIGFILE=/root/.kpatch/tmp/.config
+ KBUILD_EXTRA_SYMBOLS=
+ KPATCH_LDFLAGS=
+ KPATCH_MODULE=true
+ grep -q CONFIG_DEBUG_KERNEL=y /root/.kpatch/tmp/.config
+ grep -q CONFIG_LIVEPATCH=y /root/.kpatch/tmp/.config
+ find_core_symvers
+ SYMVERSFILE=
+ [[ -e /usr/local/bin/create-diff-object ]]
+ [[ -e /usr/local/bin/../libexec/kpatch/create-diff-object ]]
+ [[ -e /usr/local/bin/../lib/kpatch/3.13.0-24-generic/Module.symvers ]]
++ readlink -f /usr/local/bin/../lib/kpatch/3.13.0-24-generic/Module.symvers
+ SYMVERSFILE=/usr/local/lib/kpatch/3.13.0-24-generic/Module.symvers
+ [[ -e /usr/local/lib/kpatch/3.13.0-24-generic/Module.symvers ]]
+ KBUILD_EXTRA_SYMBOLS=/usr/local/lib/kpatch/3.13.0-24-generic/Module.symvers
+ grep -q CONFIG_PARAVIRT=y /root/.kpatch/tmp/.config
+ CONFIG_PARAVIRT=1
+ grep -q CONFIG_DEBUG_INFO_SPLIT=y /root/.kpatch/tmp/.config
+ echo 'Testing patch file'
Testing patch file
+ cd /root/.kpatch/src
+ patch -N -p1 --dry-run
checking file fs/proc/meminfo.c
+ cp /root/my.patch kpatch.patch
+ cp -LR /usr/local/share/kpatch/patch /root/.kpatch/tmp
+ export 'KCFLAGS=-I/usr/local/share/kpatch/patch -ffunction-sections -fdata-sections'
+ KCFLAGS='-I/usr/local/share/kpatch/patch -ffunction-sections -fdata-sections'
+ echo 'Reading special section data'
Reading special section data
+ [[ 1 -eq 0 ]]
++ readelf -wi /usr/lib/debug/boot/vmlinux-3.13.0-24-generic
++ gawk --non-decimal-data '
           BEGIN { a = b = p = e = 0 }

           # Set state if name matches
           a == 0 && /DW_AT_name.* alt_instr[[:space:]]*$/ {a = 1; next}
           b == 0 && /DW_AT_name.* bug_entry[[:space:]]*$/ {b = 1; next}
           p == 0 && /DW_AT_name.* paravirt_patch_site[[:space:]]*$/ {p = 1; next}
           e == 0 && /DW_AT_name.* exception_table_entry[[:space:]]*$/ {e = 1; next}

           # Reset state unless this abbrev describes the struct size
           a == 1 && !/DW_AT_byte_size/ { a = 0; next }
           b == 1 && !/DW_AT_byte_size/ { b = 0; next }
           p == 1 && !/DW_AT_byte_size/ { p = 0; next }
           e == 1 && !/DW_AT_byte_size/ { e = 0; next }

           # Now that we know the size, stop parsing for it
           a == 1 {printf("export ALT_STRUCT_SIZE=%d\n", $4); a = 2}
           b == 1 {printf("export BUG_STRUCT_SIZE=%d\n", $4); b = 2}
           p == 1 {printf("export PARA_STRUCT_SIZE=%d\n", $4); p = 2}
           e == 1 {printf("export EX_STRUCT_SIZE=%d\n", $4); e = 2}

           # Bail out once we have everything
           a == 2 && b == 2 && (p == 2 || skip_p) && e == 2 {exit}'
+ SPECIAL_VARS='export BUG_STRUCT_SIZE=12
export EX_STRUCT_SIZE=8
export PARA_STRUCT_SIZE=16
export ALT_STRUCT_SIZE=12'
+ [[ -n export BUG_STRUCT_SIZE=12
export EX_STRUCT_SIZE=8
export PARA_STRUCT_SIZE=16
export ALT_STRUCT_SIZE=12 ]]
+ eval 'export BUG_STRUCT_SIZE=12
export EX_STRUCT_SIZE=8
export PARA_STRUCT_SIZE=16
export ALT_STRUCT_SIZE=12'
++ export BUG_STRUCT_SIZE=12
++ BUG_STRUCT_SIZE=12
++ export EX_STRUCT_SIZE=8
++ EX_STRUCT_SIZE=8
++ export PARA_STRUCT_SIZE=16
++ PARA_STRUCT_SIZE=16
++ export ALT_STRUCT_SIZE=12
++ ALT_STRUCT_SIZE=12
+ [[ -z 12 ]]
+ [[ -z 12 ]]
+ [[ -z 8 ]]
+ [[ -z 16 ]]
+ for i in '$ALT_STRUCT_SIZE' '$BUG_STRUCT_SIZE' '$PARA_STRUCT_SIZE' '$EX_STRUCT_SIZE'
+ [[ ! 12 -gt 0 ]]
+ [[ ! 12 -le 16 ]]
+ for i in '$ALT_STRUCT_SIZE' '$BUG_STRUCT_SIZE' '$PARA_STRUCT_SIZE' '$EX_STRUCT_SIZE'
+ [[ ! 12 -gt 0 ]]
+ [[ ! 12 -le 16 ]]
+ for i in '$ALT_STRUCT_SIZE' '$BUG_STRUCT_SIZE' '$PARA_STRUCT_SIZE' '$EX_STRUCT_SIZE'
+ [[ ! 16 -gt 0 ]]
+ [[ ! 16 -le 16 ]]
+ for i in '$ALT_STRUCT_SIZE' '$BUG_STRUCT_SIZE' '$PARA_STRUCT_SIZE' '$EX_STRUCT_SIZE'
+ [[ ! 8 -gt 0 ]]
+ [[ ! 8 -le 16 ]]
+ echo 'Building original kernel'
Building original kernel
+ ./scripts/setlocalversion --save-scmversion
+ make mrproper
+ cp -f /root/.kpatch/tmp/.config /root/.kpatch/src/.config
+ unset KPATCH_GCC_TEMPDIR
+ CROSS_COMPILE='/usr/local/libexec/kpatch/kpatch-gcc '
+ make -j8 vmlinux
+ echo 'Building patched kernel'
Building patched kernel
+ patch -N -p1
+ mkdir -p /root/.kpatch/tmp/orig /root/.kpatch/tmp/patched
+ KPATCH_GCC_TEMPDIR=/root/.kpatch/tmp
+ export KPATCH_GCC_TEMPDIR
+ CROSS_COMPILE='/usr/local/libexec/kpatch/kpatch-gcc '
+ KBUILD_MODPOST_WARN=1
+ make -j8 vmlinux
+ [[ 0 -eq 0 ]]
+ grep -q 'undefined reference' /root/.kpatch/build.log
+ grep -qv kpatch_shadow
+ grep -q 'undefined!' /root/.kpatch/build.log
+ grep -qv kpatch_shadow
+ [[ ! -e /root/.kpatch/tmp/changed_objs ]]
++ cat /root/.kpatch/tmp/changed_objs
+ for i in '$(cat "$TEMPDIR/changed_objs")'
++ dirname arch/x86/realmode/rmpiggy.o
+ mkdir -p /root/.kpatch/tmp/patched/arch/x86/realmode
+ cp -f /root/.kpatch/src/arch/x86/realmode/rmpiggy.o /root/.kpatch/tmp/patched/arch/x86/realmode/rmpiggy.o
+ for i in '$(cat "$TEMPDIR/changed_objs")'
++ dirname fs/proc/meminfo.o
+ mkdir -p /root/.kpatch/tmp/patched/fs/proc
+ cp -f /root/.kpatch/src/fs/proc/meminfo.o /root/.kpatch/tmp/patched/fs/proc/meminfo.o
+ echo 'Extracting new and modified ELF sections'
Extracting new and modified ELF sections
++ cat /root/.kpatch/tmp/changed_objs
+ FILES='arch/x86/realmode/rmpiggy.o
fs/proc/meminfo.o'
+ cd /root/.kpatch/tmp
+ mkdir output
+ declare -a objnames
+ CHANGED=0
+ ERROR=0
+ for i in '$FILES'
+ [[ ubuntu = rhel ]]
+ [[ ubuntu = centos ]]
+ [[ ubuntu = ol ]]
+ [[ arch/x86/realmode/rmpiggy.o = usr/initramfs_data.o ]]
++ dirname arch/x86/realmode/rmpiggy.o
+ mkdir -p output/arch/x86/realmode
+ cd /root/.kpatch/src
+ find_kobj arch/x86/realmode/rmpiggy.o
+ arg=arch/x86/realmode/rmpiggy.o
+ KOBJFILE=arch/x86/realmode/rmpiggy.o
+ DEEP_FIND=0
+ ERROR_IF_DIFF=
+ true
+ find_parent_obj arch/x86/realmode/rmpiggy.o
++ dirname arch/x86/realmode/rmpiggy.o
+ dir=arch/x86/realmode
++ readlink -f arch/x86/realmode
+ absdir=/root/.kpatch/src/arch/x86/realmode
++ readlink -f .
+ pwddir=/root/.kpatch/src
+ pdir=arch/x86/realmode
++ basename arch/x86/realmode/rmpiggy.o
+ file=rmpiggy.o
+ grepname=arch/x86/realmode/rmpiggy
+ grepname='arch/x86/realmode/rmpiggy\.o'
+ [[ 0 -eq 1 ]]
++ grep -v arch/x86/realmode/.rmpiggy.o.cmd
++ grep -l 'arch/x86/realmode/rmpiggy\.o' arch/x86/realmode/.built-in.o.cmd arch/x86/realmode/.init.o.cmd arch/x86/realmode/.rmpiggy.o.cmd
++ head -n1
+ parent=arch/x86/realmode/.built-in.o.cmd
++ grep -v arch/x86/realmode/.rmpiggy.o.cmd
++ grep -l 'arch/x86/realmode/rmpiggy\.o' arch/x86/realmode/.built-in.o.cmd arch/x86/realmode/.init.o.cmd arch/x86/realmode/.rmpiggy.o.cmd
++ wc -l
+ num=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -gt 1 ]]
++ dirname arch/x86/realmode/.built-in.o.cmd
+ dir=arch/x86/realmode
++ basename arch/x86/realmode/.built-in.o.cmd
+ PARENT=.built-in.o.cmd
+ PARENT=built-in.o.cmd
+ PARENT=built-in.o
+ PARENT=arch/x86/realmode/built-in.o
+ [[ ! -e arch/x86/realmode/built-in.o ]]
+ [[ -n arch/x86/realmode/built-in.o ]]
+ DEEP_FIND=0
+ [[ -z arch/x86/realmode/built-in.o ]]
+ KOBJFILE=arch/x86/realmode/built-in.o
+ true
+ find_parent_obj arch/x86/realmode/built-in.o
++ dirname arch/x86/realmode/built-in.o
+ dir=arch/x86/realmode
++ readlink -f arch/x86/realmode
+ absdir=/root/.kpatch/src/arch/x86/realmode
++ readlink -f .
+ pwddir=/root/.kpatch/src
+ pdir=arch/x86/realmode
++ basename arch/x86/realmode/built-in.o
+ file=built-in.o
+ grepname=arch/x86/realmode/built-in
+ grepname='arch/x86/realmode/built-in\.o'
+ [[ 0 -eq 1 ]]
++ grep -v arch/x86/realmode/.built-in.o.cmd
++ grep -l 'arch/x86/realmode/built-in\.o' arch/x86/realmode/.built-in.o.cmd arch/x86/realmode/.init.o.cmd arch/x86/realmode/.rmpiggy.o.cmd
++ head -n1
+ parent=
++ grep -l 'arch/x86/realmode/built-in\.o' arch/x86/realmode/.built-in.o.cmd arch/x86/realmode/.init.o.cmd arch/x86/realmode/.rmpiggy.o.cmd
++ grep -v arch/x86/realmode/.built-in.o.cmd
++ wc -l
+ num=0
+ [[ 0 -eq 0 ]]
+ PARENT=
+ return
+ [[ -n '' ]]
+ [[ -z '' ]]
+ [[ arch/x86/realmode/built-in.o = *.ko ]]
+ case $KOBJFILE in
+ KOBJFILE=vmlinux
+ return
+ [[ vmlinux = vmlinux ]]
+ KOBJFILE=/usr/lib/debug/boot/vmlinux-3.13.0-24-generic
+ cd /root/.kpatch/tmp
+ [[ -e orig/arch/x86/realmode/rmpiggy.o ]]
+ /usr/local/libexec/kpatch/create-diff-object orig/arch/x86/realmode/rmpiggy.o patched/arch/x86/realmode/rmpiggy.o /usr/lib/debug/boot/vmlinux-3.13.0-24-generic output/arch/x86/realmode/rmpiggy.o /root/.kpatch/src/Module.symvers kpatch_my
+ tee -a /root/.kpatch/build.log
rmpiggy.o: arg0: orig/arch/x86/realmode/rmpiggy.o, arg1: patched/arch/x86/realmode/rmpiggy.o, arg2: /usr/lib/debug/boot/vmlinux-3.13.0-24-generic, arg3: output/arch/x86/realmode/rmpiggy.o, arg4: /root/.kpatch/src/Module.symvers, arg5: kpatch_my 
rmpiggy.o: name: , type: 0, index: 0, bind: 0 
rmpiggy.o: name: .text, type: 3, index: 1, bind: 0 
rmpiggy.o: name: .data, type: 3, index: 2, bind: 0 
rmpiggy.o: name: .bss, type: 3, index: 3, bind: 0 
rmpiggy.o: name: .init.data, type: 3, index: 4, bind: 0 
rmpiggy.o: name: real_mode_blob, type: 0, index: 5, bind: 1 
rmpiggy.o: name: real_mode_blob_end, type: 0, index: 6, bind: 1 
rmpiggy.o: name: real_mode_relocs, type: 0, index: 7, bind: 1 
/usr/local/libexec/kpatch/create-diff-object: ERROR: rmpiggy.o: main: 2507: FILE symbol not found in base. Stripped?

+ check_pipe_status create-diff-object
+ rc=1
+ [[ 1 = 139 ]]
+ [[ 1 -eq 0 ]]
+ [[ 1 -eq 3 ]]
++ expr 0 + 1
+ ERROR=1
+ [[ 1 -eq 0 ]]
+ for i in '$FILES'
+ [[ ubuntu = rhel ]]
+ [[ ubuntu = centos ]]
+ [[ ubuntu = ol ]]
+ [[ fs/proc/meminfo.o = usr/initramfs_data.o ]]
++ dirname fs/proc/meminfo.o
+ mkdir -p output/fs/proc
+ cd /root/.kpatch/src
+ find_kobj fs/proc/meminfo.o
+ arg=fs/proc/meminfo.o
+ KOBJFILE=fs/proc/meminfo.o
+ DEEP_FIND=0
+ ERROR_IF_DIFF=
+ true
+ find_parent_obj fs/proc/meminfo.o
++ dirname fs/proc/meminfo.o
+ dir=fs/proc
++ readlink -f fs/proc
+ absdir=/root/.kpatch/src/fs/proc
++ readlink -f .
+ pwddir=/root/.kpatch/src
+ pdir=fs/proc
++ basename fs/proc/meminfo.o
+ file=meminfo.o
+ grepname=fs/proc/meminfo
+ grepname='fs/proc/meminfo\.o'
+ [[ 0 -eq 1 ]]
++ grep -v fs/proc/.meminfo.o.cmd
++ grep -l 'fs/proc/meminfo\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ head -n1
+ parent=fs/proc/.proc.o.cmd
++ grep -v fs/proc/.meminfo.o.cmd
++ grep -l 'fs/proc/meminfo\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ wc -l
+ num=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -gt 1 ]]
++ dirname fs/proc/.proc.o.cmd
+ dir=fs/proc
++ basename fs/proc/.proc.o.cmd
+ PARENT=.proc.o.cmd
+ PARENT=proc.o.cmd
+ PARENT=proc.o
+ PARENT=fs/proc/proc.o
+ [[ ! -e fs/proc/proc.o ]]
+ [[ -n fs/proc/proc.o ]]
+ DEEP_FIND=0
+ [[ -z fs/proc/proc.o ]]
+ KOBJFILE=fs/proc/proc.o
+ true
+ find_parent_obj fs/proc/proc.o
++ dirname fs/proc/proc.o
+ dir=fs/proc
++ readlink -f fs/proc
+ absdir=/root/.kpatch/src/fs/proc
++ readlink -f .
+ pwddir=/root/.kpatch/src
+ pdir=fs/proc
++ basename fs/proc/proc.o
+ file=proc.o
+ grepname=fs/proc/proc
+ grepname='fs/proc/proc\.o'
+ [[ 0 -eq 1 ]]
++ grep -v fs/proc/.proc.o.cmd
++ grep -l 'fs/proc/proc\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ head -n1
+ parent=fs/proc/.built-in.o.cmd
++ grep -v fs/proc/.proc.o.cmd
++ grep -l 'fs/proc/proc\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ wc -l
+ num=1
+ [[ 1 -eq 0 ]]
+ [[ 1 -gt 1 ]]
++ dirname fs/proc/.built-in.o.cmd
+ dir=fs/proc
++ basename fs/proc/.built-in.o.cmd
+ PARENT=.built-in.o.cmd
+ PARENT=built-in.o.cmd
+ PARENT=built-in.o
+ PARENT=fs/proc/built-in.o
+ [[ ! -e fs/proc/built-in.o ]]
+ [[ -n fs/proc/built-in.o ]]
+ DEEP_FIND=0
+ [[ -z fs/proc/built-in.o ]]
+ KOBJFILE=fs/proc/built-in.o
+ true
+ find_parent_obj fs/proc/built-in.o
++ dirname fs/proc/built-in.o
+ dir=fs/proc
++ readlink -f fs/proc
+ absdir=/root/.kpatch/src/fs/proc
++ readlink -f .
+ pwddir=/root/.kpatch/src
+ pdir=fs/proc
++ basename fs/proc/built-in.o
+ file=built-in.o
+ grepname=fs/proc/built-in
+ grepname='fs/proc/built-in\.o'
+ [[ 0 -eq 1 ]]
++ grep -l 'fs/proc/built-in\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ grep -v fs/proc/.built-in.o.cmd
++ head -n1
+ parent=
++ wc -l
++ grep -l 'fs/proc/built-in\.o' fs/proc/.array.o.cmd fs/proc/.base.o.cmd fs/proc/.built-in.o.cmd fs/proc/.cmdline.o.cmd fs/proc/.consoles.o.cmd fs/proc/.cpuinfo.o.cmd fs/proc/.devices.o.cmd fs/proc/.fd.o.cmd fs/proc/.generic.o.cmd fs/proc/.inode.o.cmd fs/proc/.interrupts.o.cmd fs/proc/.kcore.o.cmd fs/proc/.kmsg.o.cmd fs/proc/.loadavg.o.cmd fs/proc/.meminfo.o.cmd fs/proc/.namespaces.o.cmd fs/proc/.page.o.cmd fs/proc/.proc_net.o.cmd fs/proc/.proc.o.cmd fs/proc/.proc_sysctl.o.cmd fs/proc/.proc_tty.o.cmd fs/proc/.root.o.cmd fs/proc/.self.o.cmd fs/proc/.softirqs.o.cmd fs/proc/.stat.o.cmd fs/proc/.task_mmu.o.cmd fs/proc/.uptime.o.cmd fs/proc/.version.o.cmd fs/proc/.version_signature.o.cmd fs/proc/.vmcore.o.cmd
++ grep -v fs/proc/.built-in.o.cmd
+ num=0
+ [[ 0 -eq 0 ]]
+ PARENT=
+ return
+ [[ -n '' ]]
+ [[ -z '' ]]
+ [[ fs/proc/built-in.o = *.ko ]]
+ case $KOBJFILE in
+ KOBJFILE=vmlinux
+ return
+ [[ vmlinux = vmlinux ]]
+ KOBJFILE=/usr/lib/debug/boot/vmlinux-3.13.0-24-generic
+ cd /root/.kpatch/tmp
+ [[ -e orig/fs/proc/meminfo.o ]]
+ /usr/local/libexec/kpatch/create-diff-object orig/fs/proc/meminfo.o patched/fs/proc/meminfo.o /usr/lib/debug/boot/vmlinux-3.13.0-24-generic output/fs/proc/meminfo.o /root/.kpatch/src/Module.symvers kpatch_my
+ tee -a /root/.kpatch/build.log
meminfo.o: arg0: orig/fs/proc/meminfo.o, arg1: patched/fs/proc/meminfo.o, arg2: /usr/lib/debug/boot/vmlinux-3.13.0-24-generic, arg3: output/fs/proc/meminfo.o, arg4: /root/.kpatch/src/Module.symvers, arg5: kpatch_my 
meminfo.o: name: , type: 0, index: 0, bind: 0 
meminfo.o: name: meminfo.c, type: 4, index: 1, bind: 0 
meminfo.o: changed function: meminfo_proc_show
+ check_pipe_status create-diff-object
+ rc=0
+ [[ 0 = 139 ]]
+ [[ 0 -eq 0 ]]
+ [[ 0 -eq 0 ]]
+ [[ -n '' ]]
+ CHANGED=1
+ objnames[${#objnames[@]}]=/usr/lib/debug/boot/vmlinux-3.13.0-24-generic
+ [[ 1 -ne 0 ]]
+ die '1 error(s) encountered'
+ [[ -z 1 error(s) encountered ]]
+ msg='1 error(s) encountered'
+ [[ -e /root/.kpatch/build.log ]]
+ warn '1 error(s) encountered. Check /root/.kpatch/build.log for more details.'
+ echo 'ERROR: 1 error(s) encountered. Check /root/.kpatch/build.log for more details.'
ERROR: 1 error(s) encountered. Check /root/.kpatch/build.log for more details.
+ exit 1

Here is some output after making changes in the source code.
rmpiggy.o: arg0: orig/arch/x86/realmode/rmpiggy.o, arg1: patched/arch/x86/realmode/rmpiggy.o, arg2: /usr/lib/debug/boot/vmlinux-3.13.0-24-generic, arg3: output/arch/x86/realmode/rmpiggy.o, arg4: /root/.kpatch/src/Module.symvers, arg5: kpatch_my
=== section list (7) ===
ndx 01, data (nil), size 0, name .text
ndx 02, data (nil), size 0, name .data
ndx 03, data (nil), size 0, name .bss
ndx 04, data 0x7f0d23f95000, size 21184, name .init.data
ndx 05, data 0x7f0d23f9a2c0, size 49, name .shstrtab
ndx 06, data 0x7f0d23f9a4f8, size 192, name .symtab
ndx 07, data 0x7f0d23f9a5b8, size 52, name .strtab

=== symbol list (8 entries) ===
sym 00, type 0, bind 0, ndx 00, name
sym 01, type 3, bind 0, ndx 01, name .text -> .text
sym 02, type 3, bind 0, ndx 02, name .data -> .data
sym 03, type 3, bind 0, ndx 03, name .bss -> .bss
sym 04, type 3, bind 0, ndx 04, name .init.data -> .init.data
sym 05, type 0, bind 1, ndx 04, name real_mode_blob -> .init.data
sym 06, type 0, bind 1, ndx 04, name real_mode_blob_end -> .init.data
sym 07, type 0, bind 1, ndx 04, name real_mode_relocs -> .init.data
=== section list (7) ===
ndx 01, data (nil), size 0, name .text
ndx 02, data (nil), size 0, name .data
ndx 03, data (nil), size 0, name .bss
ndx 04, data 0x7f0d23f8e000, size 21184, name .init.data
ndx 05, data 0x7f0d23f932c0, size 49, name .shstrtab
ndx 06, data 0x7f0d23f934f8, size 192, name .symtab
ndx 07, data 0x7f0d23f935b8, size 52, name .strtab

=== symbol list (8 entries) ===
sym 00, type 0, bind 0, ndx 00, name
sym 01, type 3, bind 0, ndx 01, name .text -> .text
sym 02, type 3, bind 0, ndx 02, name .data -> .data
sym 03, type 3, bind 0, ndx 03, name .bss -> .bss
sym 04, type 3, bind 0, ndx 04, name .init.data -> .init.data
sym 05, type 0, bind 1, ndx 04, name real_mode_blob -> .init.data
sym 06, type 0, bind 1, ndx 04, name real_mode_blob_end -> .init.data
sym 07, type 0, bind 1, ndx 04, name real_mode_relocs -> .init.data
rmpiggy.o: name: , type: 0, index: 0, bind: 0
rmpiggy.o: name: .text, type: 3, index: 1, bind: 0
rmpiggy.o: name: .data, type: 3, index: 2, bind: 0
rmpiggy.o: name: .bss, type: 3, index: 3, bind: 0
rmpiggy.o: name: .init.data, type: 3, index: 4, bind: 0
rmpiggy.o: name: real_mode_blob, type: 0, index: 5, bind: 1
rmpiggy.o: name: real_mode_blob_end, type: 0, index: 6, bind: 1
rmpiggy.o: name: real_mode_relocs, type: 0, index: 7, bind: 1
/usr/local/libexec/kpatch/create-diff-object: ERROR: rmpiggy.o: main: 2507: FILE symbol not found in base. Stripped?

JL edit: wrap terminal output in code block for readability

lilianli2020 commented 7 years ago

It's wired that only the fs/proc/meminfo.c is changed, but the rmpiggy is marked as changed objs. I also tried this code patch in centos 7, it didn't include the rmpiggy.o objs. Not sure why is the difference, could the expert explain the root cause?

joe-lawrence commented 7 years ago

I can repro with a newer Ubuntu 3.13.0-xyz-generic kernel:

% uname -r
3.13.0-119-generic

% kpatch-build --skip-cleanup -t vmlinux my.patch
...
/usr/local/libexec/kpatch/create-diff-object: ERROR: rmpiggy.o: main: 2503: FILE symbol not found in base. Stripped?
...
% sum orig/arch/x86/realmode/rmpiggy.o \
      patched/arch/x86/realmode/rmpiggy.o
64359    26 orig/arch/x86/realmode/rmpiggy.o
64359    26 patched/arch/x86/realmode/rmpiggy.o

I haven't spent the time to figure out why its rebuilding, but since it's an assembly file, we can't patch it anyway. Perhaps we add rmpiggy.o to the kpatch-gcc ignore list?

lilianli2020 commented 7 years ago

@joe-lawrence Thanks so much for the quick response. I've tried to add the rmpiggy.o into the ignore list, though the kpatch-build succeeds, the kpatch can't load the module with the error "insmod: ERROR: could not insert module kpatch-my.ko: Unknown symbol in module".

lilianli2020 commented 7 years ago

I compare the kpatch-build process in the centos and ubuntu, I find that when building the new vmlinux with the new patch, there are different module built in the centos and ubuntu, only in the ubuntu the rmpiggy.o is built. So I'm wondering whether there is some issue in the build process.

joe-lawrence commented 7 years ago

@lilyatlenovo - I saw that insmod error too, but ran out of time to fully debug. I think the issue is that the Ubuntu 3.13.0-xyz-generic kernels are pre-livepatch, so it needs the kpatch code. The symbol in question is kobj_sysfs_ops in kmod/patch/kpatch-patch-hook.c and those older Ubuntu kernels aren't exporting the symbol. I'm out of the office the rest of the week, but can take a closer look next week.

As for rmpiggy.o, I don't really understand why it's rebuilding in the Ubuntu cfg but not the others. I think this behavior might be specific to Ubuntu 3.13.0-xyz-generic kernels as I don't think we ever saw that problem with the newer 4.4 based linux-generic-lts-xenial counterparts.

joe-lawrence commented 7 years ago

@lilyatlenovo - FYI opened #709 to track the unknown symbol error

joe-lawrence commented 1 year ago

Old issue that hasn't re-appeared from in other Ubuntu user reports, closing.