Skip to content

feat(starry-kernel): implement TCP_INFO sockopt#1044

Merged
ZR233 merged 8 commits into
rcore-os:devfrom
cqwhfhh:feature/starry-tcp-info
Jun 5, 2026
Merged

feat(starry-kernel): implement TCP_INFO sockopt#1044
ZR233 merged 8 commits into
rcore-os:devfrom
cqwhfhh:feature/starry-tcp-info

Conversation

@cqwhfhh

@cqwhfhh cqwhfhh commented May 30, 2026

Copy link
Copy Markdown
Contributor

问题

StarryOS 的 getsockopt(TCP_INFO) 之前只在 option 分发表里保留占位项,无法向用户态返回 Linux 兼容的 struct tcp_info。这会影响依赖 TCP 状态、MSS、队列信息和基础诊断字段做能力探测或运行时诊断的网络程序。

CI 过程中还暴露了两个与本 PR 测试路径相关的稳定性问题:test-dup2 已进入 Starry shell 但交互式 shell_init_cmd 偶发没有注入执行;apk-curl 在 upstream Alpine 镜像可达时,apk add curl 仍可能因为 60 秒硬超时被终止。

后续一次 PR1044 CI 中,Test starry loongarch64 qemu / run_container 的唯一失败为 test-timerfd-efault-wake 超时;日志确认新增的 test-tcp-info 已通过。该失败与 TCP_INFO 无关,最终处理为移除本分支中曾临时带入的 axtask SMP handoff 改动,使 PR1044 的最终 diff 不再包含调度器改动,避免本 PR 承担无关风险。

修改内容

  • ax-net-ng 中新增独立于 Linux ABI 的 TcpInfo 快照类型、TCP 状态枚举和 TCP option 标志。
  • TcpSocket 中根据 smoltcp 当前可确认语义的状态、ACK 延迟、超时、timestamp 配置和发送队列长度填充 TCP_INFO 快照。
  • 对 smoltcp 目前没有公开真实来源的 TCP 窗口/拥塞字段保持 0,包括 snd_wndsnd_cwndrcv_spacercv_wnd,避免把本地 buffer capacity 暴露成 Linux TCP 诊断语义。
  • 在 StarryOS getsockopt(TCP_INFO) 中把通用快照转换为 linux_raw_sys::net::tcp_info,支持按用户传入的 optlen 短拷贝,并返回实际写入长度。
  • setsockopt(TCP_INFO) 明确处理为只读 option,先完成 fd/套接字类型校验,再返回 ENOPROTOOPT
  • ax-net-ng 增加 TCP_INFO 默认快照单测,并新增 StarryOS test-tcp-info syscall 用例,覆盖 TCP fd、短 optlen 和 UDP ENOPROTOOPT 路径。
  • 为 StarryOS test-dup2 安装 /etc/profile.d/99-test-dup2-autorun.sh,让登录 shell 初始化时自动运行 /usr/bin/test-dup2
  • 调整 StarryOS apk-curl QEMU 用例:Cernet 镜像仍快速尝试 60 秒,upstream fallback 的 apk 操作允许 180 秒,并把用例总超时提高到 720 秒。
  • 合入最新 dev 并解决 os/arceos/modules/axnet-ng/src/tcp.rs 冲突,保留 base 新增的测试隔离逻辑。
  • 移除 PR1044 中与 TCP_INFO 无关的 axtask 调度器改动,保持该文件与 upstream/dev 对齐。

实现逻辑

通用网络模块只暴露语义化快照,不直接依赖 Linux 结构体布局;Starry syscall 层负责 ABI 转换和用户态内存写入。这样可以保持 ax-net-ng 对其他使用方可复用,同时让 Starry 的 TCP_INFO 行为贴近 Linux:不要求用户缓冲区必须等于完整结构体大小,长度较小时只返回可容纳的前缀字段。

Linux tcp_info 中的窗口和拥塞字段并不等同于本地 socket buffer capacity。当前 smoltcp 没有公开可直接对应这些字段的真实 getter,因此这些未知字段先保持为 0;只填充当前能确认语义正确的状态、MSS、RTO/ATO、timestamp 和 notsent bytes 等字段,避免用户态把近似值误判为 TCP 协议诊断状态。

