mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
mm: warn about VmData over RLIMIT_DATA
This patch provides a way of working around a slight regression
introduced by commit 8463833590 ("mm: rework virtual memory
accounting").
Before that commit RLIMIT_DATA have control only over size of the brk
region. But that change have caused problems with all existing versions
of valgrind, because it set RLIMIT_DATA to zero.
This patch fixes rlimit check (limit actually in bytes, not pages) and
by default turns it into warning which prints at first VmData misuse:
"mmap: top (795): VmData 516096 exceed data ulimit 512000. Will be forbidden soon."
Behavior is controlled by boot param ignore_rlimit_data=y/n and by sysfs
/sys/module/kernel/parameters/ignore_rlimit_data. For now it set to "y".
[[email protected]: tweak kernel-parameters.txt text[
Signed-off-by: Konstantin Khlebnikov <[email protected]>
Link: http://lkml.kernel.org/r/20151228211015.GL2194@uranus
Reported-by: Christian Borntraeger <[email protected]>
Cc: Cyrill Gorcunov <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Vegard Nossum <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Quentin Casasnovas <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Willy Tarreau <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
4758e198ad
commit
d977d56ce5
3 changed files with 38 additions and 6 deletions
|
|
@ -216,6 +216,22 @@ static inline bool is_cow_mapping(vm_flags_t flags)
|
|||
return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
|
||||
}
|
||||
|
||||
static inline bool is_exec_mapping(vm_flags_t flags)
|
||||
{
|
||||
return (flags & (VM_EXEC | VM_WRITE)) == VM_EXEC;
|
||||
}
|
||||
|
||||
static inline bool is_stack_mapping(vm_flags_t flags)
|
||||
{
|
||||
return (flags & (VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN))) != 0;
|
||||
}
|
||||
|
||||
static inline bool is_data_mapping(vm_flags_t flags)
|
||||
{
|
||||
return (flags & ((VM_STACK_FLAGS & (VM_GROWSUP | VM_GROWSDOWN)) |
|
||||
VM_WRITE | VM_SHARED)) == VM_WRITE;
|
||||
}
|
||||
|
||||
/* mm/util.c */
|
||||
void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
|
||||
struct vm_area_struct *prev, struct rb_node *rb_parent);
|
||||
|
|
|
|||
Loading…
Reference in a new issue