Skip to content

[release/1.6 backport] shim: Create pid-file with 0644 permissions#9613

Merged
AkihiroSuda merged 1 commit intocontainerd:release/1.6from
thaJeztah:1.6_backport_pidfile_permissions
Jan 8, 2024
Merged

[release/1.6 backport] shim: Create pid-file with 0644 permissions#9613
AkihiroSuda merged 1 commit intocontainerd:release/1.6from
thaJeztah:1.6_backport_pidfile_permissions

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

Fixes ae70213

In ae70213 the WritePidFile and WriteAddress functions were changed to use AtomicFile instead of os.CreateFile. However, AtomicFile creates a temporary file and then changes its permissions with os.Chmod which alters the previously observed behavior of os.CreateFile which takes the system's umask into account.

This means that on Linux-based systems these files suddenly became world writable (#9363). The address file has since been removed, but pid-file was still created as world writable. This commit explicitly requests 0644 permissions as even on systems without default umask of 0022 there is no reason to have these two files world writable.

(cherry picked from commit 9d32841)

Fixes ae70213

In ae70213 the WritePidFile and WriteAddress functions were
changed to use AtomicFile instead of os.CreateFile. However,
AtomicFile creates a temporary file and then changes its permissions
with os.Chmod which alters the previously observed behavior of
os.CreateFile which takes the system's umask into account.

This means that on Linux-based systems these files suddenly
became world writable (containerd#9363). The address file has since been
removed, but pid-file was still created as world writable. This
commit explicitly requests 0644 permissions as even on systems
without default umask of 0022 there is no reason to have these
two files world writable.

Signed-off-by: Jaroslav Jindrak <[email protected]>
(cherry picked from commit 9d32841)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah requested a review from dmcgowan January 8, 2024 14:39
@thaJeztah thaJeztah self-assigned this Jan 8, 2024
@AkihiroSuda AkihiroSuda merged commit 73fcdce into containerd:release/1.6 Jan 8, 2024
@thaJeztah thaJeztah deleted the 1.6_backport_pidfile_permissions branch January 8, 2024 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants