On 09/10/2017 10:36 PM, xiaoggchen(陈小光) wrote:
> When there are ".." in source object path then current kpatch-gcc can not 
> handle it correctly:
> kpatch-gcc use the following logic to check the objects who got recompiled 
> and would write the changed
> objects to "chagned_objs". But if the path of the input obj is something 
> like"arch/x86/kvm/../../../virt/kvm/.tmp_kvm_main.o"
> then the following logic can not handle it properly, the kvm_main.o will fall 
> into the "*.*.o" branch.
> And kpatch-build will end up with "ERROR: no changed objects found. Check 
> /root/.kpatch/build.log for more details."
> 
> kpatch/kpatch-build/kpatch-gcc:
>  ......
>  case "$obj" in
>                                 *.mod.o|\
>                                 *built-in.o|\
>                                 vmlinux.o|\
>                                 .tmp_kallsyms1.o|\
>                                 .tmp_kallsyms2.o|\
>                                 init/version.o|\
>                                 arch/x86/boot/version.o|\
>                                 arch/x86/boot/compressed/eboot.o|\
>                                 arch/x86/boot/header.o|\
>                                 arch/x86/boot/compressed/efi_stub_64.o|\
>                                 arch/x86/boot/compressed/piggy.o|\
>                                 kernel/system_certificates.o|\
>                                 arch/x86/vdso/*|\
>                                 arch/x86/entry/vdso/*|\
>                                 drivers/firmware/efi/libstub/*|\
>                                 arch/powerpc/kernel/prom_init.o|\
>                                 *.*.o)
>                                         break
>                                         ;;
>                                 *.o)
>                                         mkdir -p 
> "$KPATCH_GCC_TEMPDIR/orig/$(dirname $obj)"
>                                         [[ -e $obj ]] && cp -f "$obj" 
> "$KPATCH_GCC_TEMPDIR/orig/$obj"
>                                         echo "$obj" >> 
> "$KPATCH_GCC_TEMPDIR/changed_objs"
>                                         break
>                                         ;;
>                                 *)
>                                         break
>                                         ;;
>                         esac
>  ......
> 
> Signed-off-by: chen xiaoguang <[email protected]>
> 
> ---
>  kpatch-build/kpatch-gcc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kpatch-build/kpatch-gcc b/kpatch-build/kpatch-gcc
> index e91f4b2..ffa9bc3 100755
> --- a/kpatch-build/kpatch-gcc
> +++ b/kpatch-build/kpatch-gcc
> @@ -38,7 +38,8 @@ if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then
>                                 arch/x86/entry/vdso/*|\
>                                 drivers/firmware/efi/libstub/*|\
>                                 arch/powerpc/kernel/prom_init.o|\
> -                               *.*.o)
> +                               *[^.].[^.]*.o|\
> +                               .*[0-9].o)
>                                         break
>                                         ;;
>                                 *.o)
> --
> 1.8.3.1

I think the modification to the glob for issue #686 [1] is inadvertently
added those ".." directories to its ignore list.

[1] https://github.com/dynup/kpatch/issues/686

I tinkered a little while trying to exclude the ".." patterns, including
enabling extended glob support (shopt -s extglob) and came away for
ever-more complicated patterns.

If I read the history of PR 686 [1] correctly, I think we added the
leading wildcard in front of ".*.o" when we wanted to exclude
.lib_exports.o files.  Maybe it would be simpler to revert back to
".*.o" and add a new "*/.lib_exports.o" pattern.

But to be honest, I don't fully understand what the two new patterns
you've added will be matching... so perhaps an explanation will show
that they are simpler than my suggestion.

Thanks,

-- Joe

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

Reply via email to