| #
4d8bdd8b |
| 04-May-2022 |
Anatoly Burakov <[email protected]> |
malloc: fix ASan handling for unmapped memory
Currently, when we free previously allocated memory, we mark the area as "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a malloc ele
malloc: fix ASan handling for unmapped memory
Currently, when we free previously allocated memory, we mark the area as "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a malloc element will cause pages to be unmapped from memory and re-backed with anonymous memory again. This may cause ASan's "use-after-free" error down the line, because the allocator will try to write into memory areas recently marked as "freed".
To fix this, we need to mark the unmapped memory area as "available", and fixup surrounding malloc element header/trailers to enable later malloc routines to safely write into new malloc elements' headers or trailers.
Bugzilla ID: 994 Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") Cc: [email protected]
Reported-by: David Marchand <[email protected]> Signed-off-by: Anatoly Burakov <[email protected]>
show more ...
|
|
Revision tags: v22.03, v22.03-rc4, v22.03-rc3, v22.03-rc2 |
|
| #
30a1de10 |
| 15-Feb-2022 |
Sean Morrissey <[email protected]> |
lib: remove unneeded header includes
These header includes have been flagged by the iwyu_tool and removed.
Signed-off-by: Sean Morrissey <[email protected]>
|
|
Revision tags: v22.03-rc1, v21.11, v21.11-rc4, v21.11-rc3 |
|
| #
a0cc7be2 |
| 13-Nov-2021 |
Stephen Hemminger <[email protected]> |
mem: cleanup multiprocess resources
The mp action resources in malloc should be cleaned up via rte_eal_cleanup.
Signed-off-by: Stephen Hemminger <[email protected]> Acked-by: Anatoly Burak
mem: cleanup multiprocess resources
The mp action resources in malloc should be cleaned up via rte_eal_cleanup.
Signed-off-by: Stephen Hemminger <[email protected]> Acked-by: Anatoly Burakov <[email protected]>
show more ...
|
| #
2edd037c |
| 03-Feb-2022 |
Dmitry Kozlyuk <[email protected]> |
mem: add dirty malloc element support
EAL malloc layer assumed all free elements content is filled with zeros ("clean"), as opposed to uninitialized ("dirty"). This assumption was ensured in two way
mem: add dirty malloc element support
EAL malloc layer assumed all free elements content is filled with zeros ("clean"), as opposed to uninitialized ("dirty"). This assumption was ensured in two ways: 1. EAL memalloc layer always returned clean memory. 2. Freed memory was cleared before returning into the heap.
Clearing the memory can be as slow as around 14 GiB/s. To save doing so, memalloc layer is allowed to return dirty memory. Such segments being marked with RTE_MEMSEG_FLAG_DIRTY. The allocator tracks elements that contain dirty memory using the new flag in the element header. When clean memory is requested via rte_zmalloc*() and the suitable element is dirty, it is cleared on allocation. When memory is deallocated, the freed element is joined with adjacent free elements, and the dirty flag is updated:
a) If the joint element contains dirty parts, it is dirty:
dirty + freed + dirty = dirty => no need to clean freed + dirty = dirty the freed memory
Dirty parts may be large (e.g. initial allocation), so clearing them could create unpredictable slowdown.
b) If the only dirty part of the joint element is the freed memory, the joint element can be made clean:
clean + freed + clean = clean => freed memory clean + freed = clean must be cleared freed + clean = clean freed = clean
This logic naturally reproduces the old behavior and always applies in modes when EAL memalloc layer returns only clean segments.
As a result, memory is either cleared on free, as before, or it will be cleared on allocation if need be, but never twice.
Signed-off-by: Dmitry Kozlyuk <[email protected]> Reviewed-by: Anatoly Burakov <[email protected]>
show more ...
|
|
Revision tags: v21.11-rc2 |
|
| #
770d41bf |
| 29-Oct-2021 |
Ilyes Ben Hamouda <[email protected]> |
malloc: fix allocation with unknown socket ID
When using rte_malloc() from a thread which is not bound to a numa socket (the typical case is a control thread, but it can also happen on a dataplane t
malloc: fix allocation with unknown socket ID
When using rte_malloc() from a thread which is not bound to a numa socket (the typical case is a control thread, but it can also happen on a dataplane thread if its cpu affinity is on cores attached to several sockets), the used heap is the one from numa socket 0, which may not have available memory.
Fix this by selecting the first socket which has available memory.
Note: malloc_get_numa_socket() is only used from one .c file, so move it there, and remove the inline keyword.
Fixes: b94580d6887e ("malloc: avoid unknown socket id") Cc: [email protected]
Signed-off-by: Ilyes Ben Hamouda <[email protected]> Signed-off-by: Olivier Matz <[email protected]> Acked-by: David Marchand <[email protected]>
show more ...
|
|
Revision tags: v21.11-rc1 |
|
| #
6cc51b12 |
| 20-Oct-2021 |
Zhihong Peng <[email protected]> |
mem: instrument allocator for ASan
This patch adds necessary hooks in the memory allocator for ASan.
This feature is currently available in DPDK only on Linux x86_64. If other OS/architectures want
mem: instrument allocator for ASan
This patch adds necessary hooks in the memory allocator for ASan.
This feature is currently available in DPDK only on Linux x86_64. If other OS/architectures want to support it, ASAN_SHADOW_OFFSET must be defined and RTE_MALLOC_ASAN must be set accordingly in meson.
Signed-off-by: Xueqin Lin <[email protected]> Signed-off-by: Zhihong Peng <[email protected]> Acked-by: Anatoly Burakov <[email protected]>
show more ...
|
|
Revision tags: v21.08, v21.08-rc4, v21.08-rc3, v21.08-rc2, v21.08-rc1, v21.05, v21.05-rc4, v21.05-rc3, v21.05-rc2, v21.05-rc1 |
|
| #
99a2dd95 |
| 20-Apr-2021 |
Bruce Richardson <[email protected]> |
lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on the directory names. This prefix makes the directory names longer and also m
lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on the directory names. This prefix makes the directory names longer and also makes it awkward to add features referring to individual libraries in the build - should the lib names be specified with or without the prefix. Therefore, we can just remove the library prefix and use the library's unique name as the directory name, i.e. 'eal' rather than 'librte_eal'
Signed-off-by: Bruce Richardson <[email protected]>
show more ...
|