Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752674AbcDFNsr (ORCPT ); Wed, 6 Apr 2016 09:48:47 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:55780 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752090AbcDFNso (ORCPT ); Wed, 6 Apr 2016 09:48:44 -0400 Date: Wed, 6 Apr 2016 14:48:34 +0100 From: Chris J Arges To: Miroslav Benes Cc: Josh Poimboeuf , Jiri Kosina , jeyu@redhat.com, eugene.shatokhin@rosalab.ru, live-patching@vger.kernel.org, Linux Kernel Mailing List , pmladek@suse.cz Subject: Re: Bug with paravirt ops and livepatches Message-ID: <20160406134833.GA12961@canonical.com> References: <20160401190704.GB7837@canonical.com> <20160404161428.3qap2i4vpgda66iw@treble.redhat.com> <20160405232729.GA18198@canonical.com> <20160406103821.GA4968@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1253 Lines: 33 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. 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