Skip to content

Add CBMC proofs for additional receive-path parsing functions - #1360

Merged
AniruddhaKanhere merged 2 commits into
FreeRTOS:mainfrom
AniruddhaKanhere:add-cbmc-proofs-untrusted-parsers
Aug 20, 2026
Merged

Add CBMC proofs for additional receive-path parsing functions#1360
AniruddhaKanhere merged 2 commits into
FreeRTOS:mainfrom
AniruddhaKanhere:add-cbmc-proofs-untrusted-parsers

Conversation

@AniruddhaKanhere

Copy link
Copy Markdown
Member

Description

Adds CBMC memory-safety proof harnesses for several receive-path parsing
functions that previously lacked proof coverage. Each harness follows the
existing proof conventions and uses minimal assumptions: input buffers are
allocated to exactly their modeled length with nondeterministic contents, so
any over-read is reported as a genuine out-of-bounds access.

New proofs:

  • BitConfig byte readers: xBitConfig_init, ucBitConfig_read_8, usBitConfig_read_16, ulBitConfig_read_32, xBitConfig_read_uc, pucBitConfig_peek_last_index_uc
  • DNS: parseDNSAnswer
  • TCP header option parsing: prvSingleStepTCPHeaderOptions, prvReadSackOption
  • DHCPv6 option handling: prvDHCPv6_subOption, prvDHCPv6_handleStatusCode, prvIsOptionLengthValid
  • IPv4 packet acceptance: prvAllowIPPacketIPv4
  • ICMP echo reply handling: prvProcessICMPEchoReply

Test Steps

Run via test/cbmc/proofs/run-cbmc-proofs.py. All added proofs verify successfully.

Checklist

  • I have tested my changes. No regression in existing tests.
  • I have added proofs only; no library source is modified.

Adds minimal-assumption CBMC proof harnesses for previously-unproven
functions that parse untrusted network input:
- BitConfig byte readers (init, read_8/16/32, read_uc, peek_last)
- DNS answer record parsing (parseDNSAnswer)
- TCP header option parsing (prvSingleStepTCPHeaderOptions, prvReadSackOption)
- DHCPv6 option handling (sub-option, status code, option-length validation)
- IPv4 packet acceptance (prvAllowIPPacketIPv4)
- ICMP echo reply handling (prvProcessICMPEchoReply)

Buffers are allocated to exactly their modeled length with nondeterministic
contents so any over-read surfaces as a genuine out-of-bounds access.
@AniruddhaKanhere
AniruddhaKanhere enabled auto-merge (squash) August 20, 2026 15:58
@AniruddhaKanhere
AniruddhaKanhere merged commit 3932049 into FreeRTOS:main Aug 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants