Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp572653imu; Fri, 9 Nov 2018 02:29:47 -0800 (PST) X-Google-Smtp-Source: AJdET5celdI6GizGmREvbtxtRXPoO+cVpu9YnvnnlgsuipAVeNrzKiusjiEnIx/3mKeuvhfKGGj4 X-Received: by 2002:a63:d252:: with SMTP id t18mr6988666pgi.133.1541759387254; Fri, 09 Nov 2018 02:29:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541759387; cv=none; d=google.com; s=arc-20160816; b=x0v5OzdHwPj7Jk9SxV5Zbte/JBmaRXblO1NyuoRTwqEzkmxQKnacqUuGvJePYtJHeY 6OiDQtGtMGgAwlpYEb4nN1ibcfEgAs/IBdua2DYcXOElmILM6UCCNgA6+jfLszN18m3Z 1vNUvDYg+5wWXkCfgGctMJ0b2parctSbAwxfHOD/VJziNH95k9DqsEA1nB2zU6k5YENz +69ZeTs698RxegpqV0ksjqd42ODflL2FVZ5SojYW5mHA2iwwqhY2+OrC05ayZJvM61Qk UeOpega9Feog+qzsyviobb64y7mon4zMNMw5xQGJNwuhzFSTuUPc4P9UAe64je04XChR j5AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bJBgUpApie7DIqAe00L/vhW0eOFqIP57sXhvWKpX5Nk=; b=ocyNggftej3aK7N+5RgGYiazY0qFPeEnpdLvFJ1XB7MI4GYthg+Ury/gwvzcIx8CNx mOIH+AjqMCkQ+lxTSVS7xZ8rmrtj1OxwI8FX6k8mCWfDZA53RprxGFrPPZDKf9a00rNw WKjZzlkLqiwOBYXn/bkvLK2INpYv2xzII6pjckGvsB8kdevWibLfndmliM14jTkjlpYx XqbFG+jb9btEaS5WJGhGl4Yk6N5XmvvIDN2xUhqGEwzvZUUsMBay8wrXzwAJbpYtiBuj GZOzuOgVRSBkCBA3i1rfYO6se2Dx/HsS3Z2h/ZUWMm9u46rgey/DI5kuT+EKiplIDY1N iRtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26-v6si7405481pfe.80.2018.11.09.02.29.31; Fri, 09 Nov 2018 02:29:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbeKIUJA (ORCPT + 99 others); Fri, 9 Nov 2018 15:09:00 -0500 Received: from mx2.suse.de ([195.135.220.15]:56084 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727537AbeKIUJA (ORCPT ); Fri, 9 Nov 2018 15:09:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C86ACAE11; Fri, 9 Nov 2018 10:29:00 +0000 (UTC) Date: Fri, 9 Nov 2018 11:28:55 +0100 From: Michal Hocko To: Tetsuo Handa Cc: Vlastimil Babka , Kyungtae Kim , akpm@linux-foundation.org, pavel.tatashin@microsoft.com, osalvador@suse.de, rppt@linux.vnet.ibm.com, aaron.lu@intel.com, iamjoonsoo.kim@lge.com, alexander.h.duyck@linux.intel.com, mgorman@techsingularity.net, lifeasageek@gmail.com, threeearcat@gmail.com, syzkaller@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Konstantin Khlebnikov Subject: Re: UBSAN: Undefined behaviour in mm/page_alloc.c Message-ID: <20181109102855.GF5321@dhcp22.suse.cz> References: <20181109084353.GA5321@dhcp22.suse.cz> <20181109095604.GC5321@dhcp22.suse.cz> <9e17d033-b2ab-3edb-ae0b-90d4f713e55b@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9e17d033-b2ab-3edb-ae0b-90d4f713e55b@i-love.sakura.ne.jp> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 09-11-18 19:24:48, Tetsuo Handa wrote: > On 2018/11/09 19:10, Vlastimil Babka wrote:>>>> + * 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? > >> > >> Because we do not want to blow up the kernel just because of a stupid > >> usage of the allocator. Can you think of an example where it would > >> actually make any sense? > >> > >> I would argue that such a theoretical abuse would blow up on an > >> unchecked NULL ptr access. Isn't that enough? > > > > Agreed. > > > > If someone has written a module with __GFP_NOFAIL for an architecture > where PAGE_SIZE == 2048KB, and someone else tried to use that module on > another architecture where PAGE_SIZE == 4KB. You are saying that > triggering NULL pointer dereference is a fault of that user's ignorance > about MM. You are saying that everyone knows internal of MM. Sad... What kind of argument is this? Seriously! We do consider GFP_NOFAIL problematic even for !order-0 requests and warn appropriately. Talking about anything getting close to MAX_ORDER is just a crazy talk. In any case this is largely tangential to the issue reported here. -- Michal Hocko SUSE Labs