Make simulated WFP flow-context removal atomic and idempotent

未关闭
#345 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
networking

调研方向

Start with fwp_engine_t::test_remove_flow_context and delete_flow_context, where the shared-lock lookup of fwpm_flow_contexts is released before the exclusive-lock erase. Make find-and-erase one exclusive-lock section, copy the callback inputs, then call flowDeleteFn after unlocking. Done means concurrent removers invoke it at most once, absent entries return a defined status, and a concurrency test covers FwpsFlowRemoveContext0 against simulated deletion.

由索引模型根据 Issue 内容生成。

描述

Problem

fwp_engine_t::test_remove_flow_context checks fwpm_flow_contexts under a shared lock, releases the lock, and then calls delete_flow_context, which reacquires an exclusive lock. Two concurrent removers can both observe the association. The winner erases it; the loser then finds no entry, asserts that the callout is non-null, and can invoke flowDeleteFn through a null pointer.

This occurs when simulated external flow deletion races with FwpsFlowRemoveContext during callout cleanup.

Originating review: https://github.com/microsoft/ebpf-for-windows/pull/5623#discussion_r4458625427

Desired behavior

Finding and claiming a flow-context association must be one atomic operation. Exactly one remover should own the association and invoke flowDeleteFn; later removers should receive a safe already-removed/not-found result.

The callback must still run after releasing the engine lock.

Acceptance criteria

  • Find-and-erase of fwpm_flow_contexts occurs under one exclusive lock.
  • The winning remover copies all callback inputs before releasing the lock.
  • flowDeleteFn is invoked outside the engine lock and at most once per association.
  • Missing or already-removed associations return a defined status/no-op without assertions or null dereferences.
  • FwpsFlowRemoveContext0 reports an appropriate status for an absent association.
  • A concurrency test runs cleanup removal and simulated flow deletion against the same flow.
主要语言
C++
星标
112
派生
36
平均合并
8 天 10 小时
30 天内合并 PR
6

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/usersim 的其他 Issue

查看 microsoft/usersim 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。