--ro-bind-fd/--bind-fd: realpath() on /proc/self/fd/N fails for fds from another mount namespace (Flatpak sub-sandbox --usr-path/--app-path)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 44/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c, linux
- Lĩnh vực
- backend, operating-systems
Hướng nghiên cứu
Start in bubblewrap.c at the --bind-fd branch of parse_args_recurse() and trace how resolve_symlinks_in_ops() handles fd-backed bind operations. Check the setup path for SETUP_BIND_MOUNT and SETUP_RO_BIND_MOUNT; the issue suggests keeping /proc/self/fd/N or mounting from the saved fd. Done means these options work when the fd's path is unavailable in bwrap's mount namespace without mounting a different host path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
--bind-fd / --ro-bind-fd fail with bwrap: Can't find source path /proc/self/fd/N when the fd was opened in another mount namespace and its path there does not exist in bwrap's view. The case where this shows up is Flatpak's sub-sandbox portal: inside an app, flatpak-spawn --sandbox --usr-path=/usr true (or --app-path=/app) fails, so pressure-vessel / the Steam Linux Runtime cannot start from a runtime kept under /app or /var/data.
Versions
- bubblewrap 0.12.0 (Fedora 44,
bubblewrap-0.12.0-1.fc44); the same code is in 0.13.1 andmain - flatpak 1.18.4 (
flatpak-1.18.4-1.fc44) - kernel 7.3.3-200.fc44.x86_64; SELinux permissive gives the same result
Reproduce
Inside any Flatpak app (we used com.valvesoftware.Steam from Flathub):
$ flatpak-spawn --sandbox --usr-path=/usr true
bwrap: Can't find source path /proc/self/fd/29
$ flatpak-spawn --sandbox --app-path=/app true
bwrap: Can't find source path /proc/self/fd/23
It depends on the path, not on the option:
--usr-path / --app-path argument (as the app sees it) |
Result |
|---|---|
/usr, /app |
fails |
/var/data/... (the sandbox alias of ~/.var/app/<id>/data) |
fails |
/var/home/<user>/.var/app/<id>/data/..., /var/tmp/... (same path on the host and in the app) |
works |
With the Steam Linux Runtime (sniper) unpacked to a host-identical path, _v2-entry-point --verb=waitforexitandrun -- true works and pressure-vessel reports "Using Flatpak sub-sandboxing", so the portal path itself is fine.
What bwrap receives
With FLATPAK_BWRAP pointed at a logging wrapper, the portal's flatpak run calls bwrap with, among others, --ro-bind-fd 22 /usr --ro-bind-fd 24 /app --ro-bind-fd 29 /etc/e2scrub.conf. The failing one is fd 29. In bwrap's process, readlink /proc/self/fd/29 gives /usr/etc/e2scrub.conf: the path as seen from the app's mount namespace, which does not exist on the host root.
Suspected cause
--bind-fd / --ro-bind-fd set op->source = "/proc/self/fd/N" and op->fd = N (bubblewrap.c, the --bind-fd branch of parse_args_recurse). resolve_symlinks_in_ops() then calls realpath() on that source for every SETUP_BIND_MOUNT / SETUP_RO_BIND_MOUNT. realpath() follows the magic link as a string, so the fd is turned back into a path in the wrong namespace: ENOENT here, and if that string happens to exist on the host (e.g. /usr), the host path would be mounted instead of the directory the caller passed.
A possible fix is to leave fd-backed ops out of the realpath() pass (keep /proc/self/fd/N, or mount from op->fd directly). We have not tested a patch.
Related
- flatpak 1.18.4 already has 066babba ("run: Fix checking wrong variable in runtime fd selection", flatpak#6568), which is a different bug.
- flatpak#6584 (the earlier 1.16.4
/proc/self/fdregression) looks related but is closed.
- Ngôn ngữ chính
- C
- Star
- 9.6k
- Fork
- 418
- Merge trung bình
- 4 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của containers/bubblewrap
-
Mount point creation fails on NFS with EROFSCó thể đã có người làm @sarankumar1325 đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
containers/bubblewrap#827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
--userns-block-fd can hang when given a closed descriptorCó thể đã có người làm @sarankumar1325 đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
containers/bubblewrap#826 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
README: writable --bind paths are not isolated from hardlinks created outside the sandboxCó thể đã có người làm @sairex53 đã nhận 45 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
containers/bubblewrap#813 · 3 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bubblewrap manpage is desynced from source codeCó thể đã có người làm @huong8373tt-beep đã nhận 25 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
containers/bubblewrap#767 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Related project comparisons in README.md are outdatedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
containers/bubblewrap#743 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của containers/bubblewrap
Issue tương tự
-
bug severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
AlessandroSangiuliano/Uros#1014 ·
-
severity: low
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
luainkernel/lunatik#2727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 6 ngày
-
Termux compilation failureĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bot-triaged module: cuda module: memory usage module: pybind module: tensor creation triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pytorch/pytorch#206707 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày