Keep WFP filter context alive through classify callback completion

Aperta
#344 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
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
networking

Direzione di ricerca

Start with fwp_engine_t::test_callout in the usersim WFP simulation, where the filter is selected under the engine lock, rawContext is copied, and classifyFn is invoked after the lock is released. Read how filter deletion removes entries and how reference counting or locking is already used for other simulated objects. Done means a lifetime guard is held across the callback and released on every path, plus a concurrent classify-versus-delete stress test that passes without use-after-free.

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

Descrizione

Problem

fwp_engine_t::test_callout selects a simulated WFP filter under the engine lock, copies rawContext, releases the lock, and then invokes classifyFn. Concurrent filter deletion can remove the filter and allow the object referenced by rawContext to be freed before the classify callback has acquired its own protection.

A detach-versus-classify stress test can therefore trigger a usersim use-after-free even when the callout implementation is correct. Real WFP keeps the filter/callout context valid for an admitted classify callback.

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

Desired behavior

Once usersim admits a classify callback, the selected filter, callout, and raw context must remain valid until that callback returns. Filter deletion may prevent new classifications, but must wait for or otherwise preserve state used by callbacks already in progress.

Acceptance criteria

  • test_callout acquires explicit lifetime protection before releasing the engine lock.
  • Concurrent filter deletion cannot free or invalidate rawContext during classifyFn.
  • New classify attempts fail cleanly after filter deletion begins or completes.
  • Lifetime protection is released after callback completion on every path.
  • A stress test repeatedly overlaps classification and filter deletion without use-after-free or stale-pointer access.
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.