LWN: Comments on "Resource limits in user namespaces" https://lwn.net/Articles/842842/ This is a special feed containing comments posted to the individual LWN article titled "Resource limits in user namespaces". en-us Mon, 20 Oct 2025 21:06:50 +0000 Mon, 20 Oct 2025 21:06:50 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Resource limits in user namespaces https://lwn.net/Articles/843736/ https://lwn.net/Articles/843736/ gutschke <div class="FormattedComment"> Goats eat pretty much everything else. I don&#x27;t see why they wouldn&#x27;t eat tuna as well.<br> </div> Sun, 24 Jan 2021 18:55:17 +0000 Resource limits in user namespaces https://lwn.net/Articles/843598/ https://lwn.net/Articles/843598/ nix <div class="FormattedComment"> There is at least one sheep farmer working on Linux stuff. It is mostly visible to the rest of us in increased annoyance around lambing time :)<br> </div> Fri, 22 Jan 2021 17:05:48 +0000 Resource limits in user namespaces https://lwn.net/Articles/843329/ https://lwn.net/Articles/843329/ nivedita76 Agh, this article is very confusing. <a href="https://lwn.net/ml/linux-kernel/eea77b250695e05cb0d440d0a9fa203a2b86a643.1610722474.git.gladkov.alexey@gmail.com/#t">This patch</a> does make the limits be per-namespace too, not just the counts? Wed, 20 Jan 2021 22:51:19 +0000 Resource limits in user namespaces https://lwn.net/Articles/843327/ https://lwn.net/Articles/843327/ nivedita76 <div class="FormattedComment"> I&#x27;m confused. Isn&#x27;t there only one RLIMIT_NPROC for a given process? i.e. I thought that the limits are per-process, and the counts, which used to be per-user are changing to per-user/per-namespace?<br> </div> Wed, 20 Jan 2021 22:39:28 +0000 Counts v. limits https://lwn.net/Articles/843184/ https://lwn.net/Articles/843184/ corbet Ah right, that's the part I wasn't fully on top of. I've stuck an addendum onto the article. Tue, 19 Jan 2021 22:29:41 +0000 Counts v. limits https://lwn.net/Articles/843183/ https://lwn.net/Articles/843183/ ebiederm <div class="FormattedComment"> The counts are not per process. The limits are per process.<br> <p> That is starting with struct task_struct *task. The counts<br> for the problematic rlimits live in:<br> <p> task-&gt;cred-&gt;user-&gt;{process, sigsigpending, mq_bytes, locked_vm}<br> <p> The limits for the problematic rlimts live in:<br> <p> task-&gt;signal-&gt;rlim[RLIMIT_NNNN];<br> <p> <p> </div> Tue, 19 Jan 2021 22:06:19 +0000 Counts v. limits https://lwn.net/Articles/843182/ https://lwn.net/Articles/843182/ corbet Um....I thought the whole point of this exercise was that some limits are <i>not</i> per-process...? That's why a process in one container prevents the creation of a process in another? How can NPROC be per-process? <p> I'm clearly missing something here. Tue, 19 Jan 2021 21:56:27 +0000 Counts v. limits https://lwn.net/Articles/843181/ https://lwn.net/Articles/843181/ ebiederm <div class="FormattedComment"> We are talking rlimits so the limits are fundamentally per-process. <br> <p> What moving to ucounts does is it captures the per-process limit value at the<br> time of user namespace creation. Then when the counts are updated the<br> outer limit is checked, along with the per-process rlimit counts.<br> <p> There is no need here for any root involvement.<br> <p> ``root&#x27;&#x27; can get involved if you want to modify the limits that were captured at user namespace creation. Those limits should be exposed as sysctls. In most cases<br> it should be safe to ignore them.<br> </div> Tue, 19 Jan 2021 21:33:47 +0000 Resource limits in user namespaces https://lwn.net/Articles/843180/ https://lwn.net/Articles/843180/ ebiederm <div class="FormattedComment"> RLIMIT_NPROC is some large number in the parent namespace. So the limit check on the parent namespace passes. Only in the 2 containers is RLIMIT_NPROC == 1.<br> <p> </div> Tue, 19 Jan 2021 21:27:49 +0000 Resource limits in user namespaces https://lwn.net/Articles/843179/ https://lwn.net/Articles/843179/ ebiederm <div class="FormattedComment"> The problem statement for containers is make existing code work. So adding work-arounds for existing code is not a serious option.<br> <p> Furthermore the example of a service setting RLIMIT_NPROC==1 while real<br> is just a motivating example. It shows how a process/container can legitimately tighten it&#x27;s rlimits in a useful way, as well as being a case that is easy to see why it fails when that happens.<br> <p> <p> </div> Tue, 19 Jan 2021 21:24:49 +0000 Resource limits in user namespaces https://lwn.net/Articles/843167/ https://lwn.net/Articles/843167/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt; In general, I&#x27;m pretty strongly against adding controllers for things which aren&#x27;t fundamental resources in the system. What&#x27;s next? Open files? Pipe buffer? Number of flocks? Number of session leaders or program groups? </font><br> Why not ALL of these?<br> <p> This would at least unify all the various resource limits that currently exist in a kind of weird fashion.<br> </div> Tue, 19 Jan 2021 19:00:26 +0000 Resource limits in user namespaces https://lwn.net/Articles/843165/ https://lwn.net/Articles/843165/ nivedita76 <div class="FormattedComment"> Hm I also don&#x27;t get the fix. If the counts are hierarchical, why doesn&#x27;t the setuid() call for the second run fail because there is already one process running for that user in the root namespace?<br> </div> Tue, 19 Jan 2021 18:53:40 +0000 Resource limits in user namespaces https://lwn.net/Articles/843158/ https://lwn.net/Articles/843158/ nivedita76 <div class="FormattedComment"> I&#x27;m a little confused by the problem -- it seems to me that it is rather easy to work around for RLIMIT_NPROC == 1 case.<br> <p> i.e. instead of launching the service by doing setrlimit() as root, then fork(), setuid(), execve(); can&#x27;t you do fork(), setuid(), setrlimit(), execve()? This should be fine for the &quot;prevent fork()&quot; situation, no?<br> </div> Tue, 19 Jan 2021 18:07:21 +0000 Counts v. limits https://lwn.net/Articles/843114/ https://lwn.net/Articles/843114/ corbet Yes, I guess I see why you need to change the count infrastructure. Where my confusion comes in is why the limits aren't made per-user-namespace as well. It seems that would create far more straightforward semantics and the possibility for control without root involvement. Tue, 19 Jan 2021 15:09:20 +0000 Resource limits in user namespaces https://lwn.net/Articles/843111/ https://lwn.net/Articles/843111/ pizza <div class="FormattedComment"> <font class="QuotedText">&gt; I have considerable experience* herding cats. How hard can it be to adapt to goats? </font><br> <p> That depends; do goats like Tuna?<br> <p> <p> </div> Tue, 19 Jan 2021 13:35:55 +0000 Resource limits in user namespaces https://lwn.net/Articles/843108/ https://lwn.net/Articles/843108/ k3ninho <div class="FormattedComment"> I have considerable experience* herding cats. How hard can it be to adapt to goats? <br> <p> *: if not success<br> <p> K3n. :-D<br> </div> Tue, 19 Jan 2021 12:57:10 +0000 Resource limits in user namespaces https://lwn.net/Articles/843103/ https://lwn.net/Articles/843103/ izbyshev <div class="FormattedComment"> Yes, I wondered about that too while reading the article. Clearly, making counts per-user-namespace is a prerequisite for making resource limits per-user-namespace, so I don&#x27;t understand why the article described the Gladkov&#x27;s patchset as something orthogonal.<br> </div> Tue, 19 Jan 2021 09:39:25 +0000 Resource limits in user namespaces https://lwn.net/Articles/843099/ https://lwn.net/Articles/843099/ cyphar <div class="FormattedComment"> Yes, ulimits are per-user but two processes with the same kuid in two different user namespaces (in other words, they map the to the same underlying user) will have the same limit because the limit is enforced per-kuid (it&#x27;s not linked the user namespace you&#x27;re in). This is a problem because some container runtimes reuse the same mapping for different containers, causing resource exhaustion between containers (and isolated containers a-la LXD have their own issues -- namely a fair number of programs expect to be able to create users with very large uids).<br> </div> Tue, 19 Jan 2021 06:59:03 +0000 Resource limits in user namespaces https://lwn.net/Articles/843098/ https://lwn.net/Articles/843098/ ebiederm <div class="FormattedComment"> What was unclear about my reply?<br> <p> If today the situation is that setting RLIMIT_NPROC == 1 and your service does not start, but it has nor processes in your user namespace. How can you possibly fix that without changing how the count works? AKA by making a per user per user_namespace count?<br> <p> </div> Tue, 19 Jan 2021 04:33:39 +0000 Resource limits in user namespaces https://lwn.net/Articles/843096/ https://lwn.net/Articles/843096/ atai <div class="FormattedComment"> managing goats--a big challenge<br> </div> Tue, 19 Jan 2021 03:42:50 +0000 Resource limits in user namespaces https://lwn.net/Articles/843095/ https://lwn.net/Articles/843095/ gus3 <div class="FormattedComment"> Until the goat smacks your bum with its forehead and knocks you into the watering trough.<br> </div> Tue, 19 Jan 2021 03:11:24 +0000 Resource limits in user namespaces https://lwn.net/Articles/843090/ https://lwn.net/Articles/843090/ johannbg <div class="FormattedComment"> Let&#x27;s all take a deep breath and considers a career change to goat farming. What a simple life it would be...<br> </div> Mon, 18 Jan 2021 21:11:30 +0000 Resource limits in user namespaces https://lwn.net/Articles/843087/ https://lwn.net/Articles/843087/ nickodell <div class="FormattedComment"> ulimit supports per-user process limits, right? Is there some reason why you couldn&#x27;t create a user namespace, and set two process limits on two users within that namespace?<br> </div> Mon, 18 Jan 2021 20:31:00 +0000