lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 10 May 2024 22:54:47 +1200
From: Barry Song <21cnbao@...il.com>
To: hailong.liu@...o.com
Cc: akpm@...ux-foundation.org, urezki@...il.com, hch@...radead.org, 
	lstoakes@...il.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org, 
	xiang@...nel.org, chao@...nel.org, mhocko@...e.com, stable@...r.kernel.org, 
	Oven <liyangouwen1@...o.com>
Subject: Re: [PATCH v2] mm/vmalloc: fix vmalloc which may return null if
 called with __GFP_NOFAIL

On Fri, May 10, 2024 at 10:01 PM <hailong.liu@...o.com> wrote:
>
> From: "Hailong.Liu" <hailong.liu@...o.com>
>
> commit a421ef303008 ("mm: allow !GFP_KERNEL allocations for kvmalloc")
> includes support for __GFP_NOFAIL, but it presents a conflict with
> commit dd544141b9eb ("vmalloc: back off when the current task is
> OOM-killed"). A possible scenario is as follows:
>
> process-a
> __vmalloc_node_range(GFP_KERNEL | __GFP_NOFAIL)
>     __vmalloc_area_node()
>         vm_area_alloc_pages()
>                 --> oom-killer send SIGKILL to process-a
>         if (fatal_signal_pending(current)) break;
> --> return NULL;
>
> To fix this, do not check fatal_signal_pending() in vm_area_alloc_pages()
> if __GFP_NOFAIL set.
>
> Fixes: 9376130c390a ("mm/vmalloc: add support for __GFP_NOFAIL")
> Cc: <stable@...r.kernel.org>
> Acked-by: Michal Hocko <mhocko@...e.com>
> Suggested-by: Barry Song <21cnbao@...il.com>
> Reported-by: Oven <liyangouwen1@...o.com>
> Signed-off-by: Hailong.Liu <hailong.liu@...o.com>

Reviewed-by: Barry Song <baohua@...nel.org>

> ---
>  mm/vmalloc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 125427cbdb87..109272b8ee2e 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -3492,7 +3492,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
>  {
>         unsigned int nr_allocated = 0;
>         gfp_t alloc_gfp = gfp;
> -       bool nofail = false;
> +       bool nofail = gfp & __GFP_NOFAIL;
>         struct page *page;
>         int i;
>
> @@ -3549,12 +3549,11 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
>                  * and compaction etc.
>                  */
>                 alloc_gfp &= ~__GFP_NOFAIL;
> -               nofail = true;
>         }
>
>         /* High-order pages or fallback path if "bulk" fails. */
>         while (nr_allocated < nr_pages) {
> -               if (fatal_signal_pending(current))
> +               if (!nofail && fatal_signal_pending(current))
>                         break;
>
>                 if (nid == NUMA_NO_NODE)
> ---

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