Skip to content

mkdir: handle suid/sgid bits correctly#25

Merged
cyphar merged 3 commits intomainfrom
mkdirall-setid-bits
Sep 13, 2024
Merged

mkdir: handle suid/sgid bits correctly#25
cyphar merged 3 commits intomainfrom
mkdirall-setid-bits

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
@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