From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5755D70 for ; Thu, 8 Jul 2021 11:07:32 +0000 (UTC) Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 232EC72C8B4; Thu, 8 Jul 2021 14:00:18 +0300 (MSK) Received: from example.org (ip-89-103-72-154.net.upcbroadband.cz [89.103.72.154]) by imap.altlinux.org (Postfix) with ESMTPSA id 91AAA4A46ED; Thu, 8 Jul 2021 14:00:17 +0300 (MSK) Date: Thu, 8 Jul 2021 13:00:16 +0200 From: Alexey Gladkov To: Linus Torvalds Cc: "Eric W. Biederman" , Linux Kernel Mailing List , Linux Containers Subject: Re: [PATCH] ucounts: Fix UCOUNT_RLIMIT_SIGPENDING counter leak Message-ID: <20210708110016.seeviageyspgctzk@example.org> References: <20210702175442.1603082-1-legion@kernel.org> <20210707165008.tym4352uw3hu7uwp@example.org> Precedence: bulk X-Mailing-List: containers@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jul 07, 2021 at 10:23:35AM -0700, Linus Torvalds wrote: > On Wed, Jul 7, 2021 at 9:50 AM Alexey Gladkov wrote: > > > > > + dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_SIGPENDING, 1); > > > + fallthrough; > > > + case LONG_MAX: > > > > I think that the counter should be decreased in this case too. > > inc_rlimit_ucounts() increments the counter in all parent userns. If we > > don't decrease the counter then the parent userns will have a counter > > leak. > > Ack. So basically that patch, but move the dec_rlimit_ucounts() into > the LONG_MAX case? Yep. > Would you mind making a real patch with a commit message, and trying > whatever test-case you had for that KASAN use-after-free report? Sure. I will. -- Rgrds, legion