Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp570108imu; Fri, 9 Nov 2018 02:26:30 -0800 (PST) X-Google-Smtp-Source: AJdET5cafrYhRUz9U54i+d6lgoN78u0h4t2XgXUJ/yJCHEAxPll9kjXdzIYDQa0W74YTiFETPf1h X-Received: by 2002:a63:c70a:: with SMTP id n10-v6mr6762814pgg.431.1541759190645; Fri, 09 Nov 2018 02:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541759190; cv=none; d=google.com; s=arc-20160816; b=HJ7FnRM/cFQaYLzhwMGfRdRdcEM25XXKPHG1NGLSfIBoHovcNARAAwF75Rd2wIWyxa oEtPr0D4Yo1KOC3YdsOesRWkzBN76QplDihwVcE1WlulgXXrOVcGhzN64dxRZ2flOiuY RmVri9rQM2q9S/942hg33dZqSs+Y3wpNqxdSQAGE/cXih6LSUupk13dRJaf6Axmn6wFB 1J/5cx5NEZV1uLA5q4fj7R2ILPU1mwsdCsi4tGkIGbjK7wjUR1wKaLWI+ptHTwWQWWZz 01zE8IpVfvJIE88rVS4YDBV/+x5HSrxppVMnwy5A6eSfb7Xydv5NrE2pH1xnGbKq8uAA hB3w== 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=ZnvF3GcZ5Yppv5ePyHmGbQCFy8XnGJ/LJbAPE4kMPJg=; b=EAl8B67bp0FSRDtr8zJOv4vVVYVvbO8Xs7H29dwwTMDZAKzNvej19iBgBxrily4rr3 VDJVEvsJ2TdmVAFjgfSYtG+IYoeIQwQvwAs+AnoWwREExO9r9pkc5Qa6p4cbntV1x1ct mqPKSuP2jBNKsUmh5itvKODoiLvKRWsGhsjuRljcqPrzRJfoL/Cg4bgT4DS/4XpdmkKP bMxzA+3wNWIBgTfjkFVzx7SEKdq1URNB0cHlNq+SIjuL3KY9inyDSL0x4WS1/SH4BsOS tt7rBCwqcf53iznkg41rinMkOY8NvzeTMPdAEYZnru6b5myNQ+kVxAotsvaq60F3mdWK mA6w== 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 r10-v6si6945499pls.380.2018.11.09.02.26.12; Fri, 09 Nov 2018 02:26:30 -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 S1727883AbeKIUFf (ORCPT + 99 others); Fri, 9 Nov 2018 15:05:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:55672 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727537AbeKIUFf (ORCPT ); Fri, 9 Nov 2018 15:05:35 -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 CBB08AE11; Fri, 9 Nov 2018 10:25:36 +0000 (UTC) Date: Fri, 9 Nov 2018 11:25:36 +0100 From: Michal Hocko To: Tetsuo Handa Cc: Kyungtae Kim , 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 Subject: Re: UBSAN: Undefined behaviour in mm/page_alloc.c Message-ID: <20181109102536.GE5321@dhcp22.suse.cz> References: <20181109084353.GA5321@dhcp22.suse.cz> <20181109095604.GC5321@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: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