Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965710AbbKDQ7L (ORCPT ); Wed, 4 Nov 2015 11:59:11 -0500 Received: from r1.smtpout1.alwaysdata.com ([178.33.254.159]:55795 "EHLO r1.smtpout1.alwaysdata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965691AbbKDQ7J (ORCPT ); Wed, 4 Nov 2015 11:59:09 -0500 X-Greylist: delayed 16273 seconds by postgrey-1.27 at vger.kernel.org; Wed, 04 Nov 2015 11:59:08 EST Message-ID: <5639F9B5.6090608@alwaysdata.com> Date: Wed, 04 Nov 2015 13:27:33 +0100 From: "Cyril B." User-Agent: Postbox 3.0.11 (Macintosh/20140602) MIME-Version: 1.0 To: Zhou Chengming CC: jpoimboe@redhat.com, sjenning@redhat.com, jkosina@suse.cz, vojtech@suse.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, guohanjun@huawei.com, huawei.libin@huawei.com, xiexiuqi@huawei.com Subject: Re: [PATCH] livepatch: x86: bugfix about kASLR References: <1446629532-32111-1-git-send-email-zhouchengming1@huawei.com> In-Reply-To: <1446629532-32111-1-git-send-email-zhouchengming1@huawei.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-alwaysdata-ID: 105175687 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 41 Zhou Chengming wrote: > When enable KASLR, func->old_addr will be set to zero > and livepatch will find the right old address. > But for reloc, livepatch just verify it using reloc->val > (old addr from user), so verify failed and report > "kernel mismatch" error. > > Reported-by: Cyril B. > Signed-off-by: Zhou Chengming > --- > kernel/livepatch/core.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index 53196e2..c8885c6 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -311,7 +311,12 @@ static int klp_write_object_relocations(struct module *pmod, > return -EINVAL; > > for (reloc = obj->relocs; reloc->name; reloc++) { > - if (!klp_is_module(obj)) { > + > +#if defined(CONFIG_RANDOMIZE_BASE) > + /* KASLR is enabled, disregard old_addr from user */ > + reloc->val = 0; > +#endif > + if (reloc->val&& !klp_is_module(obj)) { > ret = klp_verify_vmlinux_symbol(reloc->name, > reloc->val); > if (ret) I still get the 'symbol not found in symbol table' error with that patch (on top of Linux 4.3). Cyril -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/