Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp346935pxv; Thu, 8 Jul 2021 04:01:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyws1vkoW10PmZUkT1oj8v/qyp2YPQUW++xJkEO3gugB+bOtra9n+I0OK9dZus4BoDa/IYh X-Received: by 2002:a17:907:9807:: with SMTP id ji7mr28422437ejc.35.1625742111010; Thu, 08 Jul 2021 04:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625742111; cv=none; d=google.com; s=arc-20160816; b=w8BPPZKRbbl+rTmGJNwLuOavQp/BezckE37H2qfnGs7zCws1Zc7fiis6pJgYX5xAgC AvmTcwPOWhKMDHgyifKXsWipfPr6Vu3qOejCdvy2KgDDBpd7ngx535sSCSkg/b1hMMLp Gd5NsaoW89RGrCEcpAuQyjjYWi5JyiXUpmj2I45k6gdTzmdnnUcJxFkWOMQEK34tlEdG VyRGbQK6OgaVXBNpElBKuEjxvvdzXlR2buqvka8uioa8v7gJxEDF1zOrlrtxcAnbd2/+ CH1mBq6QyHGVObEACziDzHpKMZu/7W2OvTdxI78A62cLbgT1uMwGqVabbYoLES20Ya/r 5ohQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rtdQ6Shdq8tgBGfOdzL++RZZElIsJVlVO/LqxwGWSlQ=; b=tt1fEO1FzCgoBcD0KpiI2hMetUlp1M9XoSl+D2Y+aj++DtkAXuUmWGawIo0oburHjG fMfaqpiLw7fVBnTJ/tpI+aTafvptd2JlG+9Z9ZrUBWCpsyhlrBPRD0a8biaKYwWdIa4A gl72OoJtao50K3/1lBsHQlehtZFd6PQHwkdmXlOj2ExdUOSZEyOH9bT8ebmXH4oHQADS rMSzkoHfalbqNmEjhlz+LGHuoBnVRpfOmGybstG1k9uq0Ojl2yVB1L1a2hneDRo9Go0n FVoFQziZmfL+EE86j5q/7c79ar14vWGr+3r2owMJRvgdWPQIKjHTZrTIwvR+OFdXnP+F cPNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si2649246eds.126.2021.07.08.04.01.27; Thu, 08 Jul 2021 04:01:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbhGHLDC (ORCPT + 99 others); Thu, 8 Jul 2021 07:03:02 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:43156 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbhGHLDC (ORCPT ); Thu, 8 Jul 2021 07:03:02 -0400 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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