Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327228

Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc
Date 2016-02-04 23:20 +0100
Message-ID <qYApP-887-3@gated-at.bofh.it> (permalink)
References <qYwmf-5e9-23@gated-at.bofh.it> <qYwPg-5Eq-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc() Dmitry Vyukov <dvyukov@google.com> - 2016-02-04 17:00 +0100
  Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc() Peter Hurley <peter@hurleysoftware.com> - 2016-02-04 19:00 +0100
    [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc Dmitry Vyukov <dvyukov@google.com> - 2016-02-04 19:30 +0100
      Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc David Rientjes <rientjes@google.com> - 2016-02-04 23:20 +0100
        Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc Dmitry Vyukov <dvyukov@google.com> - 2016-02-05 08:10 +0100
          Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-02-05 11:40 +0100
          Re: [PATCH] tty: use __GFP_NOWARN for user-controlled kmalloc David Rientjes <rientjes@google.com> - 2016-02-05 11:40 +0100

csiph-web