lkml.org 
[lkml]   [2018]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: UBSAN: Undefined behaviour in mm/page_alloc.c
On Wed, 14 Nov 2018 00:23:28 +0100 Vlastimil Babka <vbabka@suse.cz> wrote:

> On 11/14/18 12:15 AM, Andrew Morton wrote:
> > On Tue, 13 Nov 2018 10:43:05 +0100 Michal Hocko <mhocko@kernel.org> wrote:
> >
> >> --- a/mm/page_alloc.c
> >> +++ b/mm/page_alloc.c
> >> @@ -4364,6 +4353,15 @@ __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 = { };
> >>
> >> + /*
> >> + * There are several places where we assume that the order value is sane
> >> + * so bail out early if the request is out of bound.
> >> + */
> >> + if (unlikely(order >= MAX_ORDER)) {
> >> + WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
> >> + return NULL;
> >> + }
> >> +
> >
> > I know "everybody enables CONFIG_DEBUG_VM", but given this is fastpath,
> > we could help those who choose not to enable it by using
> >
> > #ifdef CONFIG_DEBUG_VM
> > if (WARN_ON_ONCE(order >= MAX_ORDER && !(gfp_mask & __GFP_NOWARN)))
> > return NULL;
> > #endif
>
> Hmm, but that would mean there's still potential undefined behavior for
> !CONFIG_DEBUG_VM, so I would prefer not to do it like that.
>

What does "potential undefined behavior" mean here?

\
 
 \ /
  Last update: 2018-11-14 00:32    [W:0.109 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site