Skip to content

segbuild writes files with umask-dependent permissions; MANIFEST came out group-write-but-not-read #414

Backlog

Description

@SDL-A1

segbuild creates files whose permissions depend on the inherited umask rather than being set explicitly, and twice now that has made a file unreadable to something that needed it.

Second occurrence, today

Packaging the segment set for transfer, tar failed:

tar: MANIFEST: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
MANIFEST  mode 620  rustock-node:rustock-build  4581 bytes

620 is rw- -w- ---: the owning group can write the file but not read it. A member of rustock-build can therefore corrupt it and cannot inspect it, which is the wrong way round.

First occurrence

The node's systemd unit carried UMask=0077, and the first segment it sealed came out drwx--S--- — unreadable to every reader but the node itself. That was fixed at the time by setting modes explicitly after the rename, but only for that one path.

Why it keeps happening

Both are the same defect rather than two coincidences: the mode of a file segbuild creates is whatever 0666 & ~umask or 0777 & ~umask yields, and the umask comes from whoever started the node. A unit file edit, a different operator, or a distro default therefore decides whether the artefacts are readable — and the failure appears far away, in a tool that is only reading.

The asymmetry is what makes it expensive: the node itself is always the owner, so it never notices. Only a second reader does, which is exactly when the segments are being shared or audited.

What would fix it

Set the mode explicitly wherever segbuild creates a file or directory that a reader is expected to open -- the sealed directories already do this after their rename, and MANIFEST, BOUNDARIES, BUILT and baseline do not. 0644 for files and 2775 for directories matches what the sealed segments already use.

A test that creates a segment under a hostile umask (0077) and asserts the artefacts are group-readable afterwards would catch the next one. Both occurrences would have failed such a test.

Impact, to be clear

Low: nothing reads the top-level MANIFEST -- not rustock's segment code, and not rskj's SegbuildChunk, which requires segments.csv inside each segment directory instead. The archive shipped without it and is complete for its purpose. This is worth fixing because of the pattern, not because of this file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions