Skip to content

Commit b0766a1

Browse files
author
Alexander Senier
committed
Add reproducer for issue 75
1 parent a952f04 commit b0766a1

27 files changed

+2799
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
obj

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "examples/contrib/FreeRTOS-Plus-TCP"]
2+
path = examples/contrib/FreeRTOS-Plus-TCP
3+
url = https://github.com/FreeRTOS/FreeRTOS-Plus-TCP.git

examples/Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
COMMON_CFLAGS = -g -Wno-pointer-to-int-cast -Dstatic= -fsanitize=address
2+
LDFLAGS = -lasan
3+
4+
FREERTOS_PLUS_TCP_PATH = contrib/FreeRTOS-Plus-TCP
5+
6+
VPATH += src $(FREERTOS_PLUS_TCP_PATH) $(FREERTOS_PLUS_TCP_PATH)/portable/BufferManagement
7+
8+
DUMMY := $(shell mkdir -p obj)
9+
VERBOSE ?= @
10+
11+
VULNS = vuln_75
12+
13+
all: $(addprefix obj/,$(VULNS))
14+
$(VERBOSE)for t in $<; do echo "Running $$t"; ./$$t; done
15+
16+
obj/vuln_75: \
17+
obj/FreeRTOS_ARP.o \
18+
obj/FreeRTOS_DHCP.o \
19+
obj/FreeRTOS_IP.o \
20+
obj/FreeRTOS_UDP_IP.o \
21+
obj/FreeRTOS_Sockets.o \
22+
obj/BufferAllocation_1.o \
23+
obj/freertos_10_0_1_helper.o \
24+
obj/list.o \
25+
obj/port.o \
26+
obj/queue.o \
27+
obj/vuln_75.o
28+
obj/vuln_75: \
29+
CFLAGS += \
30+
-Iinclude/FreeRTOS-10.0.1 \
31+
-I$(FREERTOS_PLUS_TCP_PATH) \
32+
-I$(FREERTOS_PLUS_TCP_PATH)/include \
33+
-I$(FREERTOS_PLUS_TCP_PATH)/portable/Compiler/GCC \
34+
$(COMMON_CFLAGS)
35+
obj/vuln_75:
36+
$(VERBOSE)$(CC) $(LDFLAGS) -o $@ -Wl,--start-group $^ -Wl,--end-group
37+
38+
obj/%.o: %.c
39+
$(VERBOSE)$(CC) $(CFLAGS) -o $@ -c $<
40+
41+
clean:
42+
$(VERBOE)rm -rf obj

examples/contrib/FreeRTOS-Plus-TCP

Submodule FreeRTOS-Plus-TCP added at 08a6e60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef INC_FREERTOS_H
2+
#define INC_FREERTOS_H
3+
4+
#include <stddef.h>
5+
6+
#define pdMS_TO_TICKS( xTimeInMs ) 0
7+
8+
#include <list.h>
9+
#include <queue.h>
10+
11+
#define pdFALSE 0
12+
#define pdTRUE 1
13+
14+
#define configASSERT(x)
15+
16+
typedef int32_t BaseType_t;
17+
typedef uint32_t UBaseType_t;
18+
typedef uint32_t TickType_t;
19+
typedef uint32_t TimeOut_t;
20+
21+
#endif // INC_FREERTOS_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef FREERTOS_IP_CONFIG_H
2+
#define FREERTOS_IP_CONFIG_H
3+
4+
#define ipconfigNETWORK_MTU 1500
5+
6+
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 1
7+
#define ipconfigEVENT_QUEUE_LENGTH 6
8+
9+
#define ipconfigUSE_TCP 0
10+
#define ipconfigUSE_TCP_WIN 0
11+
#define ipconfigUSE_LINKED_RX_MESSAGES 0
12+
#define ipconfigMAX_IP_TASK_SLEEP_TIME 0
13+
#define ipconfigIP_TASK_PRIORITY 0
14+
#define ipconfigIP_TASK_STACK_SIZE_WORDS 100
15+
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS 1000
16+
17+
#define ipconfigUSE_DHCP 1
18+
#define ipconfigUSE_DNS 0
19+
20+
#define ipconfigRAND32() 42
21+
22+
#define portMAX_DELAY 0
23+
#define configTICK_RATE_HZ 1000
24+
25+
#endif // !FREERTOS_IP_CONFIG_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
typedef uint64_t EventBits_t;
4+
typedef uint64_t EventGroupHandle_t;
5+
6+
#define xEventGroupSetBits(x, y)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
typedef uint64_t ListItem_t;
4+
typedef uint64_t List_t;
5+
6+
#define vListInsertEnd(x, y)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef INC_QUEUE_H
2+
#define INC_QUEUE_H
3+
4+
#define pdFAIL pdFALSE
5+
#define pdPASS pdTRUE
6+
7+
typedef uint64_t xQueueItem;
8+
typedef uint64_t *QueueHandle_t;
9+
10+
#define xQueueReceive(a, b, c)
11+
#define xQueueSendToBack(a, b, c) pdPASS
12+
#define xQueueSendToBackFromISR(a, b, c) pdPASS
13+
#define vQueueDelete(q)
14+
#define xQueueCreate(a, b) NULL
15+
16+
#endif // INC_QUEUE_H

