[BUG] CBMC: unsatisfiable uxLength assumption in the DHCPv6HandleOption harness leaves the Status Code case unchecked
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 88/100
Direzione di ricerca
Apri test/cbmc/proofs/DHCPv6/DHCPv6HandleOption/DHCPv6HandleOption_harness.c e controlla lo stub prvDHCPv6_handleStatusCode() intorno alle righe 56–57. Correggi l’ipotesi contraddittoria su uxLength in modo che corrisponda all’intervallo previsto nel commento, quindi esegui i comandi make goto e make -s cbmc della prova. Il lavoro è completato quando CBMC riporta SUCCESS e la copertura dopo l’ipotesi è SATISFIED.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
In the CBMC proof DHCPv6/DHCPv6HandleOption, the prvDHCPv6_handleStatusCode() stub assumes uxLength <= 2 && uxLength >= 50, which no value satisfies. Every path through the Status Code case of prvDHCPv6_handleOption() ends in this stub, so CBMC never checks the rest of that case (the xHasError update and the break), yet make cbmc reports SUCCESS. Only the proof is affected, and it still passes after the fix below.
DHCPv6HandleOption_harness.c, lines 56-57:
/* 2 bytes is read for usStatus, so minimum length should be greater than 2 and maximum size of message buffer is 50 bytes. */
__CPROVER_assume( uxLength <= 2 && uxLength >= 50 );
According to the comment, the intended range is uxLength > 2 && uxLength <= 50.
Target
Not target-specific: CBMC proof only.
Host
Ubuntu 22.04 (x86-64), CBMC 6.3.1 (the version pinned in .github/workflows/ci.yml), 32-bit glibc headers from libc6-dev-i386. main at b86ad086e9870099bb0ac18a75dcb7f6dd508cc7 (V4.4.2).
To Reproduce
The cbmc line uses the proof's own CBMCFLAGS.
git clone https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git
cd FreeRTOS-Plus-TCP
git checkout b86ad086e9870099bb0ac18a75dcb7f6dd508cc7
git submodule update --init --checkout test/FreeRTOS-Kernel
cd test/cbmc/proofs
python3 prepare.py
cd DHCPv6/DHCPv6HandleOption
make goto
make -s cbmc; grep '<cprover-status>' cbmc.xml; grep -c '<result ' cbmc.xml
cbmc --32 --object-bits 8 --unwind 2 --nondet-static --cover assume DHCPv6HandleOption.goto | grep 'line 57'
Last lines of the output:
<cprover-status>SUCCESS</cprover-status>
202
[__CPROVER_file_local_FreeRTOS_DHCPv6_c_prvDHCPv6_handleStatusCode.coverage.3] file DHCPv6HandleOption_harness.c line 57 function __CPROVER_file_local_FreeRTOS_DHCPv6_c_prvDHCPv6_handleStatusCode assert(false) before assume(uxLength <= (unsigned int)2 && uxLength >= (unsigned int)50): SATISFIED
[__CPROVER_file_local_FreeRTOS_DHCPv6_c_prvDHCPv6_handleStatusCode.coverage.4] file DHCPv6HandleOption_harness.c line 57 function __CPROVER_file_local_FreeRTOS_DHCPv6_c_prvDHCPv6_handleStatusCode assert(false) after assume(uxLength <= (unsigned int)2 && uxLength >= (unsigned int)50): FAILED
before ...: SATISFIED together with after ...: FAILED means that CBMC reaches the assumption but the assumption never holds.
Expected behavior
The point after the assumption is reachable (after ...: SATISFIED), so the rest of the Status Code case is checked. With the patch below, the same commands print SUCCESS, 202 and after ...: SATISFIED.
Additional context
Suggested fix (apply with git apply from the repository root):
diff --git a/test/cbmc/proofs/DHCPv6/DHCPv6HandleOption/DHCPv6HandleOption_harness.c b/test/cbmc/proofs/DHCPv6/DHCPv6HandleOption/DHCPv6HandleOption_harness.c
index 96b30b73..1d2e0fa8 100644
--- a/test/cbmc/proofs/DHCPv6/DHCPv6HandleOption/DHCPv6HandleOption_harness.c
+++ b/test/cbmc/proofs/DHCPv6/DHCPv6HandleOption/DHCPv6HandleOption_harness.c
@@ -54,7 +54,7 @@ BaseType_t __CPROVER_file_local_FreeRTOS_DHCPv6_c_prvDHCPv6_handleStatusCode( si
{
__CPROVER_assume( pxMessage != NULL );
/* 2 bytes is read for usStatus, so minimum length should be greater than 2 and maximum size of message buffer is 50 bytes. */
- __CPROVER_assume( uxLength <= 2 && uxLength >= 50 );
+ __CPROVER_assume( uxLength > 2 && uxLength <= 50 );
return nondet_BaseType();
}
prvIsOptionLengthValid() accepts a Status Code length of exactly 2, so uxLength >= 2 would match the caller as well. This harness fixes the option length at 16, and both lower bounds give the same results. The patch restores reachability for that harness; it is not the helper's full length contract. The real helper also handles longer options by truncating the displayed message and reading the remainder, so its 50-byte local buffer does not require uxLength <= 50.
- Lingua principale
- C
- Stelle
- 215
- Fork
- 222
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la 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 FreeRTOS/FreeRTOS-Plus-TCP
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 63/100
FreeRTOS/FreeRTOS-Plus-TCP#1395 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
FreeRTOS/FreeRTOS-Plus-TCP#1389 ·
-
[BUG] PhyHandling incorrectly lists LAN8742A as having 19 PHYCRForse già presa @StitchLilo626 l’ha presa 41 giorni fa. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
FreeRTOS/FreeRTOS-Plus-TCP#1361 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
FreeRTOS/FreeRTOS-Plus-TCP#1392 · 1 commento ·
-
[BUG] DHCPv6 socket-allocation failure crashes with assertions disabled; CBMC stubs hide the pathApertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
FreeRTOS/FreeRTOS-Plus-TCP#1391 ·
Tutte le issue di FreeRTOS/FreeRTOS-Plus-TCP
Issue simili
-
RecompLauncher supportAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
shinyquagsire23/OpenJKDF2#540 ·
I maintainer di solito rispondono entro 12 giorni
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Life-Framework/Life-Framework#5939 ·
I maintainer di solito rispondono entro 1 giorno
-
autoconf failes to find libsodium even when present due to implicit function declarationForse già presa @coderjoe l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 13 giorni
-
SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecationApertaBug Status: Needs Triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement_package: a site operand of another JSON type raises TypeError, not a named refusalApertabug python
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
Jstar269/nakagawa-recomp#3521 ·
I maintainer di solito rispondono entro 1 giorno