[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b51aae15-eb5d-47f0-1222-bfc1ef21e06c@I-love.SAKURA.ne.jp>
Date: Fri, 9 Nov 2018 18:41:53 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: Michal Hocko <mhocko@...nel.org>, Kyungtae Kim <kt0755@...il.com>
Cc: akpm@...ux-foundation.org, pavel.tatashin@...rosoft.com,
vbabka@...e.cz, osalvador@...e.de, rppt@...ux.vnet.ibm.com,
aaron.lu@...el.com, iamjoonsoo.kim@....com,
alexander.h.duyck@...ux.intel.com, mgorman@...hsingularity.net,
lifeasageek@...il.com, threeearcat@...il.com,
syzkaller@...glegroups.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Subject: Re: UBSAN: Undefined behaviour in mm/page_alloc.c
On 2018/11/09 17:43, Michal Hocko wrote:
> @@ -4364,6 +4353,17 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
> gfp_t alloc_mask; /* The gfp_t that was actually used for allocation */
> struct alloc_context ac = { };
>
> + /*
> + * In the slowpath, we sanity check order to avoid ever trying to
Please keep the comment up to dated.
I don't like that comments in OOM code is outdated.
> + * reclaim >= MAX_ORDER areas which will never succeed. Callers may
> + * be using allocators in order of preference for an area that is
> + * too large.
> + */
> + if (order >= MAX_ORDER) {
Also, why not to add BUG_ON(gfp_mask & __GFP_NOFAIL); here?
> + WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
> + return NULL;
> + }
> +
> gfp_mask &= gfp_allowed_mask;
> alloc_mask = gfp_mask;
> if (!prepare_alloc_pages(gfp_mask, order, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags))
>
Powered by blists - more mailing lists