Thread (5 messages) 5 messages, 3 authors, 2015-02-03

Re: [PATCH] mm: fix arithmetic overflow in __vm_enough_memory()

From: Roman Gushchin <hidden>
Date: 2015-01-30 13:14:18
Also in: linux-mm, lkml

29.01.2015, 22:57, "Andrew Shewmaker" [off-list ref]:
On Thu, Jan 29, 2015 at 04:06:03PM +0300, Roman Gushchin wrote:
quoted
О©╫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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help