Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754732AbZJBBch (ORCPT ); Thu, 1 Oct 2009 21:32:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754567AbZJBBcg (ORCPT ); Thu, 1 Oct 2009 21:32:36 -0400 Received: from kroah.org ([198.145.64.141]:32915 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754453AbZJBBcf (ORCPT ); Thu, 1 Oct 2009 21:32:35 -0400 X-Mailbox-Line: From gregkh@mini.kroah.org Thu Oct 1 18:24:07 2009 Message-Id: <20091002012407.846950905@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Thu, 01 Oct 2009 18:16:02 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Paul Mundt , Lai Jiangshan , Sam Ravnborg , Paulo Marques , Ingo Molnar Subject: [014/136] kallsyms: fix segfault in prefix_underscores_count() References: <20091002011548.335611824@mini.kroah.org> Content-Disposition: inline; filename=kallsyms-fix-segfault-in-prefix_underscores_count.patch In-Reply-To: <20091002012911.GA18542@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1927 Lines: 48 2.6.31-stable review patch. If anyone has any objections, please let us know. ------------------ From: Paul Mundt commit a9ece53c4089ef23d4002d34c4c7148d94622a40 upstream. Commit b478b782e110fdb4135caa3062b6d687e989d994 "kallsyms, tracing: output more proper symbol name" introduces a "bugfix" that introduces a segfault in kallsyms in my configurations. The cause is the introduction of prefix_underscores_count() which attempts to count underscores, even in symbols that do not have them. As a result, it just uselessly runs past the end of the buffer until it crashes: CC init/version.o LD init/built-in.o LD .tmp_vmlinux1 KSYM .tmp_kallsyms1.S /bin/sh: line 1: 16934 Done sh-linux-gnu-nm -n .tmp_vmlinux1 16935 Segmentation fault | scripts/kallsyms > .tmp_kallsyms1.S make: *** [.tmp_kallsyms1.S] Error 139 This simplifies the logic and just does a straightforward count. Signed-off-by: Paul Mundt Reviewed-by: Li Zefan Cc: Lai Jiangshan Cc: Sam Ravnborg Cc: Paulo Marques Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -585,7 +585,7 @@ static int prefix_underscores_count(cons { const char *tail = str; - while (*tail != '_') + while (*tail == '_') tail++; return tail - str; -- 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/