Messages in this thread | | | Date | Mon, 30 May 2022 16:02:23 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH 1/3] mm/swapfile: make security_vm_enough_memory_mm() work as expected |
| |
On Fri, 27 May 2022 17:26:24 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> security_vm_enough_memory_mm() checks whether a process has enough memory > to allocate a new virtual mapping. And total_swap_pages is considered as > available memory while swapoff tries to make sure there's enough memory > that can hold the swapped out memory. But total_swap_pages contains the > swap space that is being swapoff. So security_vm_enough_memory_mm() will > success even if there's no memory to hold the swapped out memory because > total_swap_pages always greater than or equal to p->pages. > > In order to fix it, p->pages should be retracted from total_swap_pages > first and then check whether there's enough memory for inuse swap pages.
User-visible impact?
If I'm understanding correctly, there's a risk that this fix will cause existing setups to newly fail when attempting swapoff()?
| |