Repository navigation
Commit 469c3dd
committed
fix(test): exec the DeusData#1830 userns probe instead of forking a primed process
The single-uid userns smoke test forked a child, unshared CLONE_NEWUSER,
wrote a 1:1 uid_map, then called cbm_daemon_ipc_private_directory_secure()
directly in that child. The call cannot give the right answer there.
posix_ancestor_overflow_uid() in src/daemon/ipc.c derives the overflow uid
once per process under pthread_once, and the comment above it calls the
/proc state "immutable". unshare(CLONE_NEWUSER) is precisely what changes
/proc/self/uid_map, and pthread_once state survives fork(). Seven earlier
call sites in this suite run the derivation first, so by the time the test
forks, the child has already inherited the HOST answer -- no overflow uid --
and refuses the directory no matter what its namespace says.
The test therefore asserted a product behaviour it never executed, and failed
as a product refusal (exit 1) while the product was correct: production
daemons start inside their namespace and derive the right answer on first use.
Re-exec /proc/self/exe into a new --userns-secure-probe mode so the decision
is made by a process that STARTED in the namespace, which is also the only
shape production ever takes. A failed exec gets its own exit code 3 and a
named FAIL, so a broken harness can never be misread as a quiet refusal.
Verified both directions on linux/arm64 in the container leg as uid 1001:
reverted, 48 passed / 1 failed on "expected WEXITSTATUS(status) == 1"; with
the fix, 49 passed, 0 skipped.
The non-root half of that recipe is now written down at the test, because it
is the part that fooled me first: as root the mapped range covers uid 0, so
root-owned /tmp stays 1:1 inside the namespace and never turns overflow. The
first run of this reproduction passed with the fix REVERTED for exactly that
reason. Only a non-root uid reaches the branch the test exists to cover.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>1 parent 0b51555 commit 469c3dd
2 files changed
Lines changed: 45 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5133 | 5133 | | |
5134 | 5134 | | |
5135 | 5135 | | |
5136 | | - | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
5137 | 5146 | | |
5138 | 5147 | | |
5139 | 5148 | | |
| |||
5164 | 5173 | | |
5165 | 5174 | | |
5166 | 5175 | | |
5167 | | - | |
5168 | | - | |
5169 | | - | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
5170 | 5190 | | |
5171 | 5191 | | |
5172 | 5192 | | |
| |||
5178 | 5198 | | |
5179 | 5199 | | |
5180 | 5200 | | |
| 5201 | + | |
| 5202 | + | |
| 5203 | + | |
| 5204 | + | |
| 5205 | + | |
5181 | 5206 | | |
5182 | 5207 | | |
5183 | 5208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
946 | 962 | | |
947 | 963 | | |
948 | 964 | | |
| |||
0 commit comments