linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/1] Unprivileged chroot
@ 2021-03-16 20:36 Mickaël Salaün
  2021-03-16 20:36 ` [PATCH v5 1/1] fs: Allow no_new_privs tasks to call chroot(2) Mickaël Salaün
  0 siblings, 1 reply; 13+ messages in thread
From: Mickaël Salaün @ 2021-03-16 20:36 UTC (permalink / raw)
  To: Al Viro, James Morris, Serge Hallyn
  Cc: Mickaël Salaün, Andy Lutomirski, Casey Schaufler,
	Christian Brauner, Christoph Hellwig, David Howells,
	Dominik Brodowski, Eric W . Biederman, Jann Horn, John Johansen,
	Kees Cook, Kentaro Takeda, Tetsuo Handa, kernel-hardening,
	linux-fsdevel, linux-kernel, linux-security-module

Hi,

This new patch fix a race (spotted by Jann Horn) when reading
current->fs->users .

The chroot system call is currently limited to be used by processes with
the CAP_SYS_CHROOT capability.  This protects against malicious
procesess willing to trick SUID-like binaries.  The following patch
allows unprivileged users to safely use chroot(2), which may be
complementary to the use of user namespaces.

This patch is a follow-up of a previous one sent by Andy Lutomirski some
time ago:
https://lore.kernel.org/lkml/0e2f0f54e19bff53a3739ecfddb4ffa9a6dbde4d.1327858005.git.luto@amacapital.net/

This patch can be applied on top of v5.12-rc3 .  I would really
appreciate constructive reviews.

Previous versions:
v4: https://lore.kernel.org/r/20210316170135.226381-1-mic@digikod.net
v3: https://lore.kernel.org/r/20210311105242.874506-1-mic@digikod.net
v2: https://lore.kernel.org/r/20210310181857.401675-1-mic@digikod.net
v1: https://lore.kernel.org/r/20210310161000.382796-1-mic@digikod.net

Regards,

Mickaël Salaün (1):
  fs: Allow no_new_privs tasks to call chroot(2)

 fs/open.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)


base-commit: 1e28eed17697bcf343c6743f0028cc3b5dd88bf0
-- 
2.30.2


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH v5 1/1] fs: Allow no_new_privs tasks to call chroot(2)
@ 2021-03-26 23:12 Askar Safin
  2021-03-27 18:56 ` Mickaël Salaün
  0 siblings, 1 reply; 13+ messages in thread
From: Askar Safin @ 2021-03-26 23:12 UTC (permalink / raw)
  To: Mickaël Salaün, kernel-hardening, linux-fsdevel,
	linux-kernel, linux-security-module

Hi. Unprivileged users already can do chroot. He should simply create userns and then call "chroot" inside. As an LWN commenter noted, you can simply run 
"unshare -r /usr/sbin/chroot some-dir". (I recommend reading all comments: https://lwn.net/Articles/849125/ .)

Also: if you need chroot for path resolving only, consider openat2 with RESOLVE_IN_ROOT ( https://lwn.net/Articles/796868/ ).


==
Askar Safin
https://github.com/safinaskar

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-03-31  6:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 20:36 [PATCH v5 0/1] Unprivileged chroot Mickaël Salaün
2021-03-16 20:36 ` [PATCH v5 1/1] fs: Allow no_new_privs tasks to call chroot(2) Mickaël Salaün
2021-03-30 17:01   ` Mickaël Salaün
2021-03-30 17:19     ` Casey Schaufler
2021-03-30 18:11       ` Mickaël Salaün
2021-03-30 18:22         ` Casey Schaufler
2021-03-30 18:40         ` Casey Schaufler
2021-03-30 19:28           ` Mickaël Salaün
2021-03-30 22:53             ` Casey Schaufler
2021-03-31  6:03               ` Kees Cook
2021-03-31  6:33                 ` Al Viro
2021-03-26 23:12 Askar Safin
2021-03-27 18:56 ` Mickaël Salaün

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).