From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:35722 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbeHQGhx (ORCPT ); Fri, 17 Aug 2018 02:37:53 -0400 Date: Fri, 17 Aug 2018 04:36:06 +0100 From: Al Viro To: Srikanth Korangala Hari Cc: Luis Chamberlain , "keescook@chromium.org" , "adobriyan@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" Subject: Re: Re: [PATCH 1/1] Preventive patch in the proc file-system to handle NULL check. Message-ID: <20180817033606.GB6515@ZenIV.linux.org.uk> References: <20180816131731.GB1457@garbanzo.do-not-panic.com> <1534412053-22457-1-git-send-email-srikanth.h@samsung.com> <20180817032142epcms5p875c72643ea624e3b2d8f10e4abaf5182@epcms5p8> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180817032142epcms5p875c72643ea624e3b2d8f10e4abaf5182@epcms5p8> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Aug 17, 2018 at 08:51:42AM +0530, Srikanth Korangala Hari wrote: > > Thanks�for�the�patch!�Do�you�have�a�reproducer�or�is�this�theoretical? > > This�will�affect�if�it�should�go�to�stable�or�not. > > Dear Luis, this is theoretical as I observed in most of the call's to api - "proc_mkdir" the NULL check is being done. Hence I thought of adding one here. Realistically, if you get allocation failures that early in the boot, oops is the least of your problems - it won't get through mounting the root or lauching init (or unpacking initramfs, etc.) Sure, might as well check it there - nothing wrong with that, but do keep in mind that * it's very certain to end up in panic() very shortly afterwards, no matter what * the odds of exhausting memory (and that would be extremely low-memory setup) precisely at that point (i.e. even getting to proc_root_init()) are not high. Might be interesting to try lower and lower mem=... values passed to the kernel in attempt to step into this one; I wouldn't put large odds on being able to hit precisely that place, but it would be educational anyway.