diff options
author | Hugh Dickins <hugh@veritas.com> | 2004-12-12 16:30:29 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-12-12 16:30:29 -0800 |
commit | 8c54a50c158dd6951b49257fe5d8fb83854f1265 (patch) | |
tree | 095f6ea8f5343f4e6d7a5485b35d3b010e768858 /mm | |
parent | 2637792e3d9ae50079238615fd16384a0d393b30 (diff) | |
download | history-8c54a50c158dd6951b49257fe5d8fb83854f1265.tar.gz |
[PATCH] VmLib wrapped: executable brk
In some cases /proc/<pid>/status shows VmLib: 42949..... kB.
If READ_IMPLIES_EXEC then the break area is VM_EXEC, but omitted from
exec_vm since do_brk contains no __vm_stat_account call. Later munmaps
count its pages out of exec_vm, hence (exec_vm - VmExe) can go negative.
do_brk is right not to call __vm_stat_account, its pages shouldn't need to
be counted. What's wrong is that __vm_stat_account is counting all the
VM_EXEC pages, whereas (to mimic 2.4 and earlier 2.6) it should be leaving
VM_WRITE areas and non-vm_file areas out of exec_vm.
VmLib may still appear larger than before - where a READ_IMPLIES_EXEC
personality makes what was a readonly mapping of a file now executable e.g.
/usr/lib/locale stuff. And a program which mprotects its own text as
writable will appear with wrapped VmLib: sorry, but while it's worth
showing ordinary programs as ordinary, it's not worth much effort to avoid
showing odd ones as odd.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c index 54f6a2f9966ff0..cf3e886aff8380 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -744,12 +744,12 @@ void __vm_stat_account(struct mm_struct *mm, unsigned long flags, } #endif /* CONFIG_HUGETLB */ - if (file) + if (file) { mm->shared_vm += pages; - else if (flags & stack_flags) + if ((flags & (VM_EXEC|VM_WRITE)) == VM_EXEC) + mm->exec_vm += pages; + } else if (flags & stack_flags) mm->stack_vm += pages; - if (flags & VM_EXEC) - mm->exec_vm += pages; if (flags & (VM_RESERVED|VM_IO)) mm->reserved_vm += pages; } |