Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372557

Re: Bug with paravirt ops and livepatches

From Miroslav Benes <mbenes@suse.cz>
Newsgroups linux.kernel
Subject Re: Bug with paravirt ops and livepatches
Date 2016-04-06 16:20 +0200
Message-ID <rkWtk-56i-23@gated-at.bofh.it> (permalink)
References (6 earlier) <rkIA1-37t-5@gated-at.bofh.it> <rkRMZ-1BH-1@gated-at.bofh.it> <rkT2p-2qe-1@gated-at.bofh.it> <rkUrx-3zX-11@gated-at.bofh.it> <rkW0i-4AR-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 6 Apr 2016, Chris J Arges wrote:

> On Wed, Apr 06, 2016 at 02:09:01PM +0200, Miroslav Benes wrote:
> > On Wed, 6 Apr 2016, Chris J Arges wrote:
> > 
> > > I think this approach needs more thought and my code has bug(s).
> > 
> > And indeed there is...
> > 
> > long (*__kvm_arch_vm_ioctl)(struct file *filp, unsigned long ioctl, unsigned long arg) = NULL;
> > 
> > Use a different name than __kvm_arch_vm_ioctl and (ideally) make it 
> > static.
> > 
> > kallsyms_lookup_name("__kvm_arch_vm_ioctl") returns the address of this 
> > variable from the patch module.
> > 
> > Miroslav
> >
> 
> Well that was the bug, I was really stumped why it was giving me a wierd
> address for a function. Once I changed my pointer name to something else it
> worked, so there was no difference to these approaches. I also had to modify
> the symbol lookup to happen in the livepatch so we ensure that the module is
> loaded in this case and not get a NULL deref.

Just a remark. With this change there is a call to kallsyms_lookup_name 
for each call to patched function. This is not optimal. What we do in 
kgraft is that we register a module notifier which calls 
kallsyms_lookup_name when to-be-patched module arrives. It is not nice but 
it works.

Miroslav

> 
> The fixed code is here:
> http://people.canonical.com/~arges/livepatch_issue/livepatch_kvm_arch_vm_ioctl.works.2/
> 
> This out of tree patch doesn't have the same failure as building a patch with
> kpatch-build which is what we expect since it doesn't have livepatch relocs. In
> addition I tested with the kvm module loaded _after_ the livepatch module and
> no failure was observed.
> 
> --chris
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Bug with paravirt ops and livepatches Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-04 18:20 +0200
  Re: Bug with paravirt ops and livepatches Jessica Yu <jeyu@redhat.com> - 2016-04-04 20:00 +0200
  Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-05 15:10 +0200
    Re: Bug with paravirt ops and livepatches Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-05 16:30 +0200
    Re: Bug with paravirt ops and livepatches Jessica Yu <jeyu@redhat.com> - 2016-04-05 21:20 +0200
      Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 10:40 +0200
        Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 10:50 +0200
          Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 11:10 +0200
          Re: Bug with paravirt ops and livepatches Jessica Yu <jeyu@redhat.com> - 2016-04-06 19:30 +0200
      Re: Bug with paravirt ops and livepatches Jessica Yu <jeyu@redhat.com> - 2016-04-06 19:00 +0200
    Re: Bug with paravirt ops and livepatches Chris J Arges <chris.j.arges@canonical.com> - 2016-04-06 01:30 +0200
      Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 11:20 +0200
        Re: Bug with paravirt ops and livepatches Chris J Arges <chris.j.arges@canonical.com> - 2016-04-06 12:40 +0200
          Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 14:10 +0200
            Re: Bug with paravirt ops and livepatches Chris J Arges <chris.j.arges@canonical.com> - 2016-04-06 15:50 +0200
              Re: Bug with paravirt ops and livepatches Miroslav Benes <mbenes@suse.cz> - 2016-04-06 16:20 +0200

csiph-web