test-dup2 的修复不改变测试断言,只把启动入口安装进 guest rootfs 的 profile 初始化路径。脚本用 AXBUILD_TEST_DUP2_AUTORUN_DONE 防止重复执行;这样即使 loongarch64 CI 中交互式命令没有及时送入 shell,测试二进制仍会随登录 shell 初始化自动运行并输出原有成功标记。

apk-curl 的修复保持“先 Cernet、后 upstream”的诊断顺序,但给每个镜像携带独立超时。Cernet 仍用于快速探测,避免长期卡住;upstream 在 GitHub CI 可达性更好,给 apk updateapk add curl 更长硬超时,避免慢速下载在功能正常时被过早终止。

本地验证

  • cargo fmt
  • cargo fmt --check
  • git diff --check

本地 Windows 环境运行以下命令时在编译 build script 阶段被 MSVC link.exe 缺失阻塞,未进入项目代码编译:

  • cargo test -p ax-net-ng tcp_info_reports_default_socket_metrics
  • cargo xtask clippy --package ax-net-ng

推送前已确认旧 CI run 26860285389 在上一版 head 上通过;本次修复已推送到新 head,等待 GitHub CI 对 c77581ee0ce02784333a6b2a1a45143875581ef9 重新验证。

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: feat(starry-kernel): implement TCP_INFO sockopt

改动概述

本 PR 包含四个独立但相关的改动:

  1. TCP_INFO 实现:在 ax-net-ng 中新增通用 TcpInfo 快照类型和状态/选项枚举,在 TcpSocket 中根据 smoltcp 状态填充快照,在 StarryOS syscall 层完成 Linux tcp_info ABI 转换并支持短拷贝。
  2. SMP PREV_TASK 生命周期修复:将 axtask 中的 PREV_TASKOption<NonNull<AxTask>> 改为 Option<AxTaskRef>(Arc 强引用),防止上下文切换期间前一个任务被提前释放。
  3. test-dup2 自动运行:为 StarryOS test-dup2 安装 /etc/profile.d/99-test-dup2-autorun.sh,登录 shell 初始化时自动运行测试。
  4. apk-curl 超时调整:Cernet 镜像保持 60s 快速探测,upstream fallback 增加到 180s,总超时提高到 720s。

代码质量分析

TCP_INFO 实现(主要改动)

  • 分层设计合理:ax-net-ng 模块只暴露语义化快照(TcpStateTcpInfoOptionsTcpInfo),StarryOS syscall 层负责 Linux ABI 转换,保持了模块复用性。
  • to_linux_tcp_infocore::mem::zeroed::<tcp_info>() 的 SAFETY 注释正确:tcp_info 是纯 C 数据结构,全零是有效基线。
  • write_tcp_infocore::slice::from_raw_parts 的 SAFETY 注释充分,且正确处理了 optlen 短拷贝场景。
  • setsockopt(TCP_INFO) 在完成 fd/套接字类型校验后返回 ENOPROTOOPT,符合 Linux 行为。
  • notsent_bytes 映射为 send_queue,语义正确。

SMP PREV_TASK 修复

  • 从裸指针改为 AxTaskRef(Arc clone)是正确的修复方式。旧代码在 CurrentTask::set_current() 释放旧 percpu current 引用后,如果 prev_task 只剩该引用,Arc::strong_count 断言会失败。新代码通过 PREV_TASK 持有额外强引用,保证任务存活直到 clear_prev_task_on_cpu() 消费该 slot。
  • switch_to 中的 assert!(Arc::strong_count(&prev_task) > 1) 仍然成立,因为 PREV_TASK slot 现在持有引用。

test-dup2 / apk-curl 修复

  • 99-test-dup2-autorun.sh 使用 AXBUILD_TEST_DUP2_AUTORUN_DONE 环境变量防止重复执行,return 0 2>/dev/null || exit 0 兼容 sourced 和 executed 上下文,设计合理。
  • apk-curl 超时调整逻辑正确:每个镜像携带独立超时,Cernet 快速探测避免长期卡住,upstream 在 CI 中可达性更好给予更多时间。

验证结果

