Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753353AbbDMImi (ORCPT ); Mon, 13 Apr 2015 04:42:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48894 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbbDMImh (ORCPT ); Mon, 13 Apr 2015 04:42:37 -0400 Date: Mon, 13 Apr 2015 10:44:50 +0200 From: Petr Mladek To: Minfei Huang Cc: jpoimboe@redhat.com, sjenning@redhat.com, jkosina@suse.cz, vojtech@suse.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] livepatch: Fix the bug if the function name is larger than KSYM_NAME_LEN-1 Message-ID: <20150413084450.GB16088@pathway.suse.cz> References: <1428844554-4015-1-git-send-email-minfei.huang@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2253 Lines: 62 On Sun 2015-04-12 21:15:54, Minfei Huang wrote: > For now, the kallsyms will only store the first (KSYM_NAME_LEN-1). The > kallsyms name is same for the function which first (KSYM_NAME_LEN-1) is > same, but the rest is not. > > Then function will never be patched, although function name and address > are provided both. The reason caused this bug is livepatch cannt > recognize the function name. > > Now, livepatch will verify the function name with first (KSYM_NAME_LEN-1) > and address, if provided. Once they are matched, we can confirm that the > patched function is found. This patch kind of make sense for vmlinux addresses. But are there functions with such a long names (>128 characters)? I hope not. They would never fit 80 characters per-line. In each case, it does not make sense for modules because we are not able to find the symbol via old_addr. Best Regards, Petr > Signed-off-by: Minfei Huang > --- > kernel/livepatch/core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index ff42c29..eed719d 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -210,7 +210,7 @@ static int klp_verify_vmlinux_callback(void *data, const char *name, > struct klp_verify_args *args = data; > > if (!mod && > - !strcmp(args->name, name) && > + !strncmp(args->name, name, KSYM_NAME_LEN-1) && > args->addr == addr) > return 1; > > @@ -226,7 +226,7 @@ static int klp_verify_module_callback(void *data, const char *name, > return 0; > > if (!strcmp(args->objname, mod->name) && > - !strcmp(args->name, name) && > + !strncmp(args->name, name, KSYM_NAME_LEN-1) && > args->addr == addr) > return 1; > > -- > 2.2.2 > > -- > To unsubscribe from this list: send the line "unsubscribe live-patching" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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/