From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757120AbcBDWLl (ORCPT ); Thu, 4 Feb 2016 17:11:41 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35856 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093AbcBDWLj (ORCPT ); Thu, 4 Feb 2016 17:11:39 -0500 Date: Thu, 4 Feb 2016 14:11:37 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Dmitry Vyukov 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 In-Reply-To: <1454610480-87854-1-git-send-email-dvyukov@google.com> Message-ID: References: <56B38F3F.40706@hurleysoftware.com> <1454610480-87854-1-git-send-email-dvyukov@google.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.