]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: enable RLIMIT_DATA by default with workaround for valgrind
authorKonstantin Khlebnikov <koct9i@gmail.com>
Fri, 20 May 2016 23:57:45 +0000 (16:57 -0700)
committerBrian Maly <brian.maly@oracle.com>
Tue, 10 Sep 2019 14:52:48 +0000 (10:52 -0400)
commit048cfe1189965901cb6ba9f42602895b11d1a767
treef468c1d66e3b81d913c014b03067faede538cf76
parent7f566f0f27e9619c13ae991ae54829217be90d31
mm: enable RLIMIT_DATA by default with workaround for valgrind

Since commit 84638335900f ("mm: rework virtual memory accounting")
RLIMIT_DATA limits both brk() and private mmap() but this's disabled by
default because of incompatibility with older versions of valgrind.

Valgrind always set limit to zero and fails if RLIMIT_DATA is enabled.
Fortunately it changes only rlim_cur and keeps rlim_max for reverting
limit back when needed.

This patch checks current usage also against rlim_max if rlim_cur is
zero.  This is safe because task anyway can increase rlim_cur up to
rlim_max.  Size of brk is still checked against rlim_cur, so this part
is completely compatible - zero rlim_cur forbids brk() but allows
private mmap().

Link: http://lkml.kernel.org/r/56A28613.5070104@de.ibm.com
Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Orabug: 30145754
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
mm/mmap.c

(cherry picked from commit f4fcd55841fc9e46daac553b39361572453c2b88)
Signed-off-by: Tong Chen <tong.c.chen@oracle.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
mm/mmap.c