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]
Message-ID: <871uai7tzu.fsf@rustcorp.com.au>
Date:	Wed, 10 Apr 2013 16:27:41 +0930
From:	Rusty Russell <rusty@...tcorp.com.au>
To:	Chen Gang <gang.chen@...anux.com>,
	Stephen Boyd <sboyd@...eaurora.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel: kallsyms: parameters checking, for EXPORT_SYMBOL_GPL functions

Chen Gang <gang.chen@...anux.com> writes:
>   for EXPORT_SYMBOL_GPL functions, necessary to check their parameters.
>
> Signed-off-by: Chen Gang <gang.chen@...anux.com>

Why?

If someone misuses these functions, they crash and thus indicate that
the caller shouldn't do that.

Or is someone already doing this?

Confused,
Rusty.

> ---
>  kernel/kallsyms.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index 2169fee..4ba57a9 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -175,6 +175,9 @@ unsigned long kallsyms_lookup_name(const char *name)
>  	unsigned long i;
>  	unsigned int off;
>  
> +	if (!name || !name[0])
> +		return 0;
> +
>  	for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
>  		off = kallsyms_expand_symbol(off, namebuf);
>  
> @@ -194,6 +197,9 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
>  	unsigned int off;
>  	int ret;
>  
> +	if (!fn)
> +		return -EINVAL;
> +
>  	for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
>  		off = kallsyms_expand_symbol(off, namebuf);
>  		ret = fn(data, namebuf, NULL, kallsyms_addresses[i]);
> @@ -382,6 +388,9 @@ static int __sprint_symbol(char *buffer, unsigned long address,
>   */
>  int sprint_symbol(char *buffer, unsigned long address)
>  {
> +	if (!buffer)
> +		return 0;
> +
>  	return __sprint_symbol(buffer, address, 0, 1);
>  }
>  EXPORT_SYMBOL_GPL(sprint_symbol);
> @@ -399,6 +408,9 @@ EXPORT_SYMBOL_GPL(sprint_symbol);
>   */
>  int sprint_symbol_no_offset(char *buffer, unsigned long address)
>  {
> +	if (!buffer)
> +		return 0;
> +
>  	return __sprint_symbol(buffer, address, 0, 0);
>  }
>  EXPORT_SYMBOL_GPL(sprint_symbol_no_offset);
> -- 
> 1.7.7.6
--
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