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]
Message-ID: <20190508084732.GC9224@smile.fi.intel.com>
Date:   Wed, 8 May 2019 11:47:32 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Amritha Nambiar <amritha.nambiar@...el.com>,
        Willem de Bruijn <willemb@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        Matthew Wilcox <willy@...radead.org>,
        "Tobin C . Harding" <tobin@...nel.org>,
        Will Deacon <will.deacon@....com>,
        Miklos Szeredi <mszeredi@...hat.com>,
        Vineet Gupta <vineet.gupta1@...opsys.com>,
        Chris Wilson <chris@...is-wilson.co.uk>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        linux-kernel@...r.kernel.org, Yury Norov <ynorov@...vell.com>,
        Jens Axboe <axboe@...nel.dk>,
        Steffen Klassert <steffen.klassert@...unet.com>
Subject: Re: [PATCH 4/7] lib: make bitmap_parse_user a wrapper on bitmap_parse

On Tue, Apr 30, 2019 at 06:06:33PM -0700, Yury Norov wrote:
> Currently we parse user data byte after byte which leads to
> overcomplicating of parsing algorithm. There are no performance
> critical users of bitmap_parse_user(), and so we can duplicate
> user data to kernel buffer and simply call bitmap_parselist().
> This rework lets us unify and simplify bitmap_parse() and
> bitmap_parse_user(), which is done in the following patch.
> 

Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> Signed-off-by: Yury Norov <ynorov@...vell.com>
> ---
>  lib/bitmap.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/bitmap.c b/lib/bitmap.c
> index f235434df87b..300732031fad 100644
> --- a/lib/bitmap.c
> +++ b/lib/bitmap.c
> @@ -434,22 +434,22 @@ EXPORT_SYMBOL(__bitmap_parse);
>   *    then it must be terminated with a \0.
>   * @maskp: pointer to bitmap array that will contain result.
>   * @nmaskbits: size of bitmap, in bits.
> - *
> - * Wrapper for __bitmap_parse(), providing it with user buffer.
> - *
> - * We cannot have this as an inline function in bitmap.h because it needs
> - * linux/uaccess.h to get the access_ok() declaration and this causes
> - * cyclic dependencies.
>   */
>  int bitmap_parse_user(const char __user *ubuf,
>  			unsigned int ulen, unsigned long *maskp,
>  			int nmaskbits)
>  {
> -	if (!access_ok(ubuf, ulen))
> -		return -EFAULT;
> -	return __bitmap_parse((const char __force *)ubuf,
> -				ulen, 1, maskp, nmaskbits);
> +	char *buf;
> +	int ret;
>  
> +	buf = memdup_user_nul(ubuf, ulen);
> +	if (IS_ERR(buf))
> +		return PTR_ERR(buf);
> +
> +	ret = bitmap_parse(buf, ulen, maskp, nmaskbits);
> +
> +	kfree(buf);
> +	return ret;
>  }
>  EXPORT_SYMBOL(bitmap_parse_user);
>  
> -- 
> 2.17.1
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