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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 12 Jul 2011 15:24:49 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Akinobu Mita <akinobu.mita@...il.com>
Cc:	linux-kernel@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>
Subject: Re: [PATCH] libfs: fix simple_attr_write on 32bit machine

On Sat,  9 Jul 2011 14:00:26 +0900
Akinobu Mita <akinobu.mita@...il.com> wrote:

> Assume that /sys/kernel/debug/dummy64 is debugfs file created by
> debugfs_create_x64().
> 
> 	# cd /sys/kernel/debug
> 	# echo 0x1234567812345678 > dummy64
> 	# cat dummy64
> 	0x0000000012345678
> 
> 	# echo 0x80000000 > dummy64
> 	# cat dummy64
> 	0xffffffff80000000
> 
> The value more than INT_MAX cannot be written to the debugfs file
> created by debugfs_create_u64 or debugfs_create_x64 on 32bit machine.
> Because simple_attr_write() uses simple_strtol() for the conversion.
> 
> To fix this, use simple_strtoll() instead.
> 
> Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
> Cc: Greg Kroah-Hartman <gregkh@...e.de>
> ---
>  fs/libfs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/libfs.c b/fs/libfs.c
> index c88eab5..275ca474 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -822,7 +822,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
>  		goto out;
>  
>  	attr->set_buf[size] = '\0';
> -	val = simple_strtol(attr->set_buf, NULL, 0);
> +	val = simple_strtoll(attr->set_buf, NULL, 0);
>  	ret = attr->set(attr->data, val);
>  	if (ret == 0)
>  		ret = len; /* on success, claim we got the whole input */

It should strictly be simple_strtoull(), but I guess that doesn't
change anything.

And it should always have been strict_*(), now known as kstrto*().  But
that interface fix is non-back-compatible so it's too late to fix it.

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