LKML Archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: gregkh@linuxfoundation.org, jslaby@suse.com,
	peter@hurleysoftware.com, gnomes@lxorguk.ukuu.org.uk,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	kcc@google.com, glider@google.com
Subject: Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc
Date: Thu, 4 Feb 2016 14:11:37 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1602041409020.29117@chino.kir.corp.google.com> (raw)
In-Reply-To: <1454610480-87854-1-git-send-email-dvyukov@google.com>

On Thu, 4 Feb 2016, Dmitry Vyukov wrote:

> Size of kmalloc() in vc_do_resize() is controlled by user.
> Too large kmalloc() size triggers WARNING message on console.
> 
> Use __GFP_NOWARN for this kmalloc() to not scare admins.
> 

Hmm, this is hitting the WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)) for 
order >= MAX_ORDER.

vc_do_resize() has

	if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)
		return -EINVAL;

so the appropriate fix would seem to be to reject sizes that would exceed 
the page allocator's ability to return contiguous memory (MAX_ORDER) 
rather than ever trying the allocation in the first place.

  reply	other threads:[~2016-02-04 22:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 15:55 [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc() Dmitry Vyukov
2016-02-04 17:49 ` Peter Hurley
2016-02-04 18:28   ` [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc Dmitry Vyukov
2016-02-04 22:11     ` David Rientjes [this message]
2016-02-05  7:06       ` Dmitry Vyukov
2016-02-05 10:32         ` David Rientjes
2016-02-05 10:35         ` One Thousand Gnomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1602041409020.29117@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).