pkg/archive: Unpack() use 0755 permissions for missing directories#42016
pkg/archive: Unpack() use 0755 permissions for missing directories#42016cpuguy83 merged 1 commit intomoby:masterfrom
Conversation
|
@tonistiigi @cpuguy83 PTAL |
|
LGTM |
|
Could we have a test for this? Preferably one that also passes pre-19.03.15 and 20.10.2 . |
b20974d to
6474e38
Compare
|
@tonistiigi added a test;
|
Commit edb62a3 fixed a bug in MkdirAllAndChown() that caused the specified permissions to not be applied correctly. As a result of that bug, the configured umask would be applied. When extracting archives, Unpack() used 0777 permissions when creating missing parent directories for files that were extracted. Before edb62a3, this resulted in actual permissions of those directories to be 0755 on most configurations (using a default 022 umask). Creating these directories should not depend on the host's umask configuration. This patch changes the permissions to 0755 to match the previous behavior, and to reflect the original intent of using 0755 as default. Signed-off-by: Sebastiaan van Stijn <[email protected]>
6474e38 to
25ada76
Compare
|
s390x failure is unrelated |
|
This change is making /tmp directory be created without write permission for other users than root. So, it's making some images that runs as non-root user to fail due to EACCES on /tmp directory. Is that possible to configure the permission to be used instead of assuming 0755 ? or at least for /tmp directory? |
|
@gknuppe this is on images you created, or are you seeing this on images you pulled from (e.g.) Docker Hub? do you have an example image where this is happening in? I guess it depends on wether or not the rootfs has a directory defined for for i in alpine ubuntu debian; do docker run --rm -u 123:456 $i ls -la /tmp; done
total 8
drwxrwxrwt 2 root root 4096 Jan 30 2019 .
drwxr-xr-x 1 root root 4096 Jul 8 14:45 ..
total 8
drwxrwxrwt 2 root root 4096 Mar 7 2019 .
drwxr-xr-x 1 root root 4096 Jul 8 14:45 ..
total 8
drwxrwxrwt 2 root root 4096 Feb 28 2019 .
drwxr-xr-x 1 root root 4096 Jul 8 14:45 .. |
|
Thanks for the follow up.
So, I'm not sure if this is the change that caused that issue, but downloading such image with newer version of docker-ce and containerd.io, /tmp directory does not have sufficient permissions to allow running services as non-root user. |
together with #41984, this fixes #41978 If I create a compressed tar ball with etc/password in it
replaces/closes #41990
Commit edb62a3 / #35541 fixed a bug in
MkdirAllAndChown()that caused the specified permissions to not be applied correctly. As a result of that bug, the configured umask would be applied.When extracting archives,
Unpack()used0777permissions when creating missing parent directories for files that were extracted. Before edb62a3, this resulted in actual permissions of the directories to be0755on most configurations (using a default022umask).Creating these directories should not depend on the host's umask configuration. This patch changes the permissions to
0755to match the previous behavior, and to reflect the original intent of using0755as default.- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)