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: <20110908165213.6ebd844f.akpm@linux-foundation.org>
Date:	Thu, 8 Sep 2011 16:52:13 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Ryan Mallon <rmallon@...il.com>
Cc:	Mark Salter <msalter@...hat.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	linux-fsdevel@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Pass correct length to strnlen_user in fs/exec.c

On Thu, 08 Sep 2011 10:39:24 +1000
Ryan Mallon <rmallon@...il.com> wrote:

> Replace valid_arg_len function in fs/exec.c with max_arg_len function
> and pass the correct length to strnlen_user.
> 
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -296,9 +296,9 @@ err:
>  	return err;
>  }
>  
> -static bool valid_arg_len(struct linux_binprm *bprm, long len)
> +static long max_arg_len(struct linux_binprm *bprm)
>  {
> -	return len <= MAX_ARG_STRLEN;
> +	return MAX_ARG_STRLEN;
>  }
>  
>  #else
> @@ -354,9 +354,9 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
>  	return 0;
>  }
>  
> -static bool valid_arg_len(struct linux_binprm *bprm, long len)
> +static long max_arg_len(struct linux_binprm *bprm)
>  {
> -	return len <= bprm->p;
> +	return bprm->p;
>  }
>  
>  #endif /* CONFIG_MMU */
> @@ -474,18 +474,19 @@ static int copy_strings(int argc, struct user_arg_ptr argv,
>  		const char __user *str;
>  		int len;
>  		unsigned long pos;
> +		long max_len = max_arg_len(bprm);
>  
>  		ret = -EFAULT;
>  		str = get_user_arg_ptr(argv, argc);
>  		if (IS_ERR(str))
>  			goto out;
>  
> -		len = strnlen_user(str, MAX_ARG_STRLEN);
> -		if (!len || len > MAX_ARG_STRLEN)
> +		len = strnlen_user(str, max_len);
> +		if (!len)
>  			goto out;
>  
>  		ret = -E2BIG;
> -		if (!valid_arg_len(bprm, len))
> +		if (len > max_len)
>  			goto out;
>  
>  		/* We're going to work our way backwords. */

I'm struggling to find a reason to merge this - it churns code around
rather pointlessly?

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