Merge branch 'feature/freertos_expose_list_integrity_check_option' into 'master'

feat(freertos): Exposed Kconfig option for configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES

Closes IDF-8366

See merge request espressif/esp-idf!26960
This commit is contained in:
Sudeep Mohanty 2023-11-14 21:27:19 +08:00
commit bf237a2bd4
14 changed files with 38 additions and 13 deletions

View File

@ -720,7 +720,7 @@ bool test_event_on_timer_alarm(gptimer_handle_t timer, const gptimer_alarm_event
TEST_CASE("can post events from interrupt handler", "[event][intr]")
{
/* Lazy allocated resources in gptimer/intr_alloc */
unity_utils_set_leak_level(150);
unity_utils_set_leak_level(160);
TEST_ESP_OK(esp_event_loop_create_default());

View File

@ -11,7 +11,7 @@
#include "freertos/task.h"
// Some resources are lazy allocated, the threshold is left for that case
#define TEST_MEMORY_LEAK_THRESHOLD (-800)
#define TEST_MEMORY_LEAK_THRESHOLD (-900)
static size_t before_free_8bit;
static size_t before_free_32bit;

View File

@ -9,7 +9,11 @@
#include "sdkconfig.h"
/* Macros used instead ofsetoff() for better performance of interrupt handler */
#if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
#define PORT_OFFSET_PX_STACK 0x40
#else
#define PORT_OFFSET_PX_STACK 0x30
#endif /* #if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES */
#define PORT_OFFSET_PX_END_OF_STACK (PORT_OFFSET_PX_STACK + \
/* void * pxDummy6 */ 4 + \
/* BaseType_t xDummy23[ 2 ] */ 8 + \

View File

@ -37,7 +37,11 @@
#include "freertos/FreeRTOSConfig.h"
/* Macros used instead ofsetoff() for better performance of interrupt handler */
#if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
#define PORT_OFFSET_PX_STACK 0x40
#else
#define PORT_OFFSET_PX_STACK 0x30
#endif /* #if CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES */
#define PORT_OFFSET_PX_END_OF_STACK (PORT_OFFSET_PX_STACK + \
/* void * pxDummy6 */ 4 + \
/* uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ] */ CONFIG_FREERTOS_MAX_TASK_NAME_LEN + \

View File

@ -224,6 +224,13 @@ menu "FreeRTOS"
``vTaskList()`` and ``vTaskGetRunTimeStats()`` functions in the build (see
configUSE_STATS_FORMATTING_FUNCTIONS documentation for more details).
config FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
bool "configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES"
#TODO: Enable by default for debug builds (IDF-8517)
default n
help
Enable list integrity checker (see configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES documentation for more details).
config FREERTOS_VTASKLIST_INCLUDE_COREID
# Core affinity is supported in stats for Amazon FreeRTOS SMP by default
bool "Enable display of xCoreID in vTaskList"

View File

@ -251,6 +251,9 @@
#endif /* CONFIG_FREERTOS_SMP */
#endif /* def __ASSEMBLER__ */
/* -------------- List Data Integrity Checks --------------- */
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES
/* ----------------------------------------------- Amazon SMP FreeRTOS -------------------------------------------------
* - All Amazon SMP FreeRTOS specific configurations
* ------------------------------------------------------------------------------------------------------------------ */

View File

@ -17,3 +17,4 @@ CONFIG_FREERTOS_RUN_TIME_COUNTER_TYPE_U64=y
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_FREERTOS_FPU_IN_ISR=y
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES=y

View File

@ -1,11 +1,12 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include_next <sys/lock.h>
#include "sdkconfig.h"
#ifdef _RETARGETABLE_LOCKING
@ -13,15 +14,19 @@
* The size here should be sufficient for a FreeRTOS mutex.
* This is checked by a static assertion in locks.c
*
* Note 1: this might need to be made dependent on whether FreeRTOS
* Note: this might need to be made dependent on whether FreeRTOS
* is included in the build.
*
* Note 2: the size is made sufficient for the case when
* configUSE_TRACE_FACILITY is enabled. If it is disabled,
* this definition wastes 8 bytes.
*/
struct __lock {
#if (CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES && CONFIG_FREERTOS_USE_TRACE_FACILITY)
int reserved[29];
#elif (CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES && !CONFIG_FREERTOS_USE_TRACE_FACILITY)
int reserved[27];
#elif (!CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES && CONFIG_FREERTOS_USE_TRACE_FACILITY)
int reserved[23];
#else
int reserved[21];
#endif /* #if (CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES && CONFIG_FREERTOS_USE_TRACE_FACILITY) */
};
/* Compatibility definitions for the legacy ESP-specific locking implementation.

View File

@ -22,7 +22,7 @@ typedef struct crypto_bignum crypto_bignum;
TEST_CASE("Test crypto lib bignum apis", "[wpa_crypto]")
{
set_leak_threshold(250);
set_leak_threshold(300);
{
uint8_t buf[32], buf2[32];

View File

@ -34,7 +34,7 @@ extern size_t dpp_nonce_override_len;
TEST_CASE("Test vectors DPP responder p256", "[wpa_dpp]")
{
set_leak_threshold(120);
set_leak_threshold(130);
/* Global variables */
char command[1200] = {0};
const u8 *frame;

View File

@ -55,7 +55,7 @@ extern const wifi_osi_funcs_t *wifi_funcs;
/* Check if eloop runs its timers correctly & in correct order */
TEST_CASE("Test eloop timers run", "[eloop]")
{
set_leak_threshold(800);
set_leak_threshold(1000);
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
cfg.nvs_enable = false;
ESP_ERROR_CHECK(esp_wifi_init(&cfg));

View File

@ -15,7 +15,7 @@
TEST_CASE("Test pbkdf2", "[crypto-pbkdf2]")
{
set_leak_threshold(120);
set_leak_threshold(130);
uint8_t PMK[PMK_LEN];
uint8_t ssid_len;

View File

@ -48,7 +48,7 @@ void wpabuf_free2(struct wpabuf *buf)
TEST_CASE("Test SAE functionality with ECC group", "[wpa3_sae]")
{
set_leak_threshold(120);
set_leak_threshold(400);
ESP_LOGI("SAE Test", "### Beginning SAE init and deinit ###");
{
/* Test init and deinit*/

View File

@ -4,3 +4,4 @@ CONFIG_COMPILER_WARN_WRITE_STRINGS=y
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
CONFIG_COMPILER_STACK_CHECK=y
CONFIG_FREERTOS_USE_LIST_DATA_INTEGRITY_CHECK_BYTES=y