All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Benes <mbenes@suse.cz>
To: Chris J Arges <chris.j.arges@canonical.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Jiri Kosina <jikos@kernel.org>,
	jeyu@redhat.com, eugene.shatokhin@rosalab.ru,
	live-patching@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	pmladek@suse.cz
Subject: Re: Bug with paravirt ops and livepatches
Date: Wed, 6 Apr 2016 16:17:37 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LNX.2.00.1604061615550.30748@pobox.suse.cz> (raw)
In-Reply-To: <20160406134833.GA12961@canonical.com>

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
> 

      reply	other threads:[~2016-04-06 14:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29 12:05 Bug with paravirt ops and livepatches Chris J Arges
2016-03-29 13:01 ` Miroslav Benes
2016-03-29 13:05   ` Jiri Kosina
2016-04-01 15:01     ` Jiri Kosina
2016-04-01 15:46       ` Miroslav Benes
2016-04-01 16:01         ` Chris J Arges
2016-04-01 19:07         ` Chris J Arges
2016-04-01 19:35           ` Jiri Kosina
2016-04-04 16:14             ` Josh Poimboeuf
2016-04-04 17:58               ` Jessica Yu
2016-04-05 13:07               ` Miroslav Benes
2016-04-05 13:53                 ` Evgenii Shatokhin
2016-04-05 14:24                 ` Josh Poimboeuf
2016-04-05 19:19                 ` Jessica Yu
2016-04-06  8:30                   ` Miroslav Benes
2016-04-06  8:43                     ` Miroslav Benes
2016-04-06  9:09                       ` Miroslav Benes
2016-04-06 17:23                       ` Jessica Yu
2016-04-06 16:55                   ` Jessica Yu
2016-04-05 23:27                 ` Chris J Arges
2016-04-06  9:09                   ` Miroslav Benes
2016-04-06 10:38                     ` Chris J Arges
2016-04-06 12:09                       ` Miroslav Benes
2016-04-06 13:48                         ` Chris J Arges
2016-04-06 14:17                           ` Miroslav Benes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1604061615550.30748@pobox.suse.cz \
    --to=mbenes@suse.cz \
    --cc=chris.j.arges@canonical.com \
    --cc=eugene.shatokhin@rosalab.ru \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=pmladek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.