Skip to content

linux-user, fix: Hide helper threads through saved procfs fds - #419

Open
y347812075 wants to merge 1 commit into
lat-opensource:masterfrom
y347812075:t286-chatgpt-sandbox
Open

linux-user, fix: Hide helper threads through saved procfs fds#419
y347812075 wants to merge 1 commit into
lat-opensource:masterfrom
y347812075:t286-chatgpt-sandbox

Conversation

@y347812075

Copy link
Copy Markdown
Contributor

Summary / 变更说明

  • Keep Chromium's saved procfs descriptors recognizable after a shared
    sandbox chroot makes the absolute /proc path unreachable.
  • Hide LATX-only RCU/helper threads from fstat,
    fstatat(AT_EMPTY_PATH), and statx(AT_EMPTY_PATH) results for the current
    process's /proc/self/task directory.
  • Identify the current process through ../../self/task device/inode matching
    so another PID's task directory is never rewritten.
  • Add a focused x86_64 guest regression and a native two-thread helper covering
    saved proc-root/task descriptors and the other-PID negative cases.

This fixes ChatGPT 42.3.0 / Chromium 151 zygote startup under the default
sandbox. Before the fix, LATX exposed a host-only helper as st_nlink=4 while
Chromium expected 3, causing an INT3; --no-sandbox avoided that path.

Validation / 验证

  • ./latxbuild/build64.sh — passed.
  • test-cef-procfs-chroot.sh — passed; covers fstat, fstatat and statx
    for saved self-task fds plus all three other-PID negative cases.
  • test-proc-thread-count.sh — passed.
  • test-cef-userns-exec.sh — passed.
  • test-cef-userns-nested.sh — passed.
  • Native helper compiled with -Wall -Wextra -Werror — passed.
  • scripts/checkpatch.pl — exit 0, no errors; one generic new-file
    MAINTAINERS reminder.
  • ChatGPT default sandbox — 3/3 observed runs reached Launching app, started
    NetworkService, and did not trigger the original INT3.

Checklist / 检查项

  • I have read CONTRIBUTING.md. / 我已阅读 CONTRIBUTING.md
  • Every commit contains a DCO sign-off (git commit -s). /
    每个提交都包含 DCO 签署(git commit -s)。
  • I have included relevant build or test results, or explained why they
    are not applicable. /
    我已提供相关构建或测试结果,或说明了不适用的原因。

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