Skip to content

Stop the stay-awake cross-UID probe failing when TMPDIR is not /tmp - #17719

Open
dmatthan wants to merge 1 commit into
omacom:quattrofrom
dmatthan:stay-awake-probe-tmpdir
Open

dmatthan wants to merge 1 commit into
omacom:quattrofrom
dmatthan:stay-awake-probe-tmpdir

Conversation

@dmatthan

@dmatthan dmatthan commented Nov 5, 2026

Copy link
Copy Markdown

What changes

The two-UID fallback probe in update-stay-awake-security-test.sh rebuilds its fixture inside a user and mount namespace. It mounts a fresh tmpfs on /tmp, then runs mkdir -m 755 "$fixture" at the path mktemp -d gave the test. That only works when TMPDIR is unset or exactly /tmp:

  • TMPDIR nested under /tmp (a build or sandbox directory): the fresh tmpfs has none of the parent directories, so mkdir fails with No such file or directory.
  • TMPDIR outside /tmp (~/tmp, /var/tmp/…, an agent's scratch directory): the tmpfs doesn't hide the fixture, so mkdir fails with File exists.

Either way, set -e ends the probe, and the file reports not ok - two-UID fallback probe failed after its capability check. That reads as a security failure when nothing is wrong.

  • mkdir -p rebuilds a nested path inside the namespace's /tmp.
  • A TMPDIR outside /tmp skips the probe with its reason, next to the existing skip for missing namespace support.

Deleting the existing directory or extracting the fixture over it would be wrong. Outside /tmp the namespace shares the host's mount at that path, so it would touch the real directory instead of an isolated copy.

Verification

TMPDIR quattro This branch
/tmp passes passes
/tmp/<nested> No such file or directory, fails probe runs and passes
/var/tmp/<dir> File exists, fails probe skipped with its reason, file passes

This doesn't overlap #14790, which changes line 523 of the same file.

Screenshots

No visible change: test only.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Fixes the cross-UID test setup for different TMPDIR locations.

  • The stay-awake test rebuilds nested fixtures and skips paths outside /tmp.

Reviews (1) · Last reviewed commit: "Stop the stay-awake cross-UID probe fail..." · Reviewed by Greptile

@omarchybot

Copy link
Copy Markdown
Collaborator

I read the diff and the surrounding namespace setup. My review (GPT-6 in Codex; reasoning effort not exposed) classifies this as a test bug, but the configured second classifier returned no usable classification, so classification remains unsettled. Tests were not run and no code was changed. Verification is waiting for the classification check to be resolved.

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.

2 participants