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:	Thu, 4 Sep 2014 13:14:08 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Scotty Bauer <sbauer@....utah.edu>
Cc:	linux-kernel@...r.kernel.org, clemens@...isch.de
Subject: Re: [PATCH] kern/sys: Compat sysinfo syscall fix undefined behavior

On Thu, 04 Sep 2014 12:46:53 -0600 Scotty Bauer <sbauer@....utah.edu> wrote:

> Fix undefined behavior and compiler warning by replacing right
> shift 32 with upper_32_bits macro
> 
> Signed-off-by: Scotty Bauer <sbauer@....utah.edu>
> ---
>  kernel/sys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sys.c b/kernel/sys.c
> index ce81291..c78530b 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2135,7 +2135,7 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
>  	/* Check to see if any memory value is too large for 32-bit and scale
>  	 *  down if needed
>  	 */
> -	if ((s.totalram >> 32) || (s.totalswap >> 32)) {
> +	if (upper_32_bits(s.totalram) || upper_32_bits(s.totalswap)) {
>  		int bitcount = 0;
>  
>  		while (s.mem_unit < PAGE_SIZE) {

Fair enough.

If I'm reading it correctly, this is all dead code because si_meminfo()
unconditionally sets sysinfo.mem_unit to PAGE_SIZE.

It could all do with a bit of a cleanup, I suspect.
--
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