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:   Fri, 17 Apr 2020 16:49:15 +0200
From:   Sam Ravnborg <sam@...nborg.org>
To:     Nicolas Pitre <nico@...xnic.net>,
        Greg KH <gregkh@...uxfoundation.org>
Cc:     gregkh@...uxfoundation.org, Adam Borowski <kilobyte@...band.pl>,
        Chen Wandun <chenwandun@...wei.com>, jslaby@...e.com,
        daniel.vetter@...ll.ch, b.zolnierkie@...sung.com, lukas@...ner.de,
        ghalat@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vt: don't hardcode the mem allocation upper bound

Hi Greg.

I assume you will take this patch.
Not really drm-misc material.

	Sam

On Sat, Mar 28, 2020 at 05:32:42PM -0400, Nicolas Pitre wrote:
> The code in vc_do_resize() bounds the memory allocation size to avoid
> exceeding MAX_ORDER down the kzalloc() call chain and generating a 
> runtime warning triggerable from user space. However, not only is it
> unwise to use a literal value here, but MAX_ORDER may also be
> configurable based on CONFIG_FORCE_MAX_ZONEORDER.
> Let's use KMALLOC_MAX_SIZE instead.
> 
> Note that prior commit bb1107f7c605 ("mm, slab: make sure that 
> KMALLOC_MAX_SIZE will fit into MAX_ORDER") the KMALLOC_MAX_SIZE value
> could not be relied upon.
> 
> Signed-off-by: Nicolas Pitre <nico@...xnic.net>
> Cc: <stable@...r.kernel.org> # v4.10+
> 
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 15d2769805..37c5f21490 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -1193,7 +1193,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
>  	if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
>  		return 0;
>  
> -	if (new_screen_size > (4 << 20))
> +	if (new_screen_size > KMALLOC_MAX_SIZE)
>  		return -EINVAL;
>  	newscreen = kzalloc(new_screen_size, GFP_USER);
>  	if (!newscreen)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