检查项 结果
cargo fmt --check ✅ 通过
cargo clippy --manifest-path os/arceos/modules/axnet-ng/Cargo.toml --all-features -- -D warnings ✅ 通过,无警告
cargo test --manifest-path os/arceos/modules/axnet-ng/Cargo.toml --all-features ✅ 3 tests passed,包含新增 tcp_info_reports_default_socket_metrics
cargo clippy --manifest-path os/arceos/modules/axtask/Cargo.toml --all-features -- -D warnings ✅ 通过,无警告
cargo clippy --manifest-path os/StarryOS/kernel/Cargo.toml --all-features -- -D warnings ✅ 通过,无警告
cargo test --manifest-path os/arceos/modules/axtask/Cargo.toml --all-features ⚠️ 链接器错误(缺少平台特定符号如 _stdata),属预期内嵌入式环境限制,非 PR 引入

CI 状态

所有 GitHub Actions check runs 显示为 skipped 状态,未能观察到最新的 CI 通过记录。这可能是因为 PR 最后一次推送的时序问题或 CI 配置变更所致,建议作者确认最新 CI 是否正常触发。

其他说明

  • 无先前 review comments。
  • 未发现与本 PR 重叠的其他 open PR。
  • PR 没有新增 apps 测试用例(test-dup2 和 apk-curl 是已有测试的修复,不是新增),不需要额外的 QEMU app 验证。

总结

代码质量好,分层清晰,unsafe 使用有充分 SAFETY 注释,SMP 修复正确解决了实际的生命周期问题。所有可执行的验证(fmt、clippy、axnet-ng 单元测试)均通过。建议 APPROVE。

Powered by mimo-v2.5-pro

@ZR233 ZR233 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这次变更的分层方向是合理的:ax-net-ng 暴露语义化 TcpInfo 快照,Starry syscall 层再转换成 Linux ABI;PREV_TASK 从裸指针换成临时强引用也能解释并修复 PR 描述里的 SMP 生命周期问题。CI 当前 head 上相关 container/host 检查整体为通过/跳过状态,我本地也确认了格式、diff hygiene 和目标 clippy。现在还有几个需要先修正的阻塞点,所以先 request changes。

主要问题:

  1. tcpi_snd_wnd 当前填成了本地 send buffer 剩余空间,但 Linux 语义是对端通告的 receive window。这个字段现在不只是“近似值”问题,新增单测还会把错误基线固定成 TCP_TX_BUF_LEN。本机 Linux 对新建未连接 TCP socket 的 TCP_INFO 返回 state=7tcpi_snd_wnd=0tcpi_rcv_space=0tcpi_notsent_bytes=0tcpi_snd_cwnd=10,建议按 Linux 语义修正字段来源;如果 smoltcp 目前没有公开对端窗口 getter,至少不要用本地缓冲空间冒充。
  2. getsockopt(TCP_INFO) 是用户态可见 syscall ABI,目前只新增了 ax-net-ng 单测,没有覆盖 Starry syscall 层的 Linux ABI 转换、短 optlen、errno 路径。请补 normal syscall/regression 用例,直接通过 getsockopt(TCP_INFO) 验证 TCP fd 与非 TCP fd 行为。
  3. 当前 PR 与最新 dev 有真实合并冲突:apk-curl 已经在 #1078 后迁到 apps/starry/qemu/apk-curl,merge dry run 显示四个旧 test-suit/starryos/normal/qemu-smp1/apk-curl/qemu-*.toml 都是 modify/delete 冲突。请把超时调整移植到当前 base 的 apps/starry/qemu/apk-curl/sh/apk-curl-tests.sh 和对应 qemu 配置,不要 rebase 后重新引入旧路径。

本地验证结果:

  • git diff --check bbf8e9416193a55338f97d5497501188ba1edfb0..HEAD 通过。
  • cargo fmt --check 通过。
  • cargo test -p ax-net-ng tcp_info_reports_default_socket_metrics 通过,但测试本身需要按上面的 Linux 语义修正。
  • cargo xtask clippy --package ax-net-ng 通过,2/2 checks。
  • cargo xtask clippy --package ax-task 通过,16/16 checks。
  • cargo xtask clippy --package starry-kernel 通过,13/13 checks。

重复/重叠分析:当前 dev 仍只有 TCP_INFO stub,PREV_TASK 也仍是裸指针,所以核心功能不是已被 base 完全替代。开放 PR 中 #1016 也改 axtask/run_queue.rs,属于 SMP 调度方向的 partial-overlap,不是同一修复;#1000 是 curl/stress 测试方向,和这里的 apk-curl 稳定性调整有主题相近但不构成重复。真正需要处理的是 #1078 后的 apk-curl app 场景迁移冲突。

