first commit

This commit is contained in:
fewikay committed 2026-10-16 13:08:06 +02:00
commit 92cbe97616
1978 files changed
+1688498

No files matched your search

@@ -0,0 +1,221 @@
/*
* FreeRTOS memory safety proofs with CBMC.
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
/* Standard includes. */
#include <stdint.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ARP.h"
#include "NetworkBufferManagement.h"
#include "cbmc.h"
/* Static members defined in FreeRTOS_DHCP.c */
extern DHCPData_t xDHCPData;
extern Socket_t xDHCPv4Socket;
extern BaseType_t xDHCPSocketUserCount;
void prvCreateDHCPSocket( NetworkEndPoint_t * pxEndPoint );
uint32_t uxSocketCloseCnt = 0;
DHCPMessage_IPv4_t xDHCPMessage;
void __CPROVER_file_local_FreeRTOS_DHCP_c_prvCloseDHCPSocket( const NetworkEndPoint_t * pxEndPoint );
/****************************************************************
* vDHCPProcessEndPoint() is proved separately
****************************************************************/
void __CPROVER_file_local_FreeRTOS_DHCP_c_vDHCPProcessEndPoint( BaseType_t xReset,
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint )
{
__CPROVER_assert( pxEndPoint != NULL,
"FreeRTOS precondition: pxEndPoint != NULL" );
}
/****************************************************************
* Abstract prvProcessDHCPReplies proved memory safe in ProcessDHCPReplies.
****************************************************************/
BaseType_t __CPROVER_file_local_FreeRTOS_DHCP_c_prvProcessDHCPReplies( BaseType_t xExpectedMessageType,
NetworkEndPoint_t * pxEndPoint )
{
return nondet_BaseType();
}
/**
* For the purpose of this proof we assume that xSocketValid returns true always.
* This has to do with assertions in the source code that checks for socket being invalid.
* [configASSERT( xSocketValid( xDHCPv4Socket ) == pdTRUE );]
*/
BaseType_t xSocketValid( const ConstSocket_t xSocket )
{
__CPROVER_assume( xSocket != FREERTOS_INVALID_SOCKET );
__CPROVER_assume( xSocket != NULL );
return( ( xSocket != FREERTOS_INVALID_SOCKET ) && ( xSocket != NULL ) );
}
BaseType_t vSocketBind( FreeRTOS_Socket_t * pxSocket,
struct freertos_sockaddr * pxBindAddress,
size_t uxAddressLength,
BaseType_t xInternal )
{
/* Return value is set to zero assuming socket bind will succeed. If it doesn't, it
* will hit an assert in the function. */
BaseType_t xRet = 0;
__CPROVER_assert( pxSocket != NULL,
"FreeRTOS precondition: pxSocket != NULL" );
__CPROVER_assert( pxBindAddress != NULL,
"FreeRTOS precondition: pxBindAddress != NULL" );
return xRet;
}
/*We assume that the pxGetNetworkBufferWithDescriptor function is implemented correctly and returns a valid data structure. */
/*This is the mock to mimic the correct expected behavior. If this allocation fails, this might invalidate the proof. */
NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes,
TickType_t xBlockTimeTicks )
{
NetworkBufferDescriptor_t * pxNetworkBuffer = ( NetworkBufferDescriptor_t * ) safeMalloc( sizeof( NetworkBufferDescriptor_t ) );
__CPROVER_assume( pxNetworkBuffer != NULL );
__CPROVER_assume( xRequestedSizeBytes > ( dhcpFIRST_OPTION_BYTE_OFFSET + sizeof( MACAddress_t ) + ipIP_TYPE_OFFSET ) );
pxNetworkBuffer->pucEthernetBuffer = ( ( uint8_t * ) safeMalloc( xRequestedSizeBytes + ( ipIP_TYPE_OFFSET ) ) );
__CPROVER_assume( pxNetworkBuffer->pucEthernetBuffer != NULL );
/* Increment with expected buffer padding */
pxNetworkBuffer->pucEthernetBuffer += ipIP_TYPE_OFFSET;
pxNetworkBuffer->xDataLength = xRequestedSizeBytes;
return pxNetworkBuffer;
}
/* FreeRTOS_ReleaseUDPPayloadBuffer is mocked here and the memory
* is not freed as the buffer allocated by the FreeRTOS_recvfrom is static
* memory */
void FreeRTOS_ReleaseUDPPayloadBuffer( void * pvBuffer )
{
__CPROVER_assert( pvBuffer != NULL,
"FreeRTOS precondition: pvBuffer != NULL" );
}
/* For the DHCP process loop to be fully covered, we expect FreeRTOS_recvfrom
* to fail after few iterations. This is because vDHCPProcessEndPoint is proved
* separately and is stubbed out for this proof, which ideally is supposed to close
* the socket and end the loop. */
int32_t FreeRTOS_recvfrom( Socket_t xSocket,
void * pvBuffer,
size_t uxBufferLength,
BaseType_t xFlags,
struct freertos_sockaddr * pxSourceAddress,
socklen_t * pxSourceAddressLength )
{
static uint32_t recvRespCnt = 0;
int32_t retVal = -1;
__CPROVER_assert( pvBuffer != NULL,
"FreeRTOS precondition: pvBuffer != NULL" );
if( ++recvRespCnt < ( FR_RECV_FROM_SUCCESS_COUNT - 1 ) )
{
*( ( void ** ) pvBuffer ) = ( void * ) &xDHCPMessage;
retVal = sizeof( xDHCPMessage );
}
return retVal;
}
void * vSocketClose( FreeRTOS_Socket_t * pxSocket )
{
__CPROVER_assert( pxSocket != NULL, "Closing socket cannot be NULL." );
return NULL;
}
/****************************************************************
* The proof of vDHCPProcess
****************************************************************/
void harness()
{
BaseType_t xReset;
eDHCPState_t eExpectedState;
/* The only possibility of making xDHCPSocketUserCount overflow is having more than BaseType_t endpoints, which is assumed not possible here. */
__CPROVER_assume( xDHCPSocketUserCount >= 0 && xDHCPSocketUserCount <= ENDPOINT_DNS_ADDRESS_COUNT );
pxNetworkEndPoints = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
__CPROVER_assume( pxNetworkEndPoints != NULL );
/* Interface init. */
pxNetworkEndPoints->pxNetworkInterface = ( NetworkInterface_t * ) safeMalloc( sizeof( NetworkInterface_t ) );
__CPROVER_assume( pxNetworkEndPoints->pxNetworkInterface != NULL );
if( nondet_bool() )
{
pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
__CPROVER_assume( pxNetworkEndPoints->pxNext != NULL );
pxNetworkEndPoints->pxNext->pxNext = NULL;
pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkEndPoints->pxNetworkInterface;
}
else
{
pxNetworkEndPoints->pxNext = NULL;
}
if( !( ( pxNetworkEndPoints->xDHCPData.eDHCPState == eInitialWait ) ||
( xReset != pdFALSE ) ) )
{
prvCreateDHCPSocket( pxNetworkEndPoints );
}
/* Assume vDHCPProcess is only called on IPv4 endpoints which is
* validated before the call to vDHCPProcess */
__CPROVER_assume( pxNetworkEndPoints->bits.bIPv6 == 0 );
vDHCPProcess( xReset, pxNetworkEndPoints );
__CPROVER_file_local_FreeRTOS_DHCP_c_prvCloseDHCPSocket( pxNetworkEndPoints );
}
@@ -0,0 +1,39 @@
{
"ENTRY": "DHCPProcess",
# Minimal buffer size for maximum coverage, see harness for details.
"BUFFER_SIZE": 299,
"ENDPOINT_DNS_ADDRESS_COUNT": 5,
# The number of times GetNetworkBufferWithDescriptor can be allowed to fail
# (plus 1).
"FAILURE_BOUND": 2,
"LOOP_UNWIND_COUNT": 4,
"CBMCFLAGS": [
"--unwind {LOOP_UNWIND_COUNT}",
"--nondet-static --flush"
],
"OPT":
[
"--export-file-local-symbols"
],
"OBJS":
[
"$(ENTRY)_harness.goto",
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs/cbmc.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_DHCP.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_IP.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_ARP.goto",
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs/freertos_api.goto"
],
"DEF":
[
"FR_RECV_FROM_SUCCESS_COUNT={LOOP_UNWIND_COUNT}",
"BUFFER_SIZE={BUFFER_SIZE}",
"ipconfigDHCP_REGISTER_HOSTNAME=1",
"CBMC_REQUIRE_NETWORKBUFFER_ETHERNETBUFFER_NONNULL=1",
"CBMC_GETNETWORKBUFFER_FAILURE_BOUND={FAILURE_BOUND}",
"ENDPOINT_DNS_ADDRESS_COUNT={ENDPOINT_DNS_ADDRESS_COUNT}"
]
}
@@ -0,0 +1,241 @@
/*
* FreeRTOS memory safety proofs with CBMC.
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
/* Standard includes. */
#include <stdint.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_UDP_IP.h"
#include "FreeRTOS_DHCP.h"
#include "FreeRTOS_ARP.h"
#include "NetworkBufferManagement.h"
#include "cbmc.h"
#include "../../utility/memory_assignments.c"
/* Static members defined in FreeRTOS_DHCP.c */
extern DHCPData_t xDHCPData;
extern Socket_t xDHCPv4Socket;
extern BaseType_t xDHCPSocketUserCount;
void prvCreateDHCPSocket( NetworkEndPoint_t * pxEndPoint );
/* Static member defined in freertos_api.c */
#ifdef CBMC_GETNETWORKBUFFER_FAILURE_BOUND
extern uint32_t GetNetworkBuffer_failure_count;
#endif
/****************************************************************
* The signature of the function under test.
****************************************************************/
void __CPROVER_file_local_FreeRTOS_DHCP_c_vDHCPProcessEndPoint( BaseType_t xReset,
BaseType_t xDoCheck,
NetworkEndPoint_t * pxEndPoint );
/****************************************************************
* Abstract prvProcessDHCPReplies proved memory safe in ProcessDHCPReplies.
****************************************************************/
BaseType_t __CPROVER_file_local_FreeRTOS_DHCP_c_prvProcessDHCPReplies( BaseType_t xExpectedMessageType,
NetworkEndPoint_t * pxEndPoint )
{
return nondet_BaseType();
}
/**
* For the purpose of this proof we assume that xSocketValid returns true always.
* This has to do with assertions in the source code that checks for socket being invalid.
* [configASSERT( xSocketValid( xDHCPv4Socket ) == pdTRUE );]
*/
BaseType_t xSocketValid( const ConstSocket_t xSocket )
{
__CPROVER_assume( xSocket != FREERTOS_INVALID_SOCKET );
__CPROVER_assume( xSocket != NULL );
return( ( xSocket != FREERTOS_INVALID_SOCKET ) && ( xSocket != NULL ) );
}
BaseType_t vSocketBind( FreeRTOS_Socket_t * pxSocket,
struct freertos_sockaddr * pxBindAddress,
size_t uxAddressLength,
BaseType_t xInternal )
{
/* Return value is set to zero assuming socket bind will succeed. If it doesn't, it
* will hit an assert in the function. */
BaseType_t xRet = 0;
__CPROVER_assert( pxSocket != NULL,
"FreeRTOS precondition: pxSocket != NULL" );
__CPROVER_assert( pxBindAddress != NULL,
"FreeRTOS precondition: pxBindAddress != NULL" );
return xRet;
}
/*We assume that the pxGetNetworkBufferWithDescriptor function is implemented correctly and returns a valid data structure. */
/*This is the mock to mimic the correct expected behavior. If this allocation fails, this might invalidate the proof. */
NetworkBufferDescriptor_t * pxGetNetworkBufferWithDescriptor( size_t xRequestedSizeBytes,
TickType_t xBlockTimeTicks )
{
NetworkBufferDescriptor_t * pxNetworkBuffer = ( NetworkBufferDescriptor_t * ) safeMalloc( sizeof( NetworkBufferDescriptor_t ) );
__CPROVER_assume( pxNetworkBuffer != NULL );
__CPROVER_assume( ( xRequestedSizeBytes > ( dhcpFIRST_OPTION_BYTE_OFFSET + sizeof( MACAddress_t ) + ipIP_TYPE_OFFSET ) ) && ( xRequestedSizeBytes < ipconfigNETWORK_MTU ) );
pxNetworkBuffer->pucEthernetBuffer = ( ( uint8_t * ) safeMalloc( xRequestedSizeBytes + ( ipIP_TYPE_OFFSET ) ) );
__CPROVER_assume( pxNetworkBuffer->pucEthernetBuffer != NULL );
/* Increment with expected buffer padding */
pxNetworkBuffer->pucEthernetBuffer += ipIP_TYPE_OFFSET;
pxNetworkBuffer->xDataLength = xRequestedSizeBytes;
return pxNetworkBuffer;
}
void FreeRTOS_ReleaseUDPPayloadBuffer( void * pvBuffer )
{
__CPROVER_assert( pvBuffer != NULL,
"FreeRTOS precondition: pvBuffer != NULL" );
/* Free buffer after adjusting offsets. */
free( ( ( ( uint8_t * ) pvBuffer ) - ( ipUDP_PAYLOAD_OFFSET_IPv4 + ipIP_TYPE_OFFSET ) ) );
}
/* Abstraction of FreeRTOS_socket. Return NULL or valid socket handler. */
Socket_t FreeRTOS_socket( BaseType_t xDomain,
BaseType_t xType,
BaseType_t xProtocol )
{
return ensure_FreeRTOS_Socket_t_is_allocated();
}
void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
struct xNetworkEndPoint * pxEndPoint )
{
__CPROVER_assert( eNetworkEvent == eNetworkUp || eNetworkEvent == eNetworkDown, "Network event is not correct" );
__CPROVER_assert( pxEndPoint != NULL, "Endpoint cannot be NULL" );
}
BaseType_t xIsCallingFromIPTask( void )
{
BaseType_t xReturn;
__CPROVER_assume( xReturn == pdFALSE || xReturn == pdTRUE );
return xReturn;
}
void * vSocketClose( FreeRTOS_Socket_t * pxSocket )
{
__CPROVER_assert( pxSocket != NULL, "Closing socket cannot be NULL" );
return NULL;
}
void vManageSolicitedNodeAddress( const struct xNetworkEndPoint * pxEndPoint,
BaseType_t xNetworkGoingUp )
{
__CPROVER_assert( pxEndPoint != NULL, "Endpoint cannot be NULL" );
__CPROVER_assert( pxEndPoint->pxNetworkInterface != NULL, "The network interface cannot be NULL" );
}
/****************************************************************
* The proof of vDHCPProcess
****************************************************************/
void harness()
{
BaseType_t xReset;
BaseType_t xDoCheck;
/* The only possibility of making xDHCPSocketUserCount overflow is having more than BaseType_t endpoints, which is assumed not possible here. */
__CPROVER_assume( xDHCPSocketUserCount >= 0 && xDHCPSocketUserCount <= ENDPOINT_DNS_ADDRESS_COUNT );
pxNetworkEndPoints = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
__CPROVER_assume( pxNetworkEndPoints != NULL );
/* Interface init. */
pxNetworkEndPoints->pxNetworkInterface = ( NetworkInterface_t * ) safeMalloc( sizeof( NetworkInterface_t ) );
__CPROVER_assume( pxNetworkEndPoints->pxNetworkInterface != NULL );
if( nondet_bool() )
{
pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
__CPROVER_assume( pxNetworkEndPoints->pxNext != NULL );
pxNetworkEndPoints->pxNext->pxNext = NULL;
pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkEndPoints->pxNetworkInterface;
}
else
{
pxNetworkEndPoints->pxNext = NULL;
}
NetworkEndPoint_t * pxNetworkEndPoint_Temp = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
__CPROVER_assume( pxNetworkEndPoint_Temp != NULL );
pxNetworkEndPoint_Temp->pxNext = NULL;
pxNetworkEndPoint_Temp->xDHCPData.xDHCPSocket = NULL;
pxNetworkEndPoint_Temp->pxNetworkInterface = pxNetworkEndPoints->pxNetworkInterface;
/****************************************************************
* Initialize the counter used to bound the number of times
* GetNetworkBufferWithDescriptor can fail.
****************************************************************/
#ifdef CBMC_GETNETWORKBUFFER_FAILURE_BOUND
GetNetworkBuffer_failure_count = 0;
#endif
xDHCPv4Socket = FreeRTOS_socket( FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM, FREERTOS_IPPROTO_UDP );
/****************************************************************
* Assume a valid socket in most states of the DHCP state machine.
*
* The socket is created in the eWaitingSendFirstDiscover state.
* xReset==True resets the state to eWaitingSendFirstDiscover.
****************************************************************/
if( !( ( pxNetworkEndPoint_Temp->xDHCPData.eDHCPState == eInitialWait ) ||
( xReset != pdFALSE ) ) )
{
prvCreateDHCPSocket( pxNetworkEndPoint_Temp );
}
__CPROVER_file_local_FreeRTOS_DHCP_c_vDHCPProcessEndPoint( xReset, xDoCheck, pxNetworkEndPoint_Temp );
}
@@ -0,0 +1,40 @@
{
"ENTRY": "DHCPProcessEndPoint",
# Minimal buffer size for maximum coverage, see harness for details.
"BUFFER_SIZE": 299,
"ENDPOINT_DNS_ADDRESS_COUNT": 5,
# The number of times GetNetworkBufferWithDescriptor can be allowed to fail
# (plus 1).
"FAILURE_BOUND": 2,
"CBMCFLAGS": [
"--unwind 4",
"--unwindset strlen.0:11,memcmp.0:7",
"--nondet-static --flush"
],
"OPT":
[
"--export-file-local-symbols"
],
"OBJS":
[
"$(ENTRY)_harness.goto",
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs/cbmc.goto",
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs/freertos_api.goto",
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs/freertos_kernel_api.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_DHCP.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_IP.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_IP_Timers.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_ARP.goto"
],
"DEF":
[
"BUFFER_SIZE={BUFFER_SIZE}",
"ipconfigDHCP_REGISTER_HOSTNAME=1",
"CBMC_REQUIRE_NETWORKBUFFER_ETHERNETBUFFER_NONNULL=1",
"CBMC_GETNETWORKBUFFER_FAILURE_BOUND={FAILURE_BOUND}",
"ENDPOINT_DNS_ADDRESS_COUNT={ENDPOINT_DNS_ADDRESS_COUNT}"
]
}
@@ -0,0 +1,28 @@
This is the memory safety proof for DHCPProcessEndPoint function, which is the
function that triggers the DHCP protocol.
The main stubs in this proof deal with buffer management, which assume
that the buffer is large enough to accommodate a DHCP message plus a
few additional bytes for options (which is the last, variable-sized
field in a DHCP message). We have abstracted away sockets, concurrency
and third-party code. For more details, please check the comments on
the harness file.
This proof is a work-in-progress. Proof assumptions are described in
the harness. The proof also assumes the following functions are
memory safe and have no side effects relevant to the memory safety of
this function:
* FreeRTOS_sendto
* FreeRTOS_setsockopt
* FreeRTOS_socket
* ulRand
* vARPSendGratuitous
* vApplicationIPNetworkEventHook
* vLoggingPrintf
* vPortEnterCritical
* vPortExitCritical
* vReleaseNetworkBufferAndDescriptor
* vSocketBind
* vSocketClose
@@ -0,0 +1,16 @@
{ "expected-missing-functions":
[
"vPortEnterCritical",
"vPortExitCritical",
"vSocketBind",
"vSocketClose",
"vTaskSetTimeOutState",
"xTaskGetTickCount",
"xTaskGetCurrentTaskHandle",
"xQueueGenericSend",
"xApplicationGetRandomNumber",
"vLoggingPrintf"
],
"proof-name": "DHCPProcess",
"proof-root": "tools/cbmc/proofs"
}
@@ -0,0 +1,49 @@
/*
* FreeRTOS memory safety proofs with CBMC.
* Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* http://aws.amazon.com/freertos
* http://www.FreeRTOS.org
*/
#include <stdint.h>
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
/* FreeRTOS+TCP includes. */
#include "FreeRTOS_IP.h"
#include "FreeRTOS_IP_Private.h"
#include "FreeRTOS_DHCP.h"
/*
* The harness test proceeds to call IsDHCPSocket with an unconstrained value
*/
void harness()
{
Socket_t xSocket;
BaseType_t xResult;
xResult = xIsDHCPSocket( xSocket );
}
@@ -0,0 +1,40 @@
#
# FreeRTOS memory safety proofs with CBMC.
# Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy,
# modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# http://aws.amazon.com/freertos
# http://www.FreeRTOS.org
#
{
"ENTRY": "IsDHCPSocket",
"CBMCFLAGS":
[
"--unwind 1"
],
"OBJS":
[
"$(ENTRY)_harness.goto",
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_DHCP.goto"
]
}
@@ -0,0 +1 @@
This is the memory safety proof for IsDCHPSocket.