opencontainers / opencontainers/runc

Umask behavior doesn't match spec

Open
#3,533 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Description

In the config section of runtime-spec, it states:

umask: [...] If unspecified, the umask should not be changed from the calling process' umask.

However runc does not seem to follow this:

~/mycontainer $ grep umask config.json
            "umask": 5
~/mycontainer $ sudo runc run test
/ # umask
0005
~/mycontainer $ vim config.json 
~/mycontainer $ grep umask config.json
~/mycontainer $ umask
0002
~/mycontainer $ sudo runc run test
/ # umask
0022

It looks like the issue originates in rootfs_linux.go:179, where the umask is set to 022 despite umask not being set in config.json.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libcontainer/rootfs_linux.go around line 179 and compare the umask handling with the OCI runtime-spec config section. Reproduce the issue using config.json and runc run as shown, checking both an explicit umask and an omitted one. Done means an omitted umask preserves the calling process's umask while an explicit value still applies.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.