Comment thread os/arceos/modules/axnet-ng/src/tcp.rs Outdated
Comment thread os/StarryOS/kernel/src/syscall/net/opt.rs
Comment thread test-suit/starryos/normal/qemu-smp1/apk-curl/qemu-x86_64.toml Outdated
@ZR233
ZR233 requested a review from yfblock June 2, 2026 04:05

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审:ZR233 三个阻塞问题均已修正

上次 review 提出的三个阻塞点在最新提交 fa30d8dc(fix(starry-kernel): align TCP_INFO semantics)中全部解决:

1. tcpi_snd_wnd 语义修正 ✅

snd_wnd 已从本地 send buffer 剩余空间改为硬编码 0,与 Linux 对未连接 TCP socket 的基线行为一致(Linux 返回 tcpi_snd_wnd=0)。单测断言也同步更新为 assert_eq!(info.snd_wnd, 0)

2. Syscall 层测试覆盖 ✅

test-suit/starryos/normal/qemu-smp1/syscall/test-tcp-info/ 已包含三个场景:

  • test_tcp_info_full_copy:TCP fd → 验证 tcpi_state == TCP_CLOSEtcpi_snd_wnd == 0、optlen 范围
  • test_tcp_info_short_copy:1 字节 optlen → 验证短拷贝返回 TCP_CLOSE 字节
  • test_tcp_info_udp_rejected:UDP fd → 验证 ENOPROTOOPT

3. 合并冲突解决 ✅

