Skip to content

linux-user, fix: Handle AT_FDCWD when hiding helper threads - #463

Open
y347812075 wants to merge 2 commits into
lat-opensource:masterfrom
y347812075:fix-at-fdcwd-procfs
Open

linux-user, fix: Handle AT_FDCWD when hiding helper threads#463
y347812075 wants to merge 2 commits into
lat-opensource:masterfrom
y347812075:fix-at-fdcwd-procfs

Conversation

@y347812075

Copy link
Copy Markdown
Contributor

Depends on #419. This is a stacked follow-up; review commit 36c629ac348b4e27be4d9565a71a032958905597.

Summary

  • handle relative and AT_EMPTY_PATH stat-family lookups through AT_FDCWD after a shared sandbox chroot
  • snapshot guest pathnames and serialize identity checks with cwd, root, mount, and fd-binding changes without exposing translator-owned file descriptors
  • cover alternate relative spellings plus concurrent cwd, dirfd, pathname, and root changes

Validation

  • ninja -C build64 latx-x86_64
  • ninja -C build32 latx-i386
  • TMPDIR="$HOME/tmp" tests/integration/test-cef-procfs-chroot.sh ... (three consecutive passes)
  • TMPDIR="$HOME/tmp" tests/integration/test-proc-thread-count.sh ...
  • TMPDIR="$HOME/tmp" tests/integration/test-cef-userns-exec.sh ...
  • TMPDIR="$HOME/tmp" tests/integration/test-fd-transform-race-i386.sh ...
  • scripts/checkpatch.pl --no-tree --strict --no-signoff: 0 errors, 0 warnings

test-cef-userns-nested.sh retains the pre-existing longjmp causes uninitialized stack frame failure and exits 12; the same failure is present without this patch.

Chromium's namespace sandbox keeps procfs directory descriptors across a
shared chroot.  Once the absolute /proc path becomes unreachable, LATX no
longer recognized /proc/self/task and exposed its host-only RCU helper in
st_nlink.  ChatGPT 42.3.0 then failed the zygote thread-count check and
triggered INT3 unless launched with --no-sandbox.

Recognize saved current-process task descriptors by comparing their procfs
device and inode with ../../self/task.  Apply the guest thread count to fstat,
fstatat with AT_EMPTY_PATH, and statx while leaving other processes' task
directories unchanged.

Add a focused x86_64 guest regression and a native two-thread helper covering
saved proc root and task descriptors, AT_EMPTY_PATH, statx, and the other-PID
negative case.

Validated with the focused procfs and namespace integration tests and three
ChatGPT default-sandbox launches reaching "Launching app" without INT3.

Signed-off-by: yuerengan <y347812075@163.com>
stat-family calls may resolve /proc/self/task through absolute, relative, or empty paths after a shared sandbox chroot. Those accesses could expose LATX-only helper threads in st_nlink.

Snapshot guest pathnames before host at-calls and serialize identity-sensitive stat operations with guest cwd, root, mount, and fd-binding changes. Resolve relative self-task identity through the original dirfd and snapshot without creating translator-owned descriptors in the guest fd table. Carry the serialization lock safely across fork.

Extend the chroot regression with alternate relative spellings and concurrent cwd, dirfd, pathname, and root changes, while retaining negative coverage for other processes and ordinary directories.

Validated with x86_64 and i386 builds, repeated focused procfs races, proc thread-count and userns exec coverage, and the i386 fd-transform fork race.

Signed-off-by: yuerengan <y347812075@163.com>
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.

1 participant