Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-30 Thread Brian Geffon
Ah, you're right. This individual patch looks good to me. Brian On Mon, Dec 28, 2020 at 11:12 AM Dmitry Safonov wrote: > > On 12/28/20 6:21 PM, Brian Geffon wrote: > > This looks good to me with a small comment. > > > >> if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { > >>

Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-28 Thread Dmitry Safonov
On 12/28/20 6:21 PM, Brian Geffon wrote: > This looks good to me with a small comment. > >> if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { >> /* OOM: unable to split vma, just get accounts right */ >> - if (vm_flags & VM_ACCOUNT) >> + if (

Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-28 Thread Brian Geffon
This looks good to me with a small comment. > if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { > /* OOM: unable to split vma, just get accounts right */ > - if (vm_flags & VM_ACCOUNT) > + if (vm_flags & VM_ACCOUNT && !(flags & MREMAP_DONTUNM

[PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-10-12 Thread Dmitry Safonov
Currently memory is accounted post-mremap() with MREMAP_DONTUNMAP, which may break overcommit policy. So, check if there's enough memory before doing actual VMA copy. Don't unset VM_ACCOUNT on MREMAP_DONTUNMAP. By semantics, such mremap() is actually a memory allocation. That also simplifies the e