[PATCH v3] mem: allow using ASan in multi-process mode

Stephen Hemminger stephen at networkplumber.org
Thu Oct 3 23:18:45 CEST 2024


On Wed, 25 Oct 2023 11:27:17 +0200
Artur Paszkiewicz <artur.paszkiewicz at intel.com> wrote:

> Multi-process applications operate on shared hugepage memory but each
> process has its own ASan shadow region which is not synchronized with
> the other processes. This causes issues when different processes try to
> use the same memory because they have their own view of which addresses
> are valid.
> 
> Fix it by mapping the shadow regions for memseg lists as shared memory.
> The primary process is responsible for creating and removing the shared
> memory objects.
> 
> Disable ASan instrumentation for triggering the page fault in
> alloc_seg() because if the segment is already allocated by another
> process and is marked as free in the shadow, accessing this address will
> cause an ASan error.
> 
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz at intel.com>
> ---
> v3:
> - Removed conditional compilation from eal_common_memory.c.
> - Improved comments.
> v2:
> - Added checks for config options disabling multi-process support.
> - Fixed missing unmap in legacy mode.
> 
>  lib/eal/common/eal_common_memory.c |   7 ++
>  lib/eal/common/eal_private.h       |  35 ++++++++++
>  lib/eal/linux/eal_memalloc.c       |  23 +++++--
>  lib/eal/linux/eal_memory.c         | 101 +++++++++++++++++++++++++++++
>  lib/eal/linux/meson.build          |   4 ++
>  5 files changed, 164 insertions(+), 6 deletions(-)

Makes sense, but patch has some fuzz against current main branch.
There is also another patch that address the ASAN touch issue.

https://patchwork.dpdk.org/project/dpdk/patch/20240723083419.12435-1-amichon@kalrayinc.com/


More information about the dev mailing list