Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4570668pxv; Tue, 29 Jun 2021 10:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEqgTRe6NM5ag9YMarUX2dFiaOrrS3iwIWw0ae782wQJGPXIS8M1tPkg7/4aRPcqghrKgA X-Received: by 2002:a17:906:2dd5:: with SMTP id h21mr31615070eji.522.1624986186764; Tue, 29 Jun 2021 10:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624986186; cv=none; d=google.com; s=arc-20160816; b=SEzx0x1NdwcNlY6tG216W64HoCB8madBh8RCJJIvZ8SGP4uOD+zWeaYGLNglp13Fw2 +xKdWKGkck4AUYOmfZka31S+70xXDNStQaAZUZmeObSW8mNHfgG6iDypIGWZJWuyBFJ4 AM/m3dhKF/BZeLFs62J/yG3a9UGFbWN32C48NcWeZc9zQn3I4ia+i3FP4yCa8dGaO2EH xTxsWhaYyb3IZsaX3zgKymRJFlveJFcJnX2oKC1xPcNYCFAp24hLgJlxZKE9LGIHY+Kx lVfftx4NyoKSQ24yIG77qUNuM+Q5n7LLbR5wIAFBvFUGyHkyNyaI2CKwTpJl/Y6Abczi dPBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QVxx6zpWtcdsULUPWErKqjtTjlhlStVWEPIt+o6rJzA=; b=vzfHCvAiRPQMEpViTJDQze3kxqdW8VfGxxo09umz+QY79Ux/Q82En4CzNipb7gOqNb B3OcLikGsigCKT813WjgWjKeupahU1UrzT5+Una1Rn1zATJqeMzL58Cw0PlSdiKk8W0X GERgeRcGXfpcBjYbh5gStHddD0FEbEpAP8LXb1LvUezlSCFqzxlFBvJbYfIwICt9pup3 mXjQ39EgGlbdj4diOqubyjvseBccZWODTqXjQ2fHwGrYLGYWD5nBU8mNEjSq+eMk+2AF d76HrKvyuHPTjO27+CX+UZGR4+JmELh354y1BS4KIDZxtovvVX+pB0NVXmqjyY9ejxcY YHHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RQmFW2wm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si18427397eds.190.2021.06.29.10.02.41; Tue, 29 Jun 2021 10:03:06 -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=@linux-foundation.org header.s=google header.b=RQmFW2wm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbhF2QhF (ORCPT + 99 others); Tue, 29 Jun 2021 12:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbhF2QhE (ORCPT ); Tue, 29 Jun 2021 12:37:04 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C90A9C061760 for ; Tue, 29 Jun 2021 09:34:35 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id u25so16252191ljj.11 for ; Tue, 29 Jun 2021 09:34:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QVxx6zpWtcdsULUPWErKqjtTjlhlStVWEPIt+o6rJzA=; b=RQmFW2wmVw+pZcJx5ASMwMtBuR0uIqf1DvohGEj877skEvY7BIALzVK0wZSn85cSgP rnVIxAAF4mwSTGnM1fMzlUiP+2hUUukWyxLqSV23B3rr/sbS6B+N/vViuc4nFw87wBca Vf7iQHLbxiMR7VnG+qHjquEHs5t0TJ04xAdEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QVxx6zpWtcdsULUPWErKqjtTjlhlStVWEPIt+o6rJzA=; b=PT3QtkdMtDrNNaz/gFR/Wi1RJZqNjPqUB8FMShKsaAkRCYan5auHOKOv4RwTCDVzA7 0J3ckT3NxUEweRLxvjTfbBrxdCYKYu1sQrP4vhzFpLrLSj+3Pf65kxMddwFqqMkC5bdP Km3bnknnCX0xaY3b2W9kjNbIiblfuhnFt9yCXGo/YmipbAdYIpX2MSTLehrX+rB+RrVi Wgiivh7a7+/UC3cWbuJMiKa9CRI/f2hSLccVC63TkE/cvHNQxNBl03sgjiJsjxWB2uKz Qnz9jC1pfN5NghFhb39/MLdkZGYHdvUka7EjgvKQvYWf3WM38l4jn1qYTwF7SiATaQhp uIAA== X-Gm-Message-State: AOAM5332mwtoM/uV39TBWEWuW2ftJHJT3D6W6uCV0aU1NYWm/JgD8ywX yzz5wtEkMK9/l7BHFWIAu5oWJgmP8DSVNST6znQ= X-Received: by 2002:a2e:87c4:: with SMTP id v4mr4670391ljj.325.1624984473973; Tue, 29 Jun 2021 09:34:33 -0700 (PDT) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id c20sm1364759lja.30.2021.06.29.09.34.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Jun 2021 09:34:33 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id q18so6198838lfc.7 for ; Tue, 29 Jun 2021 09:34:33 -0700 (PDT) X-Received: by 2002:ac2:4950:: with SMTP id o16mr16652927lfi.487.1624984473279; Tue, 29 Jun 2021 09:34:33 -0700 (PDT) MIME-Version: 1.0 References: <87fsx1vcr9.fsf@disp2133> <87czs4u0rm.fsf@disp2133> In-Reply-To: <87czs4u0rm.fsf@disp2133> From: Linus Torvalds Date: Tue, 29 Jun 2021 09:34:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] ucounts: Count rlimits in each user namespace To: "Eric W. Biederman" Cc: Alexey Gladkov , Linux Kernel Mailing List , Linux Containers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 8:52 AM Eric W. Biederman wrote: > > Linus Torvalds writes: > > > Why the "sigpending < LONG_MAX" test in that > > > > if (override_rlimit || (sigpending < LONG_MAX && sigpending <= > > task_rlimit(t, RLIMIT_SIGPENDING))) { > > thing? > > On second look that sigpending < LONG_MAX check is necessary. When > inc_rlimit_ucounts detects a problem it returns LONG_MAX. I saw that, but _without_ that test you'd be left with just that sigpending <= task_rlimit(t, RLIMIT_SIGPENDING) and if task_rlimit() is LONG_MAX, then that means "no limits", so it is all ok. IOW, afaik even _if_ sigpending ends up being LONG_MAX, the conditional does the right thing without that "sigpending < LONG_MAX" test. Linus