fix(can): close the race between the identity check and the read-only store
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #60 di @Tichael — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- embedded-iot
Direzione di ricerca
Start by reading the implementations of set_can_read_only(), is_can_read_only(), and the identity confirmation and revocation functions mentioned in the issue. Then inspect the existing CAN tests and add the described interleaving test: confirm identity, unlock, clear only the identity flag, and assert the bus reads as read-only. Done when the test passes and an unconfirmed identity always reads as read-only.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up to #49.
Problem
set_can_read_only(false) checks the identity flag and then stores the read-only flag in two separate steps:
let enabled = enabled || crate::can_log::is_can_logging() || !is_car_identity_confirmed();
CAN_READ_ONLY.store(enabled, Ordering::Relaxed);
If revoke_car_identity() runs between those two steps, the order is:
set_can_read_only(false)reads identity = confirmed, soenabled = false.revoke_car_identity()clears the identity and storesCAN_READ_ONLY = true.set_can_read_only(false)storesCAN_READ_ONLY = false.
The bus ends up unlocked with no confirmed identity, which is what the gate is meant to prevent.
Is it reachable today?
No. Nothing calls set_can_read_only(false) yet, and embassy tasks on one executor only switch at await points. It becomes possible if these functions are ever called from an interrupt, a second executor (e.g. an interrupt-priority executor on ESP) or another thread on PC.
The CAN logging check doesn't have this gap: is_can_read_only() already ORs in is_can_logging(), so it's enforced when the flag is read.
Suggested fix
Treat the identity like logging: OR !is_car_identity_confirmed() into is_can_read_only(), so an unconfirmed identity always reads as read-only, whatever CAN_READ_ONLY holds. Alternatively, wrap the check and the store in critical_section::with (core-interface already depends on critical-section).
Add a test that confirms, unlocks, and then clears only the identity flag (simulating the interleaving) and asserts that is_can_read_only() returns true.
- Lingua principale
- Rust
- Stelle
- 1
- Fork
- 0
- Merge medio
- 10h 56m
- PR unite (30g)
- 15
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenCarControls/firmware
-
Clean up E-GMP leftoversForse già presa @Tichael l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
OpenCarControls/firmware#34 ·
I maintainer di solito rispondono entro 1 giorno
-
BLE: send the current state when the app subscribesForse già presa @Tichael l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
OpenCarControls/firmware#58 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
OpenCarControls/firmware#55 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
OpenCarControls/firmware#54 ·
I maintainer di solito rispondono entro 1 giorno
-
First-setup pairing window is too short and stays open after the first bondForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
OpenCarControls/firmware#53 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenCarControls/firmware
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
feat: New firmware supportApertafeature
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
dsx-ai-factory/infra-controller#8145 ·
I maintainer di solito rispondono entro 1 giorno
-
bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjectsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
`last_error_thread_local_then_global` fails when it runs beside the `lumen_event_detail` testApertaA-FFI C-Testing D-Straightforward S-Ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno