lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 16 Sep 2009 14:28:54 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Paul Mundt <lethal@...ux-sh.org>
CC:	Lai Jiangshan <laijs@...fujitsu.com>,
	Sam Ravnborg <sam@...nborg.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	linux-kbuild@...r.kernel.org, Paulo Marques <pmarques@...popie.com>
Subject: Re: [PATCH] kallsyms: Fix segfault in prefix_underscores_count().

CC: Paulo Marques <pmarques@...popie.com> (who reviewed that patch)

Paul Mundt wrote:
> [ I'm not sure who exactly this should go to, so I've attempted to get all of
>   the interested parties in the Cc. ]
> 
> This is a re-send of a problem that I reported on August 7th, both Sam and Lai
> have been unresponsive, so hopefully someone else can take a look at this.
>

Lai is off office and won't be back in 2 weeks, so I'm afraid
he won't be responsive..

> 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:
> 

But the fix looks obviously correct, as long as @str is guaranteed
to be NULL-terminated.

...
> @@ -584,9 +538,14 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
>  static int prefix_underscores_count(const char *str)
>  {
>  	const char *tail = str;
> +	size_t len = strlen(str);
> +
> +	while (*tail != '_') {
> +		if (!len--)
> +			return 0;
>  
> -	while (*tail != '_')
>  		tail++;
> +	}

Can be simplified as:

	while (*tail != '\0' && *tail != '_')
		tail++;

But..as the name "prefix_underscores_count" suggests, shouldn't
it be:
	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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