mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javierm@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	javier@dowhile0.org, Christian Brauner <brauner@kernel.org>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nhat Pham <nphamcs@gmail.com>, Petr Mladek <pmladek@suse.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Yoann Congal <yoann.congal@smile.fr>
Subject: [PATCH] userns: Default to 'yes' when CONFIG_MEMCG option is enabled
Date: Fri, 24 May 2024 10:24:16 +0200	[thread overview]
Message-ID: <20240524082434.657573-1-javierm@redhat.com> (raw)

The default value for the CONFIG_USER_NS Kconfig symbol changed over time.

When first was introduced by commit acce292c82d4 ("user namespace: add the
framework"), the default was 'no'. But then it was changed to 'yes' if the
CONFIG_NAMESPACES option was enabled, by commit 17a6d4411a4d ("namespaces:
default all the namespaces to 'yes' when CONFIG_NAMESPACES is selected").

Then, commit 5673a94c1457 ("userns: Add a Kconfig option to enforce strict
kuid and kgid type checks") changed the default to 'no' again and selected
the (now defunct) UIDGID_STRICT_TYPE_CHECKS option.

This selected option was removed by commit 261000a56b63 ("userns: Remove
UIDGID_STRICT_TYPE_CHECKS"), but CONFIG_USER_NS default was left to 'no'.

Finally, the commit e11f0ae388f2 ("userns: Recommend use of memory control
groups") added to the Kconfig symbol's help text a recommendation that the
memory control groups should be used, to limit the amount of memory that a
user who can create user namespaces can consume.

Looking at the changes' history, a default to 'yes' when the CONFIG_MEMCG
option is enabled seems like a sane thing to do. Specially since systemd
requires user namespaces support for services that use the PrivateUsers=
property in their unit files (e.g: the UPower daemon).

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 init/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/init/Kconfig b/init/Kconfig
index 72404c1f2157..208e2f500ef0 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1239,6 +1239,7 @@ config IPC_NS
 
 config USER_NS
 	bool "User namespace"
+	default y if MEMCG
 	default n
 	help
 	  This allows containers, i.e. vservers, to use user namespaces
-- 
2.45.1


             reply	other threads:[~2024-05-24  8:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24  8:24 Javier Martinez Canillas [this message]
2024-05-24 11:48 ` Christian Brauner
2024-05-24 12:33   ` Javier Martinez Canillas
2024-05-24 13:19     ` Christian Brauner
2024-05-24 15:39       ` Javier Martinez Canillas

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=20240524082434.657573-1-javierm@redhat.com \
    --to=javierm@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=ebiederm@xmission.com \
    --cc=gustavoars@kernel.org \
    --cc=javier@dowhile0.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=yoann.congal@smile.fr \
    /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

all inboxes | Powered by JetHome®