lkml.org 
[lkml]   [2020]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH next] vt: fix a warning when kmalloc alloc large memory
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

\
 
 \ /
  Last update: 2020-03-28 21:50    [W:0.059 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site