Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Kyungtae Kim <kt0755@gmail.com>,
	akpm@linux-foundation.org, pavel.tatashin@microsoft.com,
	vbabka@suse.cz, 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 <khlebnikov@yandex-team.ru>
Subject: Re: UBSAN: Undefined behaviour in mm/page_alloc.c
Date: Fri, 9 Nov 2018 11:25:36 +0100
Message-ID: <20181109102536.GE5321@dhcp22.suse.cz> (raw)
In-Reply-To: <a74e6a5d-d4c1-9006-60af-de52afafebb2@i-love.sakura.ne.jp>

On Fri 09-11-18 19:07:49, Tetsuo Handa wrote:
> On 2018/11/09 18:56, Michal Hocko wrote:
> > Does this following look better?
> 
> Yes.
> 
> >> 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?
> 
> We after all can't avoid blowing up the kernel even if we don't add BUG_ON().
> Stopping with BUG_ON() is saner than NULL pointer dereference messages.

I disagree (strongly to be more explicit). You never know the context
the allocator is called from. We do not want to oops with a random state
(locks heled etc). If the access blows up in the user then be it, the
bug will be clear and to be fixed but BUG_ON on an invalid core kernel
function is just a bad idea. I believe Linus was quite explicit about it
and I fully agree with him.

Besides that this is really off-topic to the issue at hands. Don't you
think?
-- 
Michal Hocko
SUSE Labs

  reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  4:09 Kyungtae Kim
2018-11-09  8:42 ` Vlastimil Babka
2018-11-09  8:43 ` Michal Hocko
2018-11-09  9:41   ` Tetsuo Handa
2018-11-09  9:56     ` Michal Hocko
2018-11-09 10:07       ` Tetsuo Handa
2018-11-09 10:25         ` Michal Hocko [this message]
2018-11-09 10:10       ` Vlastimil Babka
2018-11-09 10:22         ` Michal Hocko
2018-11-09 10:24         ` Tetsuo Handa
2018-11-09 10:28           ` Michal Hocko
2018-11-09 10:52       ` Balbir Singh
2018-11-09  9:56   ` Mel Gorman
2018-11-13  9:43   ` Michal Hocko
2018-11-13 23:15     ` Andrew Morton
2018-11-13 23:23       ` Vlastimil Babka
2018-11-13 23:32         ` Andrew Morton
2018-11-14  0:05           ` Vlastimil Babka
2018-11-19 23:57             ` Pavel Machek
2018-11-13 23:29     ` Andrew Morton
2018-11-14  7:10       ` Michal Hocko
2018-11-16 23:43       ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181109102536.GE5321@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=aaron.lu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=khlebnikov@yandex-team.ru \
    --cc=kt0755@gmail.com \
    --cc=lifeasageek@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=syzkaller@googlegroups.com \
    --cc=threeearcat@gmail.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git