Fix a Bug and corresponding CBMC patch (#84)

* Update remove-static-in-freertos-tcp-ip.patch

* Update FreeRTOS_TCP_IP.c

* Update remove-static-in-freertos-tcp-ip.patch

* Update remove-static-in-freertos-tcp-ip.patch

Co-authored-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com>
pull/1/head^2
Aniruddha Kanhere 5 years ago committed by GitHub
parent bb9f92f771
commit f11bcc8acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -210,6 +210,7 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr,
FreeRTOS_Socket_t * const pxSocket, FreeRTOS_Socket_t * const pxSocket,
BaseType_t xHasSYNFlag ); BaseType_t xHasSYNFlag );
#if( ipconfigUSE_TCP_WIN == 1 )
/* /*
* Skip past TCP header options when doing Selective ACK, until there are no * Skip past TCP header options when doing Selective ACK, until there are no
* more options left. * more options left.
@ -217,6 +218,8 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr,
static void prvReadSackOption( const uint8_t * const pucPtr, static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ); FreeRTOS_Socket_t * const pxSocket );
#endif/* ( ipconfigUSE_TCP_WIN == 1 ) */
/* /*
* Set the initial properties in the options fields, like the preferred * Set the initial properties in the options fields, like the preferred
@ -1327,6 +1330,7 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP_WIN == 1 )
static void prvReadSackOption( const uint8_t * const pucPtr, static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ) FreeRTOS_Socket_t * const pxSocket )
@ -1368,6 +1372,8 @@ uint32_t ulCount = ulTCPWindowTxSack( &( pxSocket->u.xTCP.xTCPWindow ), ulFirst,
#endif /* ipconfigUSE_CALLBACKS == 1 */ #endif /* ipconfigUSE_CALLBACKS == 1 */
} }
} }
#endif /* ( ipconfigUSE_TCP_WIN != 0 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP_WIN != 0 ) #if( ipconfigUSE_TCP_WIN != 0 )
@ -1994,7 +2000,6 @@ int32_t lCount, lLength;
/* A txStream has been created already, see if the socket has new data for /* A txStream has been created already, see if the socket has new data for
the sliding window. the sliding window.
uxStreamBufferMidSpace() returns the distance between rxHead and rxMid. It uxStreamBufferMidSpace() returns the distance between rxHead and rxMid. It
contains new Tx data which has not been passed to the sliding window yet. contains new Tx data which has not been passed to the sliding window yet.
The oldest data not-yet-confirmed can be found at rxTail. */ The oldest data not-yet-confirmed can be found at rxTail. */
@ -2004,7 +2009,6 @@ int32_t lCount, lLength;
{ {
/* All data between txMid and rxHead will now be passed to the sliding /* All data between txMid and rxHead will now be passed to the sliding
window manager, so it can start transmitting them. window manager, so it can start transmitting them.
Hand over the new data to the sliding window handler. It will be Hand over the new data to the sliding window handler. It will be
split-up in chunks of 1460 bytes each (or less, depending on split-up in chunks of 1460 bytes each (or less, depending on
ipconfigTCP_MSS). */ ipconfigTCP_MSS). */
@ -2137,7 +2141,6 @@ uint16_t usLength;
/* Determine the length and the offset of the user-data sent to this /* Determine the length and the offset of the user-data sent to this
node. node.
The size of the TCP header is given in a multiple of 4-byte words (single The size of the TCP header is given in a multiple of 4-byte words (single
byte, needs no ntoh() translation). A shift-right 2: is the same as byte, needs no ntoh() translation). A shift-right 2: is the same as
(offset >> 4) * 4. */ (offset >> 4) * 4. */
@ -2213,7 +2216,6 @@ BaseType_t xResult = 0;
{ {
/* See if way may accept the data contents and forward it to the socket /* See if way may accept the data contents and forward it to the socket
owner. owner.
If it can't be "accept"ed it may have to be stored and send a selective If it can't be "accept"ed it may have to be stored and send a selective
ack (SACK) option to confirm it. In that case, lTCPAddRxdata() will be ack (SACK) option to confirm it. In that case, lTCPAddRxdata() will be
called later to store an out-of-order packet (in case lOffset is called later to store an out-of-order packet (in case lOffset is
@ -3502,4 +3504,3 @@ const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MAR
#ifdef FREERTOS_TCP_ENABLE_VERIFICATION #ifdef FREERTOS_TCP_ENABLE_VERIFICATION
#include "aws_freertos_tcp_verification_access_tcp_define.h" #include "aws_freertos_tcp_verification_access_tcp_define.h"
#endif #endif

@ -1,6 +1,5 @@
From afc01793c4531cfbe9f92e7ca2ce9364983d987e Mon Sep 17 00:00:00 2001 From: Aniruddha R Kanhere <kanherea@amazon.com>
From: Mark R Tuttle <mrtuttle@amazon.com> Date: Wed, 03 June 2020 09:51:25 +0000
Date: Tue, 12 May 2020 15:57:56 +0000
Subject: [PATCH] modified lib Subject: [PATCH] modified lib
--- ---
@ -8,7 +7,7 @@ Subject: [PATCH] modified lib
1 file changed, 24 insertions(+) 1 file changed, 24 insertions(+)
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
index dc58621..963b576 100644 index 7a2c00c68..cb537b347 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
@@ -198,14 +198,22 @@ static BaseType_t prvTCPPrepareConnect( FreeRTOS_Socket_t *pxSocket ); @@ -198,14 +198,22 @@ static BaseType_t prvTCPPrepareConnect( FreeRTOS_Socket_t *pxSocket );
@ -34,7 +33,7 @@ index dc58621..963b576 100644
size_t uxTotalLength, size_t uxTotalLength,
FreeRTOS_Socket_t * const pxSocket, FreeRTOS_Socket_t * const pxSocket,
BaseType_t xHasSYNFlag ); BaseType_t xHasSYNFlag );
@@ -214,7 +222,11 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr, @@ -215,7 +223,11 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr,
* Skip past TCP header options when doing Selective ACK, until there are no * Skip past TCP header options when doing Selective ACK, until there are no
* more options left. * more options left.
*/ */
@ -45,7 +44,7 @@ index dc58621..963b576 100644
+ #endif + #endif
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ); FreeRTOS_Socket_t * const pxSocket );
#endif/* ( ipconfigUSE_TCP_WIN == 1 ) */
@@ -1137,7 +1149,11 @@ uint32_t ulInitialSequenceNumber = 0; @@ -1137,7 +1149,11 @@ uint32_t ulInitialSequenceNumber = 0;
* that: ((pxTCPHeader->ucTCPOffset & 0xf0) > 0x50), meaning that the TP header * that: ((pxTCPHeader->ucTCPOffset & 0xf0) > 0x50), meaning that the TP header
* is longer than the usual 20 (5 x 4) bytes. * is longer than the usual 20 (5 x 4) bytes.
@ -58,7 +57,7 @@ index dc58621..963b576 100644
{ {
size_t uxTCPHeaderOffset = ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ); size_t uxTCPHeaderOffset = ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer );
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *, const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
@@ -1201,7 +1217,11 @@ uint8_t ucLength; @@ -1199,7 +1215,11 @@ uint8_t ucLength;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -70,10 +69,10 @@ index dc58621..963b576 100644
size_t uxTotalLength, size_t uxTotalLength,
FreeRTOS_Socket_t * const pxSocket, FreeRTOS_Socket_t * const pxSocket,
BaseType_t xHasSYNFlag ) BaseType_t xHasSYNFlag )
@@ -1346,7 +1366,11 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow ); @@ -1331,7 +1351,11 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP_WIN == 1 )
+ #ifdef CBMC + #ifdef CBMC
+ void prvReadSackOption( const uint8_t * const pucPtr, + void prvReadSackOption( const uint8_t * const pucPtr,
+ #else + #else
@ -82,6 +81,3 @@ index dc58621..963b576 100644
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ) FreeRTOS_Socket_t * const pxSocket )
{ {
--
2.7.4

@ -1,6 +1,5 @@
From afc01793c4531cfbe9f92e7ca2ce9364983d987e Mon Sep 17 00:00:00 2001 From: Aniruddha R Kanhere <kanherea@amazon.com>
From: Mark R Tuttle <mrtuttle@amazon.com> Date: Wed, 03 June 2020 09:51:25 +0000
Date: Tue, 12 May 2020 15:57:56 +0000
Subject: [PATCH] modified lib Subject: [PATCH] modified lib
--- ---
@ -8,7 +7,7 @@ Subject: [PATCH] modified lib
1 file changed, 24 insertions(+) 1 file changed, 24 insertions(+)
diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
index dc58621..963b576 100644 index 7a2c00c68..cb537b347 100644
--- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
+++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c
@@ -198,14 +198,22 @@ static BaseType_t prvTCPPrepareConnect( FreeRTOS_Socket_t *pxSocket ); @@ -198,14 +198,22 @@ static BaseType_t prvTCPPrepareConnect( FreeRTOS_Socket_t *pxSocket );
@ -34,7 +33,7 @@ index dc58621..963b576 100644
size_t uxTotalLength, size_t uxTotalLength,
FreeRTOS_Socket_t * const pxSocket, FreeRTOS_Socket_t * const pxSocket,
BaseType_t xHasSYNFlag ); BaseType_t xHasSYNFlag );
@@ -214,7 +222,11 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr, @@ -215,7 +223,11 @@ static size_t prvSingleStepTCPHeaderOptions( const uint8_t * const pucPtr,
* Skip past TCP header options when doing Selective ACK, until there are no * Skip past TCP header options when doing Selective ACK, until there are no
* more options left. * more options left.
*/ */
@ -45,7 +44,7 @@ index dc58621..963b576 100644
+ #endif + #endif
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ); FreeRTOS_Socket_t * const pxSocket );
#endif/* ( ipconfigUSE_TCP_WIN == 1 ) */
@@ -1137,7 +1149,11 @@ uint32_t ulInitialSequenceNumber = 0; @@ -1137,7 +1149,11 @@ uint32_t ulInitialSequenceNumber = 0;
* that: ((pxTCPHeader->ucTCPOffset & 0xf0) > 0x50), meaning that the TP header * that: ((pxTCPHeader->ucTCPOffset & 0xf0) > 0x50), meaning that the TP header
* is longer than the usual 20 (5 x 4) bytes. * is longer than the usual 20 (5 x 4) bytes.
@ -58,7 +57,7 @@ index dc58621..963b576 100644
{ {
size_t uxTCPHeaderOffset = ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ); size_t uxTCPHeaderOffset = ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer );
const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *, const ProtocolHeaders_t *pxProtocolHeaders = ipPOINTER_CAST( ProtocolHeaders_t *,
@@ -1201,7 +1217,11 @@ uint8_t ucLength; @@ -1199,7 +1215,11 @@ uint8_t ucLength;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -70,10 +69,10 @@ index dc58621..963b576 100644
size_t uxTotalLength, size_t uxTotalLength,
FreeRTOS_Socket_t * const pxSocket, FreeRTOS_Socket_t * const pxSocket,
BaseType_t xHasSYNFlag ) BaseType_t xHasSYNFlag )
@@ -1346,7 +1366,11 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow ); @@ -1331,7 +1351,11 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP_WIN == 1 )
+ #ifdef CBMC + #ifdef CBMC
+ void prvReadSackOption( const uint8_t * const pucPtr, + void prvReadSackOption( const uint8_t * const pucPtr,
+ #else + #else
@ -82,6 +81,3 @@ index dc58621..963b576 100644
size_t uxIndex, size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket ) FreeRTOS_Socket_t * const pxSocket )
{ {
--
2.7.4

Loading…
Cancel
Save