Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbdIKA6Z (ORCPT ); Sun, 10 Sep 2017 20:58:25 -0400 Received: from shelob.surriel.com ([96.67.55.147]:58640 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbdIKA6W (ORCPT ); Sun, 10 Sep 2017 20:58:22 -0400 Message-ID: <1505091480.21121.32.camel@surriel.com> Subject: Re: [RFC 1/2] proc: Return if nothing to unmount From: Rik van Riel To: Al Viro , Gargi Sharma Cc: linux-kernel@vger.kernel.org, julia.lawall@lip6.fr, akpm@linux-foundation.org, mingo@kernel.org, pasha.tatashin@oracle.com, ktkhai@virtuozzo.com, oleg@redhat.com, wangkefeng.wang@park.jinmi.com Date: Sun, 10 Sep 2017 20:58:00 -0400 In-Reply-To: <20170909183135.GB5426@ZenIV.linux.org.uk> References: <20170909183135.GB5426@ZenIV.linux.org.uk> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-VKRTkjMHvBGQFOEZmhnK" X-Mailer: Evolution 3.22.6 (3.22.6-2.fc25) Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2053 Lines: 58 --=-VKRTkjMHvBGQFOEZmhnK Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2017-09-09 at 19:31 +0100, Al Viro wrote: > On Sat, Sep 09, 2017 at 06:03:16PM +0530, Gargi Sharma wrote: > > If a task exits before procfs is mounted, proc_flush_task_mnt will > > be called with a NULL mnt parameter. In that case, not only is > > there > > nothing to unhash, but trying to do so will oops the kernel with a > > null pointer dereference. >=20 > You are misreading that sucker.=C2=A0=C2=A0It's about userland mounts, it= 's > about > the internal ones in pidns, for each pidns the process belongs to. >=20 > IOW, what you are adding is dead code.=C2=A0=C2=A0The very first alloc_pi= d() in > that pidns should've called pid_ns_prepare_proc(), which creates that > vfsmount. Looking at the code (now that I am home, and no longer reading this email on my phone), I see the cause of this problem. A previous version of Gargi's code had RESERVED_PIDS as the lower bound for idr_alloc_cyclic, even on the very first PID allocation cycle in a PID namespace. With the code changed to have 1 as the lower bound during the first allocation cycle, pid_ns_prepare_proc() should be called correctly, and things should work as expected. Gargi, can you drop this patch 1/2, and make sure the code still works fine? --=20 All Rights Reversed. --=-VKRTkjMHvBGQFOEZmhnK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJZtd+YAAoJEM553pKExN6DE0UH/2zximZDrl08+gAV2bX88JzV QLiVJmr5fMN4TI2GO6jtdC4P4e2XRRgRhZ1i9TcuF3f9IPDWol0Q8opLCgGtl/yt gzymQUdj3LJn2q4Bn+kBpndrxAnDLIC+CoV0Qgh6sbihcqIMMx7VH5YqziSKurD6 scBgch7fJMyxpZFZnQ5Ech7uiDkeWWz4ePycN4PtHLcFblMB7YV21PzAdHdKJs3l Pbs/OoYJwg+F6JRZFbqP5my153XeZ1df7/QijeL26d5HnXBZPplCtbXne2+PfoSM xKYScDPe5sIdfvuSs2SQUCtv7rVPXisYl6NBRc+8j5Zzm5BargPrjehn/tak6dY= =F6Cm -----END PGP SIGNATURE----- --=-VKRTkjMHvBGQFOEZmhnK--