-
Notifications
You must be signed in to change notification settings - Fork 207
Fix build and proof failures for CBMC ARP proofs #709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
75e6fde
5a0bac2
a1371d9
8068a1d
ff05ea3
be35723
441e266
1999639
e0f3d75
c17d11d
759182e
2895b31
e3313df
a5d9b57
a48c5ef
62f0638
563b329
7b22b34
f575184
b6b388d
e6e3b81
b1f9e46
f516277
39d8c53
a338c5c
49cbd55
55a3ed9
7e0a5b6
195e024
e9c8861
4954db6
2322350
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,45 @@ NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedS | |
| return pxNetworkBuffer; | ||
| } | ||
|
|
||
| BaseType_t NetworkInterfaceOutputFunction_Stub( struct xNetworkInterface * pxDescriptor, | ||
| NetworkBufferDescriptor_t * const pxNetworkBuffer, | ||
| BaseType_t xReleaseAfterSend ) | ||
| { | ||
| __CPROVER_assert( pxDescriptor != NULL, "The network interface cannot be NULL." ); | ||
| __CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer descriptor cannot be NULL." ); | ||
| __CPROVER_assert( pxNetworkBuffer->pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL." ); | ||
| return 0; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we returning 0 and not |
||
| } | ||
|
|
||
| void harness() | ||
| { | ||
| /* | ||
| For this proof, its assumed that the endpoints and interfaces are correctly | ||
| initialised and the pointers are set correctly. | ||
| Assumes two endpoints and interface is present. | ||
| */ | ||
|
|
||
| pxNetworkEndPoints = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints != NULL ); | ||
|
|
||
| /* Interface init. */ | ||
| pxNetworkEndPoints->pxNetworkInterface = ( NetworkInterface_t * ) malloc( sizeof( NetworkInterface_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints->pxNetworkInterface != NULL ); | ||
|
|
||
| if( nondet_bool() ) | ||
| { | ||
| pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints->pxNext != NULL ); | ||
| pxNetworkEndPoints->pxNext->pxNext = NULL; | ||
| pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkEndPoints->pxNetworkInterface; | ||
| } | ||
| else | ||
| { | ||
| pxNetworkEndPoints->pxNext = NULL; | ||
| } | ||
|
|
||
| pxNetworkEndPoints->pxNetworkInterface->pfOutput = NetworkInterfaceOutputFunction_Stub; | ||
| /* No assumption is added for pfOutput as its pointed to a static object/memory location. */ | ||
|
|
||
| vARPAgeCache(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,10 +72,49 @@ NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedS | |
| return &xNetworkBuffer; | ||
| } | ||
|
|
||
| BaseType_t NetworkInterfaceOutputFunction_Stub( struct xNetworkInterface * pxDescriptor, | ||
| NetworkBufferDescriptor_t * const pxNetworkBuffer, | ||
| BaseType_t xReleaseAfterSend ) | ||
| { | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should add asserts on the pointers to make sure that they are not NULL when stub is called.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
| __CPROVER_assert( pxDescriptor != NULL, "The network interface cannot be NULL." ); | ||
| __CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer descriptor cannot be NULL." ); | ||
| __CPROVER_assert( pxNetworkBuffer->pucEthernetBuffer != NULL, "The ethernet buffer cannot be NULL." ); | ||
|
|
||
| } | ||
|
|
||
|
|
||
| void harness() | ||
| { | ||
| uint32_t ulIPAddress; | ||
|
|
||
| /* | ||
| For this proof, its assumed that the endpoints and interfaces are correctly | ||
| initialised and the pointers are set correctly. | ||
| Assumes one endpoint and interface is present. | ||
| */ | ||
|
|
||
| pxNetworkEndPoints = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints != NULL ); | ||
|
|
||
| /* Interface init. */ | ||
| pxNetworkEndPoints->pxNetworkInterface = ( NetworkInterface_t * ) malloc( sizeof( NetworkInterface_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints->pxNetworkInterface != NULL ); | ||
|
|
||
| if( nondet_bool() ) | ||
| { | ||
| pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) ); | ||
| __CPROVER_assume( pxNetworkEndPoints->pxNext != NULL ); | ||
| pxNetworkEndPoints->pxNext->pxNext = NULL; | ||
| pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkEndPoints->pxNetworkInterface; | ||
| } | ||
| else | ||
| { | ||
| pxNetworkEndPoints->pxNext = NULL; | ||
| } | ||
|
|
||
| pxNetworkEndPoints->pxNetworkInterface->pfOutput = &NetworkInterfaceOutputFunction_Stub; | ||
| /* No assumption is added for pfOutput as its pointed to a static object/memory location. */ | ||
|
|
||
| FreeRTOS_OutputARPRequest( ulIPAddress ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| ], | ||
| "DEF": | ||
| [ | ||
| "ipconfigARP_CACHE_ENTRIES=6" | ||
| "ipconfigARP_CACHE_ENTRIES=6", | ||
| "ipconfigHAS_PRINTF=1" | ||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if we check the validity of the pointers in the stub by adding something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed