Bug 1452368

Summary: clone(2) man page needs update for user namespaces
Product: Red Hat Enterprise Linux 7 Reporter: Jeff Bastian <jbastian>
Component: man-pages-overridesAssignee: Nikola Forró <nforro>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: low Docs Contact:
Priority: medium    
Version: 7.4CC: cpanceac, djez, ebiederm, isenfeld, jkejda, nforro, ovasik, thozza
Target Milestone: rcKeywords: ManPageChange, Patch
Target Release: 7.4   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: man-pages-overrides-7.4.2-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1377583 Environment:
Last Closed: 2017-08-01 12:45:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1377583    
Bug Blocks: 1436627, 1453127    
Attachments:
Description Flags
Backport from upstream none

Description Jeff Bastian 2017-05-18 19:00:37 UTC
+++ This bug was initially created as a clone of Bug #1377583 +++

Description of problem:
The clone(2) man page for the clone syscall is missing information on the ENOSPC error that may be returned due to new user_namespaces(7) features.

From http://man7.org/linux/man-pages/man2/clone.2.html

       CLONE_NEWUSER
              (This flag first became meaningful for clone() in Linux
              2.6.23, the current clone() semantics were merged in Linux
              3.5, and the final pieces to make the user namespaces
              completely usable were merged in Linux 3.8.)

              If CLONE_NEWUSER is set, then create the process in a new user
              namespace.  If this flag is not set, then (as with fork(2))
              the process is created in the same user namespace as the
              calling process.

              For further information on user namespaces, see namespaces(7)
              and user_namespaces(7)

              Before Linux 3.8, use of CLONE_NEWUSER required that the
              caller have three capabilities: CAP_SYS_ADMIN, CAP_SETUID, and
              CAP_SETGID.  Starting with Linux 3.8, no privileges are needed
              to create a user namespace.

              This flag can't be specified in conjunction with CLONE_THREAD
              or CLONE_PARENT.  For security reasons, CLONE_NEWUSER cannot
              be specified in conjunction with CLONE_FS.

              For further information on user namespaces, see
              user_namespaces(7).

       ...

       ENOSPC (since Linux 3.7)
              CLONE_NEWPID was specified in flags, but the limit on the
              nesting depth of PID namespaces would have been exceeded; see
              pid_namespaces(7).

       ENOSPC (since Linux 4.9; beforehand EUSERS)
              CLONE_NEWUSER was specified in flags, and the call would cause
              the limit on the number of nested user namespaces to be
              exceeded.  See user_namespaces(7).

              From Linux 3.11 to Linux 4.8, the error diagnosed in this case
              was EUSERS.

       ENOSPC (since Linux 4.9)
              One of the values in flags specified the creation of a new
              user namespace, but doing so would have caused the limit
              defined by the corresponding file in /proc/sys/user to be
              exceeded.  For further details, see namespaces(7).

       ...

       EPERM  CLONE_NEWUSER was specified in flags, but either the effective
              user ID or the effective group ID of the caller does not have
              a mapping in the parent namespace (see user_namespaces(7)).


Version-Release number of selected component (if applicable):
man-pages-3.53-5.el7.noarch
man-pages-overrides-7.4.1-1.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. man 2 clone

Actual results:
no description of ENOSPC errors

Expected results:
ENOSPC is documented along with other user namespace features

Additional info:
Google Chrome 58 fails to start on RHEL 7.4 Beta due to these changes, and strace shows it's because clone() is returning ENOSPC:

$ strace google-chrome
...
clone(child_stack=0x7ffed21e4540, flags=CLONE_NEWUSER|SIGCHLD) = -1 ENOSPC (No space left on device)
--- SIGTRAP {si_signo=SIGTRAP, si_code=SI_KERNEL} ---
+++ killed by SIGTRAP (core dumped) +++
Trace/breakpoint trap (core dumped)

I checked the clone(2) man page to see what might cause ENOSPC and could not find any info on ENOSPC.

Comment 2 Jeff Bastian 2017-05-18 19:10:07 UTC
BTW, Chrome should have a fix for this soon:
  https://codereview.chromium.org/2842033002

In the meantime, increasing the max user namespaces from 0 allows Chrome to start:

~]$ sudo sysctl user.max_user_namespaces=32


Save this to a file to survive reboots:

~]$ sudo tee /etc/sysctl.d/01-user-namespaces.conf <<<"user.max_user_namespaces=32"

Comment 3 Nikola Forró 2017-05-19 13:35:22 UTC
Created attachment 1280429 [details]
Backport from upstream

Comment 8 errata-xmlrpc 2017-08-01 12:45:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2217