Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp390683pxf; Wed, 7 Apr 2021 02:00:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwleX4Gckpb9PUPeReh4/l7BF/RHsTniaCw8W6PJjk4iTKYK0KEaiQ+aiS+PR/ITJDWwoVc X-Received: by 2002:a17:906:94c9:: with SMTP id d9mr2502052ejy.314.1617786004042; Wed, 07 Apr 2021 02:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617786004; cv=none; d=google.com; s=arc-20160816; b=TRtYIsiBiyLdxX/80e48kxG/+cPyhTtmNLF9eCEklSHaXQ2dGhoIC29/4lwZYOlJrh wIzXgHnyOq2eUzu60qEZpzs7WhB/241FoZNdTQjomRGyphy+Mo8d5KUr0/bVRLClcnwB CHG++of5RMWin951g859Nu5g/eR7CrN4ZTfHW4mdo0RG8AkXnwug8D2hRtWFzHM6P1Tt J1lU+5yaa6i3Quj/JUoozx+nnDduG0h9kNJRpfDGoxxVEA68qo4VDjXtDZN5V4rZDCGF t6MfctZhGXY+2L9CbHBJPINyHxdZJSgf7tr0u7I8ZgvKnmK3MflizOrz/VepwJPHsP69 bnFQ== 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=vN2TsYkupcXWr63pbztxW8zjzzGyM6QbghNO7GFgyrM=; b=O40aje/QzQuZVM4BDpc8N0H/ykT9UDUOXwbjQ3J9u6jb5LIeHDy/fvwp5rrsbtwB1R ggL+x8UZuNpt2bjVzW9UDVz9mrAcnjJu3M143ohNQyMH4HKEIz4jKrhiJpJ5uxwDap9e q4CByEnIq9x2mlqJQzrR/jkO6olRtTZfCTWslt8asSYnBfTdX734sOlsWmENFYgJgUzh gwS5Shzpbik4UP5WBmwNxxB411MnIB2HujWuqZF8sd88es9Ls4Jz1l8iWwH5MGOMToiW v5RsdE9orJxJVNTnacymxXvWQM6WVCsB9ThjzBlliN1U0QwAEBPQwyUvPKOqeccIHYr2 OX5Q== 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 q7si52223edd.228.2021.04.07.01.59.40; Wed, 07 Apr 2021 02:00:04 -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 S1345783AbhDFPo7 (ORCPT + 99 others); Tue, 6 Apr 2021 11:44:59 -0400 Received: from vmicros1.altlinux.org ([194.107.17.57]:34720 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239592AbhDFPo5 (ORCPT ); Tue, 6 Apr 2021 11:44:57 -0400 Received: from imap.altlinux.org (imap.altlinux.org [194.107.17.38]) by vmicros1.altlinux.org (Postfix) with ESMTP id 719BB72C8B1; Tue, 6 Apr 2021 18:44:47 +0300 (MSK) Received: from example.org (ip-94-113-225-162.net.upcbroadband.cz [94.113.225.162]) by imap.altlinux.org (Postfix) with ESMTPSA id 16D4F4A4729; Tue, 6 Apr 2021 18:44:45 +0300 (MSK) Date: Tue, 6 Apr 2021 17:44:44 +0200 From: Alexey Gladkov To: "Eric W. Biederman" Cc: LKML , Kernel Hardening , Linux Containers , linux-mm@kvack.org, Andrew Morton , Christian Brauner , Jann Horn , Jens Axboe , Kees Cook , Linus Torvalds , Oleg Nesterov Subject: Re: [PATCH v9 4/8] Reimplement RLIMIT_NPROC on top of ucounts Message-ID: <20210406154444.icpvezlq3izzxf5t@example.org> References: <8f0c2888b4e92d51239e154b82d75972e7e39833.1616533074.git.gladkov.alexey@gmail.com> 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, Apr 05, 2021 at 11:56:35AM -0500, Eric W. Biederman wrote: > > Also when setting ns->ucount_max[] in create_user_ns because one value > is signed and the other is unsigned. Care should be taken so that > rlimit_infinity is translated into the largest positive value the > type can hold. You mean like that ? ns->ucount_max[UCOUNT_RLIMIT_NPROC] = rlimit(RLIMIT_NPROC) <= LONG_MAX ? rlimit(RLIMIT_NPROC) : LONG_MAX; ns->ucount_max[UCOUNT_RLIMIT_MSGQUEUE] = rlimit(RLIMIT_MSGQUEUE) <= LONG_MAX ? rlimit(RLIMIT_MSGQUEUE) : LONG_MAX; ns->ucount_max[UCOUNT_RLIMIT_SIGPENDING] = rlimit(RLIMIT_SIGPENDING) <= LONG_MAX ? rlimit(RLIMIT_SIGPENDING) : LONG_MAX; ns->ucount_max[UCOUNT_RLIMIT_MEMLOCK] = rlimit(RLIMIT_MEMLOCK) <= LONG_MAX ? rlimit(RLIMIT_MEMLOCK) : LONG_MAX; -- Rgrds, legion