lkml.org 
[lkml]   [2015]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] mm: fix arithmetic overflow in __vm_enough_memory()
Date
29.01.2015, 22:57, "Andrew Shewmaker" <agshew@gmail.com>:
> On Thu, Jan 29, 2015 at 04:06:03PM +0300, Roman Gushchin wrote:
>>  I noticed, that "allowed" can easily overflow by falling below 0,
>>  because (total_vm / 32) can be larger than "allowed". The problem
>>  occurs in OVERCOMMIT_NONE mode.
>>

> Makes sense to me. Please fix mm/nommu.c also.

Thanks!
I sent a patch for nommu.c.

>
> If a caller passes in a big negative value for pages,
> then vm_acct_memory() would decrement vm_committed_as, possibly
> causing percpu_counter_read_positive(&vm_committed_as) and
> __vm_enough_memory to return 0. Maybe that's okay? Callers
> won't be passing in a negative pages anyway. Is there a reason
> to let them, though?

I think, it isn't a problem, since no one will commit negative values (I hope).

R.


\
 
 \ /
  Last update: 2015-01-30 14:21    [W:0.413 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site