examples/include/FreeRTOS-10.0.1.old/semphr.h

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef INC_TASK_H
2+
#define INC_TASK_H
3+
4+
#include <FreeRTOS.h>
5+
6+
typedef uint64_t* TaskHandle_t;
7+
8+
#define xTaskGetCurrentTaskHandle() NULL
9+
#define xTaskGetTickCount() 0
10+
#define vTaskSetTimeOutState(t)
11+
#define vTaskDelay(d)
12+
#define xTaskCheckForTimeOut(t, x) pdFALSE
13+
#define xTaskCreate(a, b, c, d, e, f) 0
14+
#define xTaskResumeAll()
15+
#define vTaskSuspendAll()
16+
#define taskENTER_CRITICAL()
17+
#define taskEXIT_CRITICAL()
18+
19+
#endif // INC_TASK_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef INC_FREERTOS_H
2+
#define INC_FREERTOS_H
3+
4+
#include <stddef.h>
5+
#include <stdint.h>
6+
7+
#include "FreeRTOSConfig.h"
8+
#include "projdefs.h"
9+
#include "portable.h"
10+
11+
typedef uint64_t TickType_t;
12+
typedef unsigned long UBaseType_t;
13+
typedef long BaseType_t;
14+
15+
#define configASSERT(x)
16+
#define PRIVILEGED_FUNCTION
17+
18+
#define mtCOVERAGE_TEST_DELAY()
19+
#define mtCOVERAGE_TEST_MARKER()
20+
21+
struct xSTATIC_MINI_LIST_ITEM
22+
{
23+
TickType_t xDummy1;
24+
void *pvDummy2[ 2 ];
25+
};
26+
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
27+
28+
typedef struct xSTATIC_LIST
29+
{
30+
UBaseType_t uxDummy1;
31+
void *pvDummy2;
32+
StaticMiniListItem_t xDummy3;
33+
} StaticList_t;
34+
35+
typedef struct xSTATIC_QUEUE
36+
{
37+
void *pvDummy1[ 3 ];
38+
39+
union
40+
{
41+
void *pvDummy2;
42+
UBaseType_t uxDummy2;
43+
} u;
44+
45+
StaticList_t xDummy3[ 2 ];
46+
UBaseType_t uxDummy4[ 3 ];
47+
uint8_t ucDummy5[ 2 ];
48+
49+
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
50+
uint8_t ucDummy6;
51+
#endif
52+
53+
#if ( configUSE_QUEUE_SETS == 1 )
54+
void *pvDummy7;
55+
#endif
56+
57+
#if ( configUSE_TRACE_FACILITY == 1 )
58+
UBaseType_t uxDummy8;
59+
uint8_t ucDummy9;
60+
#endif
61+
62+
} StaticQueue_t;
63+
64+
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
65+
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
66+
67+
#endif // !INC_FREERTOS_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef FREERTOS_CONFIG_H
2+
#define FREERTOS_CONFIG_H
3+
4+
#define configTICK_RATE_HZ ( 1000 )
5+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
6+
7+
#endif // !FREERTOS_CONFIG_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef FREERTOS_IP_CONFIG_H
2+
#define FREERTOS_IP_CONFIG_H
3+
4+
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 10
5+
#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 )
6+
#define ipconfigNETWORK_MTU 1500
7+
8+
#define ipconfigRAND32() 1
9+
10+
#define ipconfigUSE_DNS 0
11+
#define ipconfigUSE_TCP 0
12+
#define ipconfigREPLY_TO_INCOMING_PINGS 1
13+
14+
#endif // FREERTOS_IP_CONFIG_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef EVENT_GROUPS_H
2+
#define EVENT_GROUPS_H
3+
4+
typedef void * EventGroupHandle_t;
5+
typedef TickType_t EventBits_t;
6+
7+
#define xEventGroupSetBits(g, b) (0)
8+
#define xEventGroupCreate() (NULL)
9+
#define xEventGroupWaitBits(g, b, c, a, t) (0)
10+
#define vEventGroupDelete(g)
11+
12+
#endif // EVENT_GROUPS_H

0 commit comments

Comments
 (0)