fix(container): improve sandbox runtime compatibility#1981
Conversation
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f46da9ebeb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let new_backing_file = Arc::new(File::new( | ||
| current_inode.clone(), | ||
| Self::backing_open_flags(flags), | ||
| )?); |
There was a problem hiding this comment.
当 lower-only 文件已被一个 fd 以 O_RDONLY 打开后,另一个 fd 以写入或截断方式打开会触发 copy-up;已打开的 fd 应继续使用打开时选定的 lower realfile。这里在后续 I/O 发现 current_inode 变成 upper 后重新 File::new 并替换 backing,导致旧 fd 的 read/mmap/flush 开始看到 upper 的新内容或截断结果,破坏打开文件描述的稳定语义;应保留 open 时的 backing,至少不要对既有只读 fd 自动切换。
Useful? React with 👍 / 👎.
| return Err(SystemError::ENODEV); | ||
| } | ||
| self.invalidate_clean_page_cache()?; | ||
| self.discard_clean_page_cache(); |
There was a problem hiding this comment.
当同一个 FUSE 文件已有普通 page-cache mmap 后,再通过返回 FOPEN_DIRECT_IO 的句柄做私有 mmap,原路径会先 unmap_mapping_pages() 再丢弃 clean cache。这里改为只调用 discard_clean_page_cache(),不会 zap 已映射的 PTE,旧 VMA 仍可访问旧 page-cache 页,而新的 direct-io mmap/fault 可能走另一份数据,造成同一文件页的陈旧或不一致映射;请在 direct-io mmap 前继续解除旧映射或复用原来的失效流程。
Useful? React with 👍 / 👎.
|
@codex review |
Signed-off-by: longjin <longjin@dragonos.org>
2b82b9d to
809e239
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b82b9d034
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| init_info.auxv.insert(AtType::Uid as u8, 0); | ||
| init_info.auxv.insert(AtType::EUid as u8, 0); | ||
| init_info.auxv.insert(AtType::Gid as u8, 0); | ||
| init_info.auxv.insert(AtType::EGid as u8, 0); |
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
Signed-off-by: longjin <longjin@dragonos.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50b33486e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: longjin <longjin@dragonos.org>
Summary
%rdxon successful exec so glibc does not inherit the oldexecve()envp pointer asrtld_fini.ICANONtermios updates.Root Cause
Sandbox workloads combine overlayfs, FUSE/virtiofs-backed lower layers, PTY/pipe based exec I/O, signal delivery, and Linux-compatible exec ABI expectations. Several DragonOS paths diverged from Linux behavior:
ICANON,ICRNL, andINLCR, so a PTY slave could receiveline\nwithout advancingcanon_heador waking canonical readers.%rdxbefore entering a new ELF image, while Linux clearsregs->dxthroughELF_PLAT_INIT; glibc treats%rdxat_startasrtld_fini.Validation
git diff --checkmake fmtmake kernelmake -C user/apps/tests/dunitest build-suitesnormal/exec_abi,normal/tty_pty_hangup,normal/pipe_waitqueue_wakeupnormal/exec_abi,normal/tty_pty_hangup,normal/pipe_waitqueue_wakeup,normal/pipe_release_wakeupnormal/virtiofs_smokelsand repeateduname -aexecs exit successfully.Notes
The latest PTY canonical-read hang was traced to N_TTY termios character-map handling rather than CubeSandbox, virtiofs, generic pipe wakeups, or the scheduler. The fix keeps the responsibility inside the line discipline and matches Linux N_TTY character-map semantics for canonical input.