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

mkdir: handle suid/sgid bits correctly #25

Merged
merged 3 commits into from
Sep 13, 2024
Merged

mkdir: handle suid/sgid bits correctly #25

merged 3 commits into from
Sep 13, 2024

Conversation

cyphar
Copy link
Owner

@cyphar cyphar commented Sep 13, 2024

Fixes #23
Fixes #24
See opencontainers/runc#4401

These bits are ignored by mkdirat(2) on every POSIX system (Linux does
honour the sticky bit, though it is an outlier). We could ignore them
but this seems less than ideal (a user could be under the impression
their code works when actually the bit is not getting set) so returning
an informative error is preferable.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
S_ISGID is applied to directories created underneath it and affects the
gid of all inodes created under a directory with it set. We need to
handle this properly in order to avoid errors from our mode/owner
validation logic.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
@cyphar cyphar force-pushed the mkdirall-setid-bits branch from d3adf68 to 1acda83 Compare September 13, 2024 07:12
@cyphar cyphar merged commit fdaafcc into main Sep 13, 2024
11 checks passed
@cyphar cyphar deleted the mkdirall-setid-bits branch September 13, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mkdirall: inherited sgid bits error mkdirall: os.MkdirAll incompatibility wrt suid and sgid bits
1 participant