Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp934361ybb; Sat, 28 Mar 2020 13:52:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtxDDiKiEPDbASSSxd+GrEBwmMQ7wNPEr4SH65RGR978FcaxKBs3VhViheMY+vSUHdcEcU0 X-Received: by 2002:a9d:6142:: with SMTP id c2mr4000122otk.92.1585428770293; Sat, 28 Mar 2020 13:52:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585428770; cv=none; d=google.com; s=arc-20160816; b=pI8rSFkZD9JMNL+4Se5NXNNerLpUpWOxa/Z5xnX8z9fFCzSE4DZc1UvXbZ91dTrGRw UyOb4rECPGCFqGX/o+w2HZwj//dRYPBLiiq6m1tIM/1UG6L7RqB7F6hMYYYlAlKq/34B unHdy1rZrkDaEzNpnt3zB1tvLj1hLlnuOSwNyuA5jMBaGhCMMoqvvZlmeaSTaBoT08Q4 +hfmHNdPglxQbS9lzdcFSl6XeSKJJm+OMWqg48Qf6b2uQfdtLDe19s8hAGmY96ysKpbu UznW6ID1Ex1Asx55IWmGylnzyJvZKG1OmX02lcaEn6XDN+0i85MSBgaKskSdue4Ys/Lx j0Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=zz2G4snHG1hnjw1p/29n6c2oSAXQdmilsfppEuS46to=; b=wR39UNPGfPoUGI3tp4eOiLcWLav19PHP6PTPVZfk+Ur96dR/vMWJ+5LYAYVPhrYIP/ VIE0hZg3o4GBNBVwttQAGb1rWC8wmYXKCg/U7UCdRqww9idaVSM7XZ6R2Sd9/8hsbUQA RLz24eOJB0a45MSdXPYvaAr44Wh/dKGZ6pF+wVKx00Ox9BmjJvcK1W1zL57G/Ve3KbMF VUmICOEM6DTBPTLc2AQxtX1GL1jiOLPLApRnIwGabqY1bnE2a7lMaU1WB3UwKsXsEA6w qGJAZI/eiSBdwlDkuS0zssCLJafKN4R5TZlkf1x+j0x0YwS0YtxPIzvN5glzr8QAG6cY lpzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=qEkTFPur; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=ypSwc9Ri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si3950156oth.136.2020.03.28.13.52.35; Sat, 28 Mar 2020 13:52:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b=qEkTFPur; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b=ypSwc9Ri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbgC1Uuf (ORCPT + 99 others); Sat, 28 Mar 2020 16:50:35 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:62694 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbgC1Uuf (ORCPT ); Sat, 28 Mar 2020 16:50:35 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 1100243590; Sat, 28 Mar 2020 16:50:33 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=MVnJ4eCCBFn2tIDbc7IaRiJ4y4k=; b=qEkTFP urURuXj05IisyZUwOJbdNlYDNyKpD18kZK+S5iGfGsC9XophQUtpGtiwE24lK8FG SG69eeCM8LWv/klhBJTtiYa3adCIAP6GLWPg+nEtGFd0G/IY8KAa7OfuTM+hIGqw rGLvWbYaBqsvDjTFVium1K5Ameb0Tls4uj4jc= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 081854358F; Sat, 28 Mar 2020 16:50:33 -0400 (EDT) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=JASv01FUd5xtHan2jcoYVzXPo3Lp3q4mtypqVd9D1xs=; b=ypSwc9Riz3ofKU5sEtPdwWgP7uwl4R6V8NQJGeTqDgiOKLAV8zXV45VDpvBxBIlGtiiXcz+FxkvPA7daO0H29nlbOFJjvlqUH3dMwWXhRHxLgld0N+kzxGZtzol9BZHHnY/1h4g3/2+hrO1EgFrl/8U5o7AV7XRhi1C32STW8Hc= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 631834358E; Sat, 28 Mar 2020 16:50:32 -0400 (EDT) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 721EC2DA0174; Sat, 28 Mar 2020 16:50:31 -0400 (EDT) Date: Sat, 28 Mar 2020 16:50:31 -0400 (EDT) From: Nicolas Pitre To: Adam Borowski cc: Chen Wandun , jslaby@suse.com, gregkh@linuxfoundation.org, daniel.vetter@ffwll.ch, sam@ravnborg.org, b.zolnierkie@samsung.com, lukas@wunner.de, ghalat@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH next] vt: fix a warning when kmalloc alloc large memory In-Reply-To: <20200328031257.GA30454@angband.pl> Message-ID: References: <20200328021340.27315-1-chenwandun@huawei.com> <20200328031257.GA30454@angband.pl> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: C4076B7C-7135-11EA-AB05-C28CBED8090B-78420484!pb-smtp1.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 28 Mar 2020, Adam Borowski wrote: > On Fri, Mar 27, 2020 at 10:55:14PM -0400, Nicolas Pitre wrote: > > On Sat, 28 Mar 2020, Chen Wandun wrote: > > > > > If the memory size that use kmalloc() to allocate exceed MAX_ORDER pages, > > > it will hit the WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)), so add memory > > > allocation flag __GFP_NOWARN to silence a warning, othervise, it will > > > cause panic if panic_on_warn is enable. > > > > Wow! How do you manage that? You need something like a 1024x1024 text > > screen to get such a big memory allocation. > > ioctl(VT_RESIZE) allows up to 32767x32767, unprivileged for a local user. > That's 4GB per console. In fact that's not exactly true. The code has this protection: if (new_screen_size > (4 << 20)) return -EINVAL; The problem is with the unicode screen content whose buffer is larger than the legacy glyph buffer. Still, the above test is a bit iffy as it depends on the default MAX_ORDER value which is configurable. Nicolas