stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Alexey Gladkov <legion@kernel.org>
Cc: Andrei Vagin <avagin@google.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	linux-kernel@vger.kernel.org, Kees Cook <kees@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] signal: restore the override_rlimit logic
Date: Sun, 3 Nov 2024 17:50:49 +0100	[thread overview]
Message-ID: <20241103165048.GA11668@redhat.com> (raw)
In-Reply-To: <ZyZSotlacLgzWxUl@example.org>

On 11/02, Alexey Gladkov wrote:
>
> +Cc Oleg Nesterov.

Well, I tend to agree with Roman and his patch looks good to me.

But it seems that the change in inc_rlimit_get_ucounts() can be
a bit simpler and more readable, see below.

Oleg.
---

--- a/kernel/ucount.c
+++ b/kernel/ucount.c
@@ -307,7 +307,8 @@ void dec_rlimit_put_ucounts(struct ucounts *ucounts, enum rlimit_type type)
 	do_dec_rlimit_put_ucounts(ucounts, NULL, type);
 }
 
-long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum rlimit_type type)
+long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum rlimit_type type,
+			    bool override_rlimit)
 {
 	/* Caller must hold a reference to ucounts */
 	struct ucounts *iter;
@@ -320,7 +321,8 @@ long inc_rlimit_get_ucounts(struct ucounts *ucounts, enum rlimit_type type)
 			goto unwind;
 		if (iter == ucounts)
 			ret = new;
-		max = get_userns_rlimit_max(iter->ns, type);
+		if (!override_rlimit)
+			max = get_userns_rlimit_max(iter->ns, type);
 		/*
 		 * Grab an extra ucount reference for the caller when
 		 * the rlimit count was previously 0.


  reply	other threads:[~2024-11-03 16:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31 20:04 [PATCH] signal: restore the override_rlimit logic Roman Gushchin
2024-11-01 19:51 ` Eric W. Biederman
2024-11-01 20:38   ` Roman Gushchin
2024-11-01 20:58     ` Eric W. Biederman
2024-11-01 21:21       ` Roman Gushchin
2024-11-01 22:44       ` Andrei Vagin
2024-11-02 16:26         ` Alexey Gladkov
2024-11-03 16:50           ` Oleg Nesterov [this message]
2024-11-04 18:21             ` Roman Gushchin
2024-11-04 18:44               ` Oleg Nesterov
2024-11-04 19:02                 ` Alexey Gladkov
2024-11-04 19:42                   ` Roman Gushchin
2024-11-01 23:28 ` Alexey Gladkov
2024-11-01 23:50   ` Roman Gushchin
2024-11-02 13:46     ` Alexey Gladkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241103165048.GA11668@redhat.com \
    --to=oleg@redhat.com \
    --cc=avagin@google.com \
    --cc=ebiederm@xmission.com \
    --cc=kees@kernel.org \
    --cc=legion@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).