audit 0.21.0: DFU, video and net follow-ups (DFU UPLOAD during dfuDNBUSY)

Aperta
#4,527 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
10/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
c, embedded-iot

Direzione di ricerca

This is a batch audit write-up, not a single task: split it before anyone starts. For item 2, begin at the UPLOAD callback around src/class/dfu/dfu_device.c:273 and the DFU 1.1 state table (which states accept UPLOAD, what follows a short upload, the required STALL/status for UPLOAD during dfuDNBUSY) — done means a state gate plus a test where an async download holds the buffer while UPLOAD arrives. Items 1 and 3 sit in src/class/net/ecm_rndis_device.c and src/class/video/video_device.c:868,1441 and need CDC/UVC spec review and hardware-in-the-loop runs, so treat the listed verdicts as candidates, not cleared instructions.

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

Descrizione

follow-up Prio 📌

Deferred defects found in the repository audit of 0.21.0..ad7c83db8 (batch class-other). Each was validated against the source at ad7c83db8 and judged real but too large, or too hardware-dependent, for the audit PR's contained fixes.

1. Busy notification endpoint loses an ECM link transition.
  • Where: src/class/net/ecm_rndis_device.c:89,407
  • Verdict: valid. Setter updates local state, netd_report() returns on failed claim, and notification completion performs no retry.; introduced: Older; these paths are unchanged by the range.; severity: medium
  • Hardware/spec dependence: Loss is software-provable; notification policy needs CDC review before implementation. No record.
  • Overlap: #4474 concerns NCM, not ECM; no full match found.
  • Remaining work and verification: Preserve/coalesce desired ECM state and retry from task/completion context. Do not copy NCM’s fallible enqueue unchanged. Test a transition during an outstanding notification, then ECM hardware traffic.
2. UPLOAD can overwrite an outstanding asynchronous download buffer.
  • Where: src/class/dfu/dfu_device.c:273
  • Verdict: valid source path. No state gate precedes the upload callback. Not introduced by the dedicated-buffer change: both operations previously used the same get_xfer_buffer() too.; introduced: Older.; severity: high
  • Hardware/spec dependence: Corruption path is software-provable; required DFU state/error transitions need a record.
  • Overlap: No matching coverage found; #4140/PR #4420 concern runtime DETACH.
  • Remaining work and verification: Gate UPLOAD and audit its state transitions; test an asynchronous download retaining the buffer while UPLOAD arrives. Choose error handling only after DFU lookup.
3. SET_INTERFACE/reset mutate state outside the submission mutex.
  • Where: src/class/video/video_device.c:868,1441
  • Verdict: valid race. The close/clear/reconfigure path can interleave with application submission; locking only _clear_frame() would be insufficient.; introduced: Older race; new mutex only partially addresses concurrent ownership.; severity: medium
  • Hardware/spec dependence: Race requires no spec premise; safe endpoint retirement needs DCD semantics. No record.
  • Overlap: #4428 overlaps stream teardown, but does not fully cover the RTOS submission race.
  • Remaining work and verification: Serialize the whole lifecycle transition, including endpoint operations and reset. Add controlled interleaving tests and RTOS streaming/reset HIL.
Adjudication notes: class-other

Claims still needing read-doc:

  • X1: CDC-NCM 1.0 §3.3.4/Table 6-3 and applicable errata: does the divisor/remainder constrain the Ethernet header or the payload after it? Does IN remainder 2 correctly describe every transmitted datagram?
  • C2: DFU 1.1: which states accept UPLOAD, what transitions follow full/short uploads, and what STALL/state/status response is required for UPLOAD during DNBUSY?
  • C3/S6: UVC: must COMMIT contain resolved format/frame/interval values, what minimum payload permits a valid stream, and how must invalid values be rejected? PROBE and GET_RES must be considered separately.
  • S8: USB control OUT and RNDIS: required handling when wLength exceeds supported command storage, including permitted SETUP rejection and early data termination.
  • S7: CDC-ECM: required notification ordering/coalescing after a link change while a notification is outstanding.
  • If C4/C6 fixes or S9/C5 proposals are pursued: verify endpoint close/reset/halt retirement and stale-completion behavior for each chosen DCD; for C5, ChipIdea dTD transaction/buffer errors and applicable MCU errata, plus UVC error recovery. No blanket all-DCD claim is established.

No additional introduced defect was confirmed beyond these findings. The RTOS self-deadlock strengthens C7/X2 and is already explicitly tracked by #4474.

Read-doc lookups, builds, unit tests, fuzzing and HIL did not run. Consequently the gated fixes are candidates, not cleared implementation instructions. GitHub checks returned 190 open follow-up issues and 28 open PRs; targeted issue searches supplemented them. No files were edited.

Lingua principale
C
Stelle
7.3k
Fork
1.6k
Merge medio
1g 19h
PR unite (30g)
67

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 hathach/tinyusb

Tutte le issue di hathach/tinyusb

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.