Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4585011pxv; Tue, 29 Jun 2021 10:21:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznmFoAV0E1pMCV/msU5a/+VmSufm18HvnjEHjRfgU871KF8ixAG+ogJC9f6m1mtaI86Ba2 X-Received: by 2002:a05:6402:706:: with SMTP id w6mr41164851edx.176.1624987282719; Tue, 29 Jun 2021 10:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624987282; cv=none; d=google.com; s=arc-20160816; b=j1llQugapjG/moSamcgLarJdXXGrK7zoRi9KcibVCZvZ9aMpGb9a9QrK6Ek9BpCLqM 1iF00WbmVtavdqgzk4aE6LNt6R26YUiOnB+IeJg5tBNTev829SFxWGxztXwPlAAASK5z lyJWz47O+ClcuHOf8etTxNW7LuVI+Wyh5OiJRQxZAFtm9CnnguxpHBRNwgAAGwKFtdki 1jU35pY5rvQTnu+LUD1schF7T8WlYMo8+/P2esdhbyBpGAaskMDVcI4vHj31Y40ZxswT xyr9Qyraqvk5GLe+eTYclRFA4l6M1RufuQ5cYvfe2LAUUm26BafhY1hD/35G5e0RPADL hM2A== 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:dkim-signature; bh=VLb41MpDfvduQ9XyKpxt84Oq8EO4oUDuFK/+AxXGyzY=; b=yr40Ets7KjFaj5Ec6LBqyBKMjKQbEJzCdLTz3g9eQyn23koL3F+8qyQ8y2ZjXdJtIT c3CMLL7x51+JkQa3APB/8LgntQ9dKfI8sHO+UUMRagqY6TUDu24/CVp6GI0EnpNsOX04 fgOWNG8f7yb1vzi1rFdu9WUeK2u5WvHc9VftzT95pslzTBmng2KA0XDYseHEVdBwTr6A y6aFS2x/enMSP1zSC3lQsk9b7RYm6KQCtlcy5ZZqWUy736oO3O2g3UMknziKqxDlOjEe /9TODXpvrOZ05mB3g/mdv3cpIv6yYWas1JHmhFlgeiKJzcRup2/fNKzNqAgOKszEKQEA tcfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ePci/+Mx"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si13075226edd.224.2021.06.29.10.20.57; Tue, 29 Jun 2021 10:21:22 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ePci/+Mx"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232308AbhF2RU2 (ORCPT + 99 others); Tue, 29 Jun 2021 13:20:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:59310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232222AbhF2RU1 (ORCPT ); Tue, 29 Jun 2021 13:20:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 90DAA61D8A; Tue, 29 Jun 2021 17:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624987080; bh=jdhnTCjSFMbgWJNtYg1ovwgDV4GrfVsLQusWb5bxADo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ePci/+Mxd3oBZLGRl8CN9PzIZwd/679sUnO+uent/1Z9Z/di/cOo49D6V2XO0k85m WBbGsuQB/UQozaVT+tjG/his5xnUx7jEszWJFVNihWW0mNY4i94av094Dg4Gyc3Ciz oyMi5fBikbLx2NAYN33NPZebNzWhu4e+a55lrT8f27+l8h+8DAnhSwLbtdtA6nlsLG Q4gpcHdlzhY3PFA9VP9CnMoHorbQi9gDrO/7zhqRfCjkCbrvBWkplgXAi6YdqRD9y4 Oer1K5pczs+I+7YQ8W4CyfPajONutprXtaO6YFVlDNBPMaxJwBBo3yL7GwkqiPUhIt oit6dUzp5/S5A== Date: Tue, 29 Jun 2021 19:17:57 +0200 From: Alexey Gladkov To: Linus Torvalds Cc: "Eric W. Biederman" , Linux Kernel Mailing List , Linux Containers Subject: Re: [GIT PULL] ucounts: Count rlimits in each user namespace Message-ID: <20210629171757.shyr222zjpm6ev5t@example.org> References: <87fsx1vcr9.fsf@disp2133> 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 Mon, Jun 28, 2021 at 08:47:12PM -0700, Linus Torvalds wrote: > On Mon, Jun 28, 2021 at 3:35 PM Eric W. Biederman wrote: > > > > This is the work mainly by Alexey Gladkov to limit rlimits to the > > rlimits of the user that created a user namespace, and to allow users to > > have stricter limits on the resources created within a user namespace. > > I guess all the performance issues got sorted, since I haven't seen > any reports from the test robots. > > I do end up with two questions, mainly because of looking at the > result of the conflict resolution. > > In particular, in __sigqueue_alloc(), two oddities.. > > Why the "sigpending < LONG_MAX" test in that > > if (override_rlimit || (sigpending < LONG_MAX && sigpending <= > task_rlimit(t, RLIMIT_SIGPENDING))) { > > thing? inc_rlimit_ucounts() returns long and uses LONG_MAX as an overflow flag. At the same time, we have increased the size of sigpending from int to long. > And why test for "ucounts" being non-NULL in > > if (ucounts && dec_rlimit_ucounts(ucounts, > UCOUNT_RLIMIT_SIGPENDING, 1)) > put_ucounts(ucounts); > > when afaik both of those should be happy with a NULL 'ucounts' pointer > (if it was NULL, we certainly already used it for the reverse > operations for get_ucounts() and inc_rlimit_ucounts()..) The get_ucount() can theoretically return NULL. It increments the reference counter and if it overflows, the function will return NULL. > Hmm? > > And somebody should verify that I didn't screw anything up in my merge > resolution. It all looked very straightforward, but mistakes happen.. -- Rgrds, legion