feat(heap): Dissociate heap poisoning from task tracking

In order to enable CONFIG_HEAP_TASK_TRACKING, some kind
of poisoning had to be enabled (!HEAP_POISONING_DISABLED).
However since those functionalities don't seem to be related
in any way, this commit decouple them by removing
MULTI_HEAP_BLOCK_OWNER from poison_head_t in multi_heap_poisoning.c
and handling the block ownership in heap_caps.c instead.

Note that handling task tracking in multi_heap.c would necessitate
updating the ROM implementation of multi_heap.c as well. For this
reason, the task tracking feature has to be handled in heap_caps.c.
This commit is contained in:
Guillaume Souchere
2023-10-04 14:42:00 +02:00
parent fac7cb4b78
commit 7492c862af
9 changed files with 34 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -51,7 +51,6 @@
typedef struct {
uint32_t head_canary;
MULTI_HEAP_BLOCK_OWNER
size_t alloc_size;
} poison_head_t;
@@ -72,7 +71,6 @@ __attribute__((noinline)) static uint8_t *poison_allocated_region(poison_head_t
poison_tail_t *tail = (poison_tail_t *)(data + alloc_size);
head->alloc_size = alloc_size;
head->head_canary = HEAD_CANARY_PATTERN;
MULTI_HEAP_SET_BLOCK_OWNER(head);
uint32_t tail_canary = TAIL_CANARY_PATTERN;
if ((intptr_t)tail % sizeof(void *) == 0) {
@@ -351,11 +349,6 @@ void *multi_heap_get_block_address(multi_heap_block_handle_t block)
return head + sizeof(poison_head_t);
}
void *multi_heap_get_block_owner(multi_heap_block_handle_t block)
{
return MULTI_HEAP_GET_BLOCK_OWNER((poison_head_t*)multi_heap_get_block_address_impl(block));
}
multi_heap_handle_t multi_heap_register(void *start, size_t size)
{
#ifdef SLOW