Make simulated WFP flow-context removal atomic and idempotent

Aperta
#345 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
networking

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
C++
Stelle
112
Fork
36
Merge medio
8g 10h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/usersim

Tutte le issue di microsoft/usersim

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.