user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
cover user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
Hi!
This patchset is mostly about adding a clarification note for nested user namespaces. I hit that issue and I think having it properly documented would have been nice.
I'm adding Christian Brauner on Cc:, as a developer that has the knowledge to review this.
While I was there, I also send a patch to clarify the CONTRIBUTING file. It says to mail both maintainers, but only one listed. I thought Michael address was missing, until I understood that he is not active anymore.
Best,
Rodrigo
Rodrigo Campos (2):
CONTRIBUTING: Fix typo, there is one active maintainer user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
CONTRIBUTING | 2 +- man7/user_namespaces.7 | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
Signature · 1 line
2.39.2
PATCH 1/2 CONTRIBUTING: Fix typo, there is one active maintainer
On commit "CONTRIBUTING, README, lsm: Remove mtk as maintainer" (06e72cb1) we changed to mail only one maintainer, but the doc still says "both maintainers".
When submitting a patch, I was confused by that fact and thought Michael address was missing. But after checking, it seems we just need to send it to Alejandro, so clarify the text to match that.
--- CONTRIBUTING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
CONTRIBUTING +1 -1
@@ -8,7 +8,7 @@ Description Mailing list The main discussions regarding development of the project, patches, bugs, news, doubts, etc. happen on the mailing list. To send an email - to the project, send it to both maintainers and CC the mailing list: + to the project, send it to Alejandro and CC the mailing list: To: Alejandro Colomar <[email protected]> Cc: <[email protected]>
Signature · 1 line
2.39.2
Re: [PATCH 1/2] CONTRIBUTING: Fix typo, there is one active maintainer
Hi Rodrigo,
Quoted 9 lines · Rodrigo Campos
On commit "CONTRIBUTING, README, lsm: Remove mtk as maintainer" (
06e72cb1) we changed to mail only one maintainer, but the doc still says "both maintainers".When submitting a patch, I was confused by that fact and thought Michael address was missing. But after checking, it seems we just need to send it to Alejandro, so clarify the text to match that.
Signed-off-by Rodrigo Campos <[email protected]>
Patch applied. Thanks,
Alex
Quoted 17 lines
--- CONTRIBUTING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)CONTRIBUTING +1
-1@@ -8,7 +8,7 @@ Description Mailing list The main discussions regarding development of the project, patches, bugs, news, doubts, etc. happen on the mailing list. To send an email - to the project, send it to both maintainers and CC the mailing list: + to the project, send it to Alejandro and CC the mailing list: To: Alejandro Colomar <[email protected]> Cc: <[email protected]>
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
PATCH 2/2 user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
In reply to Rodrigo CamposIn order to create a nested user namespace, we need to re-set the PR_SET_DUMPABLE attribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.
Having this note would have saved me some time debugging.
--- man7/user_namespaces.7 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
user_namespaces.7 +17 -0
@@ -91,6 +91,23 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +When creating a user namespace is often common to change the effective UID and +GID of the process to the ones in the user namespace. Bear in mind that doing +so, as described in +.BR prctl (2), +the +.B PR_SET_DUMPABLE +attribute is reset. +If a process is not dumpable, +the ownership of files in the process's +.IR /proc/ pid +directory is affected as described in +.BR proc (5). +Therefore, you may want to reset +.B PR_SET_DUMPABLE +after changing the effective UID/GID, in order to be allowed to write the +mapping files of a nested user namespace. .\" .\" ============================================================ .\"
Signature · 1 line
2.39.2
Quoted 26 lines · Rodrigo Campos
In order to create a nested user namespace, we need to re-set the
PR_SET_DUMPABLEattribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.Having this note would have saved me some time debugging.
Signed-off-by Rodrigo Campos <[email protected]>--- man7/user_namespaces.7 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)user_namespaces.7 +7
-0@@ -91,6 +91,23 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +When creating a user namespace is often common to change the effective UID and +GID of the process to the ones in the user namespace. Bear in mind that doing +so, as described in +.BR prctl (2), +the +.B PR_SET_DUMPABLE
user_namespaces.7 The · line 110
Quoted 10 lines
user_namespaces.7 +10
-0+attribute is reset. +If a process is not dumpable, +the ownership of files in the process's +.IR /proc/ pid +directory is affected as described in +.BR proc (5). +Therefore, you may want to reset +.B PR_SET_DUMPABLE +after changing the effective UID/GID, in order to be allowed to write the +mapping files of a nested user namespace.
I would probably phrase this sm like:
"A task that changes one of its effective ids will have its dumpability reset to the value in /proc/sys/fs/suid_dumpable. This may affect the ownership of proc files of child processes and may thus cause the parent to lack the permissions to write to mapping files of child processes running in a new user namespace. In such cases making the parent process dumpable before creating a child process in a new user namespace may rectify this problem. See prctl (2) and proc (5) for details on how ownership is affected."
PATCH 1/1 user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
In order to create a nested user namespace, we need to re-set the PR_SET_DUMPABLE attribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.
Having this note would have saved me some time debugging.
---
Thanks, so how about this instead?
--- man7/user_namespaces.7 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
user_namespaces.7 +16 -0
@@ -91,6 +91,22 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +A task that changes one of its effective IDs will have its dumpability +reset to the value in /proc/sys/fs/suid_dumpable. This may affect the +ownership of proc files of child processes and may thus cause the parent +to lack the permissions to write to mapping files of child processes +running in a new user namespace. In such cases making the parent process +dumpable, using +.B PR_SET_DUMPABLE +in a call to +.BR prctl (2), +before creating a child process in a new user namespace may +rectify this problem. See +.BR prctl (2) +and +.BR proc (5) +for details on how ownership is affected. .\" .\" ============================================================ .\"
Signature · 1 line
2.39.2
Quoted 10 lines · Rodrigo Campos
In order to create a nested user namespace, we need to re-set the
PR_SET_DUMPABLEattribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.Having this note would have saved me some time debugging.
Signed-off-by Rodrigo Campos <[email protected]>---
Thanks, so how about this instead?
Friendly ping :)
Hi Rodrigo,
Thanks for the ping :)
Quoted 20 lines · Rodrigo Campos
In order to create a nested user namespace, we need to re-set the
PR_SET_DUMPABLEattribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.Having this note would have saved me some time debugging.
Signed-off-by Rodrigo Campos <[email protected]>---
Thanks, so how about this instead?
--- man7/user_namespaces.7 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)user_namespaces.7 +0
-0
user_namespaces.7 The · line 96
Quoted 6 lines
user_namespaces.7 +3
-0@@ -91,6 +91,22 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +A task that changes one of its effective IDs will have its dumpability +reset to the value in /proc/sys/fs/suid_dumpable. This may affect the
Pathnames should be in italics:
.IR /proc/sys/fs/suid_dumpable .
Also, please use semantic newlines. See man-pages(7):
Use semantic newlines
In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (commas, semicolons, colons, and so on), and long clauses should be split at phrase boundaries. This convention, sometimes known as "semantic newlines", makes it easier to see the effect of patches, which often operate at the level of in‐ dividual sentences, clauses, or phrases.
Thanks,
Alex
Quoted 16 lines
user_namespaces.7 +13
-0+ownership of proc files of child processes and may thus cause the parent +to lack the permissions to write to mapping files of child processes +running in a new user namespace. In such cases making the parent process +dumpable, using +.B PR_SET_DUMPABLE +in a call to +.BR prctl (2), +before creating a child process in a new user namespace may +rectify this problem. See +.BR prctl (2) +and +.BR proc (5) +for details on how ownership is affected. .\" .\" ============================================================ .\"
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
PATCH v3 1/1 user_namespaces.7: Add note about PR_SET_DUMPABLE on nested userns
In order to create a nested user namespace, we need to re-set the PR_SET_DUMPABLE attribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.
Having this note would have saved me some time debugging.
---
Thanks for the review. Is this okay now? :)
I'm new to semantic new lines and doubted about how to split some parts :-)
--- man7/user_namespaces.7 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
user_namespaces.7 +17 -0
@@ -91,6 +91,23 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +A task that changes one of its effective IDs +will have its dumpability reset to the value in +.IR /proc/sys/fs/suid_dumpable . +This may affect the ownership of proc files of child processes +and may thus cause the parent to lack the permissions +to write to mapping files of child processes running in a new user namespace. +In such cases making the parent process dumpable, using +.B PR_SET_DUMPABLE +in a call to +.BR prctl (2), +before creating a child process in a new user namespace may rectify this problem. +See +.BR prctl (2) +and +.BR proc (5) +for details on how ownership is affected. .\" .\" ============================================================ .\"
Signature · 1 line
2.39.2
Hi Rodrigo,
Quoted 10 lines · Rodrigo Campos
In order to create a nested user namespace, we need to re-set the
PR_SET_DUMPABLEattribute after switching the effective UID/GID. Clarify this in the section about nested user namespaces.Having this note would have saved me some time debugging.
Signed-off-by Rodrigo Campos <[email protected]>---
Thanks for the review. Is this okay now? :)
Yep :)
Quoted 2 lines
I'm new to semantic new lines and doubted about how to split some parts :-)\
Looks good. I applied the patch. Thanks,
Alex
Quoted 33 lines
--- man7/user_namespaces.7 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)user_namespaces.7 +17
-0@@ -91,6 +91,23 @@ The operation can be used to discover the parental relationship between user namespaces; see .BR ioctl_ns (2). +.PP +A task that changes one of its effective IDs +will have its dumpability reset to the value in +.IR /proc/sys/fs/suid_dumpable . +This may affect the ownership of proc files of child processes +and may thus cause the parent to lack the permissions +to write to mapping files of child processes running in a new user namespace. +In such cases making the parent process dumpable, using +.B PR_SET_DUMPABLE +in a call to +.BR prctl (2), +before creating a child process in a new user namespace may rectify this problem. +See +.BR prctl (2) +and +.BR proc (5) +for details on how ownership is affected. .\" .\" ============================================================ .\"
Signature · 2 lines
<http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5