Skip to content

Fix CBMC proof for DHCP#717

Merged
tony-josi-aws merged 23 commits intoFreeRTOS:dev/IPv6_integrationfrom
tony-josi-aws:fix_cbmc_proof_dhcp
Feb 22, 2023
Merged

Fix CBMC proof for DHCP#717
tony-josi-aws merged 23 commits intoFreeRTOS:dev/IPv6_integrationfrom
tony-josi-aws:fix_cbmc_proof_dhcp

Conversation

@tony-josi-aws
Copy link
Copy Markdown
Member

This PR fixes the build issues and proof failures for the DHCP CBMC proofs post the IPv6 changes.

Test Steps

cd test/cbmc/proofs/
python run-cbmc-proofs.py

Related Issue

Failing CBMC proofs

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

karkhaz and others added 11 commits February 8, 2023 06:00
Prior to this commit, CBMC would emit logging information in plain text
format, which does not contain information required for the CBMC VSCode
debugger. This commit makes CBMC use XML instead of plain text.

Co-authored-by: Mark Tuttle <tuttle@acm.org>
@tony-josi-aws tony-josi-aws requested a review from a team as a code owner February 14, 2023 19:18
Comment thread source/FreeRTOS_DHCP.c Outdated
lBytes = FreeRTOS_recvfrom( xDHCPv4Socket, &( pucUDPPayload ), 0, FREERTOS_ZERO_COPY, NULL, NULL );

if( lBytes > 0 )
if( lBytes > 0 && pucUDPPayload != NULL )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( lBytes > 0 && pucUDPPayload != NULL )
if( ( lBytes > 0 ) && ( pucUDPPayload != NULL ) )

Copy link
Copy Markdown
Member Author

@tony-josi-aws tony-josi-aws Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed all formatting issues

Comment thread source/FreeRTOS_DHCP.c Outdated
}

FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayload );
if (pucUDPPayload != NULL)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pucUDPPayload != NULL)
if( pucUDPPayload != NULL )

Comment thread source/FreeRTOS_DHCP.c Outdated
pxEndPoint );

if( pucUDPPayloadBuffer != NULL )
if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL )
if( ( xDHCPv4Socket != FREERTOS_INVALID_SOCKET ) &&
( xDHCPv4Socket != NULL ) &&
( pucUDPPayloadBuffer != NULL ) )

Comment thread source/FreeRTOS_DHCP.c Outdated
/* The packet was not successfully queued for sending and must be
* returned to the stack. */
FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayloadBuffer );
if (pucUDPPayloadBuffer != NULL)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pucUDPPayloadBuffer != NULL)
if( pucUDPPayloadBuffer != NULL )

Comment thread source/FreeRTOS_DHCP.c Outdated
pxEndPoint );

if( pucUDPPayloadBuffer != NULL )
if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( xDHCPv4Socket != FREERTOS_INVALID_SOCKET && xDHCPv4Socket != NULL && pucUDPPayloadBuffer != NULL )
if( ( xDHCPv4Socket != FREERTOS_INVALID_SOCKET ) &&
( xDHCPv4Socket != NULL ) &&
( pucUDPPayloadBuffer != NULL ) )

Comment thread source/FreeRTOS_DHCP.c Outdated
/* The packet was not successfully queued for sending and must be
* returned to the stack. */
FreeRTOS_ReleaseUDPPayloadBuffer( pucUDPPayloadBuffer );
if (pucUDPPayloadBuffer != NULL)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (pucUDPPayloadBuffer != NULL)
if( pucUDPPayloadBuffer != NULL )

size_t uxAddressLength,
BaseType_t xInternal )
{
return 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to verify the pointers being valid?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread test/cbmc/proofs/DHCP/DHCPProcess/DHCPProcess_harness.c
{
const char * name;

name = "hostname";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make if non-deterministic too?

uint8_t size_of_hostname;
name = malloc( size_of_hostname );

BaseType_t xReset;
eDHCPState_t eExpectedState;
BaseType_t xDoCheck;
//eDHCPState_t eExpectedState;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused comment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread test/cbmc/patches/FreeRTOSIPConfig.h Outdated
Comment on lines +138 to +140
#ifndef ipconfigDHCP_REGISTER_HOSTNAME
#define ipconfigDHCP_REGISTER_HOSTNAME 1
#endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment thread test/cbmc/proofs/DHCP/DHCPProcess/DHCPProcess_harness.c
@tony-josi-aws tony-josi-aws merged commit d0fbbd3 into FreeRTOS:dev/IPv6_integration Feb 22, 2023
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