旧路径 test-suit/starryos/normal/qemu-smp1/apk-curl/ 已被 dev 删除(#1078 迁移)。超时调整(Cernet 60s / upstream 180s / 总 720s)已正确应用到新路径 apps/starry/qemu/apk-curl/

本地验证

检查项 结果
cargo fmt --check
cargo clippy --manifest-path os/arceos/modules/axnet-ng/Cargo.toml --all-features -- -D warnings
cargo clippy --manifest-path os/arceos/modules/axtask/Cargo.toml --all-features -- -D warnings
cargo clippy --manifest-path os/StarryOS/kernel/Cargo.toml --all-features -- -D warnings
cargo test -p ax-net-ng ✅ 3 tests passed(含 tcp_info_reports_default_socket_metrics
git diff --check origin/dev..HEAD
与 dev 的 diff 13 files, +477/-34,无合并冲突

其他说明

  • SMP PREV_TASK 修复:Option<NonNull>Option<AxTaskRef> 正确保持了任务生命周期。
  • 分层设计保持不变:ax-net-ng 暴露语义快照,StarryOS syscall 层做 Linux ABI 转换。
  • setsockopt(TCP_INFO) 返回 ENOPROTOOPT 路径放在 fd/类型校验之后,符合 Linux 行为。

建议 APPROVE。

Powered by mimo-v2.5-pro

@ZR233 ZR233 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这轮已经确认上次 review 的几个明确阻塞点大多修掉了:tcpi_snd_wnd 不再使用本地 send buffer free space,Starry syscall regression 已补上,apk-curl 也迁到了 #1078 之后的新 apps/starry/qemu/apk-curl 路径。相关验证也能跑通。

TCP_INFO 里剩余几个窗口/拥塞字段仍然在用本地 buffer capacity 近似,语义上还会误导用户态,所以这里先继续 request changes。主要是 tcpi_rcv_space/tcpi_rcv_wnd/tcpi_snd_cwnd:宿主 Linux 新建未连接 TCP socket 的基线是 tcpi_rcv_space=0tcpi_snd_cwnd=10tcpi_snd_wnd=0,而当前实现会返回 rcv_space=rcv_wnd=64KiBsnd_cwnd=45,新增 ax-net-ng 单测也把这个不一致值固定下来了。建议只填当前能确知语义正确的字段;smoltcp 没有公开真实窗口/拥塞状态前,未知字段保留 0 会比用本地 buffer 容量冒充更稳妥。

本地验证:

  • git diff --check origin/dev...HEAD 通过。
  • cargo fmt --check 通过。
  • cargo test -p ax-net-ng tcp_info_reports_default_socket_metrics 通过,但该测试里的窗口断言需要按 Linux 语义调整。
  • cargo xtask clippy --package ax-net-ng 通过,2/2 checks。
  • cargo xtask clippy --package starry-kernel 通过,13/13 checks。
  • cargo xtask starry test qemu --arch x86_64 -c syscall 通过,最终汇总 PASS syscall
  • GitHub Actions 当前 head 的格式、clippy、std、Starry 四架构 QEMU container checks 均为 pass/skip,无失败项。

Comment thread os/arceos/modules/axnet-ng/src/tcp.rs Outdated

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审:窗口/拥塞字段语义与 Linux ABI 不一致(延续 ZR233 第三轮阻塞点)

已解决:tcpi_snd_wnd 修正为 0、syscall 测试覆盖、apk-curl 路径迁移。

未解决阻塞(tcp.rs tcp_info_snapshot 函数):

  1. snd_cwnd 用 send_capacity/MSS 算出 ~45 段,Linux 返回 tcpi_snd_cwnd=10。smoltcp 无真实拥塞窗口,建议保留 0。
  2. rcv_space 返回 recv buffer capacity ~64KiB,Linux 返回 tcpi_rcv_space=0。建议保留 0。
  3. rcv_wnd 同上,Linux 返回 tcpi_rcv_wnd=0。
  4. 单测固化了错误基线(assert_eq!(info.rcv_space, saturating_u32(TCP_RX_BUF_LEN)))。

CI workflow run 26860285389 结论 success,全部通过。本地 fmt/clippy/test 通过。

Powered by mimo-v2.5-pro

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR 审查:feat(starry-kernel): implement TCP_INFO sockopt

改动概述

本 PR 包含四个相关改动:

  1. TCP_INFO 实现ax-net-ng 新增 TcpInfo/TcpState/TcpInfoOptions 语义化快照,TcpSocket::tcp_info_snapshot() 根据 smoltcp 状态填充,StarryOS syscall 层完成 linux_raw_sys::net::tcp_info ABI 转换,支持短拷贝。
  2. test-dup2 自动运行:安装 profile.d 脚本,用环境变量防重复执行。
  3. apk-curl 超时调整:Cernet 60s + upstream 180s + 总超时 720s。
  4. axtask 恢复:移除临时带入的 SMP handoff 改动。

分层设计

分层方向正确:ax-net-ng 只暴露语义化快照,Starry syscall 层负责 ABI 转换。write_tcp_info 短拷贝处理和 SAFETY 注释充分。setsockopt(TCP_INFO) 在校验后返回 ENOPROTOOPT,符合 Linux 行为。

本地验证

检查项 结果
cargo fmt --check (ax-net-ng)
cargo clippy (ax-net-ng)
cargo clippy (starry-kernel)
cargo clippy (axtask)
cargo test (ax-net-ng) ✅ 3 tests passed
crates.io patch 检查 ✅ 无

CI 状态

check-runs 为 skipped/success 状态。mergeable_state: blocked 受 review decision 限制。

前序审查意见

ZR233 三轮审查核心阻塞点:

  1. ✅ tcpi_snd_wnd 已修正为 0
  2. ✅ syscall 层测试已补
  3. ✅ apk-curl 冲突已迁移
  4. ❌ tcpi_rcv_space/tcpi_rcv_wnd/tcpi_snd_cwnd 语义未解决

未解决阻塞:窗口/拥塞字段语义

tcp_info_snapshot() 中:

  • rcv_space = recv_capacity - recv_queue 约 64KiB(Linux 返回 0)
  • rcv_wnd = recv_space 约 64KiB(Linux 返回 0)
  • snd_cwnd = send_capacity / snd_mss 约 45 段(Linux 返回 0 或 10)

语义根本不同:Linux 的这些字段是 TCP 窗口/拥塞状态,当前返回的是本地 buffer capacity。单测也固化了不一致基线。

建议:smoltcp 未公开真实窗口/拥塞 getter 前,未知字段保留 0,同步更新单测断言。

重复/重叠分析

dev 仍只有 TCP_INFO stub,本 PR 是唯一实现。无重复 open PR。

总结

分层设计合理、ABI 转换正确、测试覆盖充分。剩余阻塞仅为窗口/拥塞字段语义,修正后即可 APPROVE。

Powered by mimo-v2.5-pro

Comment thread os/arceos/modules/axnet-ng/src/tcp.rs Outdated
Comment thread os/arceos/modules/axnet-ng/src/tcp.rs Outdated

@ZR233 ZR233 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

上次审查后作者修复了 TCP_INFO window 默认值对齐并 rebase dev。CI 通过。但之前指出的其他问题仍需确认。

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审总结

改动概述

本 PR 实现了 StarryOS 的 getsockopt(TCP_INFO) syscall,核心分四部分:

  1. TCP_INFO 语义快照ax-net-ng 新增 TcpInfo/TcpState/TcpInfoOptions 类型,TcpSocket::tcp_info_snapshot() 根据 smoltcp 状态填充可确认语义的字段,smoltcp 无公开 getter 的窗口/拥塞字段保持为 0。
  2. Linux ABI 转换:StarryOS syscall 层 write_tcp_info() 将语义快照映射为 linux_raw_sys::net::tcp_info,支持按 optlen 短拷贝;setsockopt(TCP_INFO) 在 fd/类型校验后返回 ENOPROTOOPT
  3. test-dup2 自动运行:安装 profile.d 脚本,用环境变量防重复执行,解决 loongarch64 CI 交互式命令偶发未注入的问题。
  4. apk-curl 超时调整:Cernet 60s 快速探测 + upstream 180s + 总超时 720s,已迁移到 #1078 后的新路径。

前序审查意见处理

ZR233 四轮审查的阻塞点全部修正:

  • tcpi_snd_wnd 从本地 send buffer 改为 0
  • tcpi_rcv_space/tcpi_rcv_wnd/tcpi_snd_cwnd 从 buffer capacity 改为 0
  • ✅ syscall 层测试已补(TCP fd / 短 optlen / UDP ENOPROTOOPT)
  • ✅ apk-curl 已迁移到 apps/starry/qemu/apk-curl 新路径
  • ✅ 单测断言已同步更新为 Linux 基线值(全 0)

实现逻辑

分层设计合理:ax-net-ng 只暴露语义化快照,不依赖 Linux 结构体布局,保持对其他使用方的复用性;Starry syscall 层负责 ABI 转换和用户态内存写入。write_tcp_infocore::slice::from_raw_parts 的 SAFETY 注释充分,to_linux_tcp_infocore::mem::zeroed 对纯 C 数据结构有效。tcp_state_to_linux 映射值与 Linux include/uapi/linux/tcp.hTCP_ESTABLISHED=1TCP_CLOSING=11 一致。

本地验证

检查项 结果
git diff --check origin/dev..HEAD
cargo fmt --check
cargo test -p ax-net-ng ✅ 3 tests passed(含 tcp_info_reports_default_socket_metrics
cargo xtask clippy --package ax-net-ng ✅ 2/2 checks
cargo xtask clippy --package starry-kernel ✅ 13/13 checks
[patch.crates-io] 检查 ✅ 无

CI 状态

GitHub Actions statusCheckRollupSUCCESSmergeable_state: blocked 由之前的 CHANGES_REQUESTED review 决策导致,非 CI 问题。

重复/重叠分析

  • dev 仍只有 TCP_INFO stub,本 PR 是唯一实现。
  • 开放 PR 均为 eBPF JIT 方向(#1139/#1140/#1141),与本 PR 无重叠。
  • 无合并冲突,与 dev 保持对齐。

其他说明

  • test-tcp-info syscall 用例覆盖了 TCP fd 状态/长度、短 optlen 和 UDP ENOPROTOOPT,防止 ABI 回退。
  • apk-curltest-dup2 的修改是已有测试的稳定性改进,不是新增 app,不需要额外 QEMU app 验证。
  • 当前 PR 无阻塞问题,可以合并。

Powered by mimo-v2.5-pro

@ZR233 ZR233 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前版本可以合入。

这次变更把 TCP_INFO 的 Linux ABI 处理放在 Starry syscall 层,ax-net-ng 只提供语义化 TcpInfo 快照;已知 smoltcp 暂无真实来源的窗口/拥塞字段保持 0,避免把本地 buffer capacity 暴露成错误的 Linux 诊断语义。getsockopt(TCP_INFO) 的短 optlen 拷贝、TCP_CLOSE 状态、只读 setsockopt 处理,以及 UDP fd 返回 ENOPROTOOPT 的方向都符合这里的实现边界。

本地验证在当前 head c77581e 上通过:

  • cargo fmt --check
  • git diff --check origin/dev...HEAD
  • cargo test -p ax-net-ng tcp_info_reports_default_socket_metrics
  • cargo xtask clippy --package ax-net-ng
  • cargo xtask clippy --package starry-kernel
  • cargo xtask starry test qemu --arch x86_64 --test-group normal --test-case syscall
  • cargo xtask starry test qemu --arch x86_64 --test-group normal --test-case test-dup2
  • cargo xtask starry test qemu --arch loongarch64 --test-group normal --test-case test-dup2
  • cargo xtask starry app qemu --arch x86_64 --test-case qemu/apk-curl

QEMU 里确认新增 /usr/bin/starry-test-suit/test-tcp-info 实际执行,TCP_INFO full copy、短 optlen、tcpi_snd_wnd、UDP ENOPROTOOPT 都 PASS;syscall 组最终命中 STARRY_GROUPED_TESTS_PASSED。test-dup2 在 x86_64 和 loongarch64 都输出 DONE: 36 pass, 0 fail。apk-curl x86_64 走 Cernet 镜像完成 apk update、apk add curl、curl --version 和 probe,并命中 APK_CURL_TEST_PASSED。

CI 也重新查了当前 head,GitHub Actions 相关 run_host/run_container 矩阵成功项均为 success,跳过项是互斥矩阵/发布路径的预期 skipped;没有失败检查。旧的 review threads 当前都已 resolved。

重复/重叠方面,dev 上仍只是 TCP_INFO 占位实现;open PR 中 #1000/#990 是 curl 或 harness 方向、#921 是 netlink/epoll,#1017/#1038/#1039/#1052/#1055 也没有实现同一 TCP_INFO 语义或修改同一核心契约,因此没有发现 duplicate/superseded 风险。

@ZR233
ZR233 merged commit 1f26fff into rcore-os:dev Jun 5, 2026
49 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
silicalet added a commit to silicalet/tgoskits that referenced this pull request Jun 6, 2026
- mount.rs: keep Arc children model with clone_tree/clone_children_from/clone_shallow
- dir.rs: adopt upstream generation-based cache + mountpoint rename transfer
- inode.rs: merge upstream (name, is_dir) signature with pending-delete + truncate_inode

Upstream changes absorbed:
- fix(axfs-ng): zero partial last page when truncating (rcore-os#1124)
- fix(locking): narrow spinlock scope in VFS and Starry paths (rcore-os#1146)
- chore(axbuild): pin ostool runtime bin fix (rcore-os#1158)
- feat(starry-apps): runnable eBPF demos (rcore-os#1132)
- feat(starry): wire qperf app runtime into Starry perf (rcore-os#1095)
- fix(axcpu-aarch64): emulate EL0 MRS reads of ID_AA64* (rcore-os#1128)
- feat(rsext4): fine-grained locking for SMP (rcore-os#1057)
- feat(starry-kernel): implement TCP_INFO sockopt (rcore-os#1044)
- test(starryos): add fork parent-child identity test (rcore-os#995)
- fix(starry-mm): mprotect returns ENOMEM on unmapped holes (rcore-os#918)

Tests verified:
- test-nix-prereqs: PASS
- nix-smoke: PASS
- syscall (upstream): PASS
- test-dup2 (upstream): PASS
@github-actions github-actions Bot mentioned this pull request Jun 9, 2026
aptacc2421 pushed a commit to aptacc2421/tgoskits that referenced this pull request Jun 14, 2026
* feat(starry-kernel): implement TCP_INFO sockopt

* fix(axtask): keep previous task alive during switch

* test(starryos): autorun dup2 qemu case

* test(starryos): relax apk curl fetch timeout

* fix(axtask): restore raw previous-task handoff

---------

Co-authored-by: “cqwhfhh” <“2503600166@qq.com”>
Co-authored-by: Test User <test@example.com>
luodeb pushed a commit that referenced this pull request Jun 30, 2026
* feat(starry-kernel): implement TCP_INFO sockopt

* fix(axtask): keep previous task alive during switch

* test(starryos): autorun dup2 qemu case

* test(starryos): relax apk curl fetch timeout

* fix(axtask): restore raw previous-task handoff

---------

Co-authored-by: “cqwhfhh” <“2503600166@qq.com”>
Co-authored-by: Test User <test@example.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.

2 participants