Linux-Fsdevel Archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Introduce user namespace capabilities
@ 2024-05-16  9:22 Jonathan Calmels
  2024-05-16  9:22 ` [PATCH 1/3] capabilities: " Jonathan Calmels
                   ` (5 more replies)
  0 siblings, 6 replies; 53+ messages in thread
From: Jonathan Calmels @ 2024-05-16  9:22 UTC (permalink / raw
  To: brauner, ebiederm, Luis Chamberlain, Kees Cook, Joel Granados,
	Serge Hallyn, Paul Moore, James Morris, David Howells,
	Jarkko Sakkinen
  Cc: containers, Jonathan Calmels, linux-kernel, linux-fsdevel,
	linux-security-module, keyrings

It's that time of the year again where we debate security settings for user
namespaces ;)

I’ve been experimenting with different approaches to address the gripe
around user namespaces being used as attack vectors.
After invaluable feedback from Serge and Christian offline, this is what I
came up with.

There are obviously a lot of things we could do differently but I feel this
is the right balance between functionality, simplicity and security. This
also serves as a good foundation and could always be extended if the need
arises in the future.

Notes:

- Adding a new capability set is far from ideal, but trying to reuse the
  existing capability framework was deemed both impractical and
  questionable security-wise, so here we are.

- We might want to add new capabilities for some of the checks instead of
  reusing CAP_SETPCAP every time. Serge mentioned something like
  CAP_SYS_LIMIT?

- In the last patch, we could decide to have stronger requirements and
  perform checks inside cap_capable() in case we want to retroactively
  prevent capabilities in old namespaces, this might be an overreach though
  so I left it out.

  I'm also not fond of the ulong logic for setting the sysctl parameter, on
  the other hand, the usermodhelper code always uses two u32s which makes it
  very confusing to set in userspace.


Jonathan Calmels (3):
  capabilities: user namespace capabilities
  capabilities: add securebit for strict userns caps
  capabilities: add cap userns sysctl mask

 fs/proc/array.c                 |  9 ++++
 include/linux/cred.h            |  3 ++
 include/linux/securebits.h      |  1 +
 include/linux/user_namespace.h  |  7 +++
 include/uapi/linux/prctl.h      |  7 +++
 include/uapi/linux/securebits.h | 11 ++++-
 kernel/cred.c                   |  3 ++
 kernel/sysctl.c                 | 10 ++++
 kernel/umh.c                    | 16 +++++++
 kernel/user_namespace.c         | 83 ++++++++++++++++++++++++++++++---
 security/commoncap.c            | 59 +++++++++++++++++++++++
 security/keys/process_keys.c    |  3 ++
 12 files changed, 204 insertions(+), 8 deletions(-)

-- 
2.45.0


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

end of thread, other threads:[~2024-05-31  7:43 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-16  9:22 [PATCH 0/3] Introduce user namespace capabilities Jonathan Calmels
2024-05-16  9:22 ` [PATCH 1/3] capabilities: " Jonathan Calmels
2024-05-16 12:27   ` Jarkko Sakkinen
2024-05-16 22:07   ` John Johansen
2024-05-17 10:51     ` Jonathan Calmels
2024-05-17 11:59       ` John Johansen
2024-05-18  3:50         ` Jonathan Calmels
2024-05-18 12:27           ` John Johansen
2024-05-19  1:33             ` Jonathan Calmels
2024-05-17 11:32   ` Eric W. Biederman
2024-05-17 11:55     ` Jonathan Calmels
2024-05-17 12:48       ` John Johansen
2024-05-17 14:22       ` Eric W. Biederman
2024-05-17 18:02         ` Jonathan Calmels
2024-05-21 15:52         ` John Johansen
2024-05-20  3:30   ` Serge E. Hallyn
2024-05-20  3:36   ` Serge E. Hallyn
2024-05-16  9:22 ` [PATCH 2/3] capabilities: add securebit for strict userns caps Jonathan Calmels
2024-05-16 12:42   ` Jarkko Sakkinen
2024-05-20  3:38   ` Serge E. Hallyn
2024-05-16  9:22 ` [PATCH 3/3] capabilities: add cap userns sysctl mask Jonathan Calmels
2024-05-16 12:44   ` Jarkko Sakkinen
2024-05-20  3:38   ` Serge E. Hallyn
2024-05-20 13:30   ` Tycho Andersen
2024-05-20 19:25     ` Jonathan Calmels
2024-05-20 21:13       ` Tycho Andersen
2024-05-20 22:12         ` Jarkko Sakkinen
2024-05-21 14:29           ` Tycho Andersen
2024-05-21 14:45             ` Jarkko Sakkinen
2024-05-16 13:30 ` [PATCH 0/3] Introduce user namespace capabilities Ben Boeckel
2024-05-16 13:36   ` Jarkko Sakkinen
2024-05-17 10:00     ` Jonathan Calmels
2024-05-16 16:23 ` Paul Moore
2024-05-16 17:18   ` Jarkko Sakkinen
2024-05-16 19:07 ` Casey Schaufler
2024-05-16 19:29   ` Jarkko Sakkinen
2024-05-16 19:31     ` Jarkko Sakkinen
2024-05-16 20:00       ` Jarkko Sakkinen
2024-05-17 11:42         ` Jonathan Calmels
2024-05-17 17:53           ` Casey Schaufler
2024-05-17 19:11             ` Jonathan Calmels
2024-05-18 11:08               ` Jarkko Sakkinen
2024-05-18 11:17                 ` Jarkko Sakkinen
2024-05-18 11:21                   ` Jarkko Sakkinen
2024-05-21 13:57                     ` John Johansen
2024-05-21 14:12                       ` Jarkko Sakkinen
2024-05-21 14:45                         ` John Johansen
2024-05-22  0:45                           ` Jonathan Calmels
2024-05-31  7:43                             ` John Johansen
2024-05-18 12:20             ` Serge Hallyn
2024-05-19 17:03               ` Casey Schaufler
2024-05-20  0:54                 ` Jonathan Calmels
2024-05-21 14:29               ` John Johansen

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 read-only IMAP folder(s) and NNTP newsgroup(s).