Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong directory permissions when using tmpcopyup because of umask #3991

Closed
jakecorrenti opened this issue Aug 23, 2023 · 5 comments · Fixed by #4056
Closed

Wrong directory permissions when using tmpcopyup because of umask #3991

jakecorrenti opened this issue Aug 23, 2023 · 5 comments · Fixed by #4056
Milestone

Comments

@jakecorrenti
Copy link

Description

When using podman and executing the series of commands below, the container emits a permission denied error. However, if you use crun, you do not.

Steps to reproduce the issue

  1. $ podman create --runtime=/bin/runc --name test --pod new:bug registry.access.redhat.com/ubi8/httpd-24
  2. $ podman kube generate bug > test.yaml
  3. $ podman pod rm -f bug
  4. $ podman kube play --runtime=/bin/runc test.yaml
  5. $ podman container logs bug-test

output:

[Tue Aug 01 21:02:50.689430 2023] [cgid:error] [pid 42:tid 140597132381632] (13)Permission denied: AH01243: Couldn\'t bind unix domain socket /etc/httpd/run/cgisock.1
[Tue Aug 01 21:02:50.689901 2023] [core:error] [pid 1:tid 140597132381632] (13)Permission denied: AH00099: could not create /etc/httpd/run/httpd.pid

Describe the results you received and expected

I received a container that was getting permission denied errors. But I expected there to be none at all.

What version of runc are you using?

runc version 1.1.0+dev
commit: v1.1.0-713-gff8c4c7b
spec: 1.1.0
go: go1.20.7
libseccomp: 2.5.3

Host OS information

NAME="Fedora Linux"
VERSION="38 (Workstation Edition)"
ID=fedora
VERSION_ID=38
VERSION_CODENAME=""
PLATFORM_ID="platform:f38"
PRETTY_NAME="Fedora Linux 38 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:38"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f38/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=38
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=38
SUPPORT_END=2024-05-14
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Host kernel information

Linux fedora 6.4.7-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 27 20:01:18 UTC 2023 x86_64 GNU/Linux

jakecorrenti added a commit to jakecorrenti/runc that referenced this issue Aug 23, 2023
Sets the Umask to 0 first thing runc begins execution. If the Umask is
not set properly, `doTmpfsCopyUp` in `libcontainer/rootfs_linux.go` does not
behave as intended.

Fixes: opencontainers#3991

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
@kolyshkin
Copy link
Contributor

Well, my guess is #4039 did not fix this issue, since the fix actually belongs to https://github.com/mrunalp/fileutils. I'll open a PR.

@kolyshkin
Copy link
Contributor

Just checked that mrunalp/fileutils#9 actually fixes the issue. Will open a PR to runc soon.

@kolyshkin
Copy link
Contributor

PR for the main branch: #4056. Will backport to 1.1 once merged.

@kolyshkin
Copy link
Contributor

Reopen until it's fixed in 1.1

@kolyshkin kolyshkin reopened this Oct 5, 2023
@kolyshkin kolyshkin changed the title Podman gets permission denied error Wrong directory permissions when using tmpcopyup because of umask Oct 5, 2023
@kolyshkin
Copy link
Contributor

#4060 merged, the fix will be in runc 1.1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants