From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B13DA0C4E; Mon, 8 Nov 2021 16:01:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 490D7410FD; Mon, 8 Nov 2021 16:01:41 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 5D5C640E28 for ; Mon, 8 Nov 2021 16:01:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636383698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XlwhC6UcPjN8tqaNjiNRPzFCVkkfURWwjH8ojk7orcY=; b=ewuTXsD5dTWw+UtzgVhaHzBDNYCLQ0notZxMdY/NTYfv4CJQ2DbmbLXejB7jLbdljvGBw0 +d3t9jNXBa3/+nwOSJDZZHUWu9AQFlF4kTM00SbWt+sUM3Rk8jCmvH5RZyZ/WgtXGFMyiE BFtFtGkJBmNLEL+HuVB4vqxUVdIZCYw= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53-KfNB55vNMcSdpmAh2eKZQQ-1; Mon, 08 Nov 2021 10:01:37 -0500 X-MC-Unique: KfNB55vNMcSdpmAh2eKZQQ-1 Received: by mail-lj1-f200.google.com with SMTP id l9-20020a2e8349000000b00218c7c981bcso1157475ljh.8 for ; Mon, 08 Nov 2021 07:01:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XlwhC6UcPjN8tqaNjiNRPzFCVkkfURWwjH8ojk7orcY=; b=GG4EfvhGg0mVWJ0HHo62rV+W8jUgzNoMaGbY+qBEzkLWihVQl2t7/WYLtnEODb2L0o Bog3wmfQ6Z6YnlLurp/4m0SoYxX37v2attx0jWOlkIHa/hAPPaXeXKjcoKpUDaxj4fJr uy9+Q+F7e/Xk341BCRrutcd8Kpdz+9Qg+9DfQ0SkbK51vYhyyoYU6DhBGfbguY4M6nKH RGHLlfU0YUz98ShbFMhrhjI1VJXqL/lcC2JgG3HfFEg3Ye20ZF37UQfNdWyOmqoz0rm4 j1qID6FFNAjihuFAO6lsJ3v5lD0SMKgYpUkcRTNOHOZShy8zSFcYXabxu2gX8FFseeiO 1r0w== X-Gm-Message-State: AOAM532ycFF3JuDIOeE7wHODeMZgD46XJ0dvBMe63d7OBuAjygLtTu7v RxZDw2Dvc13ZOlJgtCPREmnBvAndDltba0m6Ui27p5QDgexgNSucgtwx4sVo94rPx/Nwkp0kRnE C3qr0Tk0VIRTkD1aUJao= X-Received: by 2002:a05:6512:a8e:: with SMTP id m14mr52875lfu.575.1636383687135; Mon, 08 Nov 2021 07:01:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYlb8wlxAsey/U/BShpnYnsyOGCg6qz8ZgfdlShnBtkg3WZvOfDTXx79g/TabdaJUI3ZItQEnUy5whS8gaREs= X-Received: by 2002:a05:6512:a8e:: with SMTP id m14mr52385lfu.575.1636383683639; Mon, 08 Nov 2021 07:01:23 -0800 (PST) MIME-Version: 1.0 References: <20211108134547.3286191-1-vfialko@marvell.com> In-Reply-To: <20211108134547.3286191-1-vfialko@marvell.com> From: David Marchand Date: Mon, 8 Nov 2021 16:01:12 +0100 Message-ID: To: Volodymyr Fialko Cc: dev , Bruce Richardson , Anatoly Burakov , Jerin Jacob Kollanukkaran , David Christensen Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] build: enable ASan for arm64 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, Nov 8, 2021 at 2:46 PM Volodymyr Fialko wrote: > > This patch defines ASAN_SHADOW_OFFSET for arm64 according to the ASan > documentation. This offset should cover all arm64 VMAs supported by > ASan. > > Signed-off-by: Volodymyr Fialko > --- > config/meson.build | 2 +- > doc/guides/prog_guide/asan.rst | 2 +- > lib/eal/common/malloc_elem.h | 3 +++ > 3 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/config/meson.build b/config/meson.build > index 17b5bec406..7eb710c08d 100644 > --- a/config/meson.build > +++ b/config/meson.build > @@ -428,7 +428,7 @@ if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 'address > dpdk_extra_ldflags += '-lasan' > endif > > - if is_linux and arch_subdir == 'x86' and dpdk_conf.get('RTE_ARCH_64') > + if is_linux and arch_subdir in ['x86', 'arm'] and dpdk_conf.get('RTE_ARCH_64') > dpdk_conf.set10('RTE_MALLOC_ASAN', true) > endif > endif > diff --git a/doc/guides/prog_guide/asan.rst b/doc/guides/prog_guide/asan.rst > index 6d1b871c93..7a584427dd 100644 > --- a/doc/guides/prog_guide/asan.rst > +++ b/doc/guides/prog_guide/asan.rst > @@ -33,7 +33,7 @@ Example:: > "stty echo" command when an error occurs. > > ASan is aware of DPDK memory allocations, thanks to added instrumentation. > -This is only enabled on x86_64 at the moment. > +This is only enabled on x86_64 and arm64 at the moment. Nit: "only" can be removed now. > Other architectures may have to define ASAN_SHADOW_OFFSET. > > Example heap-buffer-overflow error > diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h > index 262d69bb3e..c00c7845ab 100644 > --- a/lib/eal/common/malloc_elem.h > +++ b/lib/eal/common/malloc_elem.h > @@ -107,6 +107,9 @@ malloc_elem_cookies_ok(const struct malloc_elem *elem) > #ifdef RTE_ARCH_X86_64 > #define ASAN_SHADOW_OFFSET 0x00007fff8000 > #endif > +#ifdef RTE_ARCH_ARM64 > +#define ASAN_SHADOW_OFFSET 0x001000000000 > +#endif The value lgtm, from gcc: libsanitizer/asan/asan_mapping.h:static const u64 kAArch64_ShadowOffset64 = 1ULL << 36; libsanitizer/asan/asan_mapping.h:# define SHADOW_OFFSET kAArch64_ShadowOffset64 > > #define ASAN_SHADOW_GRAIN_SIZE 8 > #define ASAN_MEM_FREE_FLAG 0xfd > -- > 2.25.1 > Reviewed-by: David Marchand I hope ppc will follow soon :-). -- David Marchand