From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D9E7C433FE for ; Fri, 17 Sep 2021 08:23:25 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id A5D1D6112E for ; Fri, 17 Sep 2021 08:23:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A5D1D6112E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DEF55406B4; Fri, 17 Sep 2021 10:23:23 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id C2A8F40689 for ; Fri, 17 Sep 2021 10:23:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631867000; 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=yxRgUskIBTGYy0uhD+J6J+bsQWFOUmsEJZaievoM6YQ=; b=P6HtbL3jur7GImsMohFi/O2sGtYAUpUJ8xL5sTWUDREpEdvZehKmDLJoXvInSeu+cyUjGd EYIRPJY+3y3d6XoNW3hKmgYWv7P1ZFMMJGQkshn8Q18n/RYZH/6u4rFoxJ6f3p3uFHi6n3 lHHnqbkft1jYNK/zR8TWfIBF8/9qQYA= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-ZYBdghDzN7mHFi2EeBU29Q-1; Fri, 17 Sep 2021 04:23:18 -0400 X-MC-Unique: ZYBdghDzN7mHFi2EeBU29Q-1 Received: by mail-lf1-f72.google.com with SMTP id bq3-20020a056512150300b003ee49c29389so6098921lfb.15 for ; Fri, 17 Sep 2021 01:23:18 -0700 (PDT) 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=yxRgUskIBTGYy0uhD+J6J+bsQWFOUmsEJZaievoM6YQ=; b=tSPWRhGso8xhxZDvH82GFC3JQ0UVhuxgSIl5dL8ijCsaA35GKGrzMINKizmc7Yxkhc EN+rsK71xZApGDalKrDCKbdPjYepAOg/CCGAi20C9UjKtlmnLKr/I4TFbBsPanhpryGw ogA4jofYg25v1cqttCmjKclN0GwxUPt0wE6nel19PDDRpFXTUo0g+8yncrvw0k9CjM86 pXorCOLJ6GZPnebSZjooOpz14dkKtq/eIymiQgMJ1HttyzPBZL3GoMFADdl+6kWEeOTw E/nA7nO/grg8Qz3RxfkR3fJbdWtD0gU7zIse8lK/ufEr7n6a98t9ptBd7YT215ZzR75S Fk4Q== X-Gm-Message-State: AOAM532wUiCuKjgKj9/GkC95lZVNMRlH0Zvy2fmZlM+8G3C/WrrEJF1f N1SI9VkNey4aomtVdZh9m1WlcKW9mHq1q9ZvTDlCaEYB2pJiQmrYH2TApWLe1NjeUxIQxlnT8Id bdeLtrhGRXG5wVRwBrKM= X-Received: by 2002:a05:6512:31c3:: with SMTP id j3mr558246lfe.217.1631866997068; Fri, 17 Sep 2021 01:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGOQQ856AiaVoRAA1Xr5euiljWoI5HcxuMq7h48iFjdHlI1WsvJxIyUX7CNfpHbBt36hEFNQB2E8Z7+wZk1tY= X-Received: by 2002:a05:6512:31c3:: with SMTP id j3mr558233lfe.217.1631866996807; Fri, 17 Sep 2021 01:23:16 -0700 (PDT) MIME-Version: 1.0 References: <20210910020147.148019-1-zhihongx.peng@intel.com> <20210916013843.342366-1-zhihongx.peng@intel.com> In-Reply-To: <20210916013843.342366-1-zhihongx.peng@intel.com> From: David Marchand Date: Fri, 17 Sep 2021 10:23:05 +0200 Message-ID: To: Zhihong Peng Cc: "Burakov, Anatoly" , "Ananyev, Konstantin" , Stephen Hemminger , dev , Xueqin Lin 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 v2] Enable AddressSanitizer feature on DPDK 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 Thu, Sep 16, 2021 at 3:47 AM wrote: > > From: Zhihong Peng > > AddressSanitizer (ASan) is a google memory error detect > standard tool. It could help to detect use-after-free and > {heap,stack,global}-buffer overflow bugs in C/C++ programs, > print detailed error information when error happens, large > improve debug efficiency. > > By referring to its implementation algorithm > (https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm), > enable heap-buffer-overflow and use-after-free functions on dpdk. > DPDK ASAN function currently only supports on Linux x86_64. > > Here is an example of heap-buffer-overflow bug: > ...... > char *p = rte_zmalloc(NULL, 7, 0); > p[7] = 'a'; > ...... > > Here is an example of use-after-free bug: > ...... > char *p = rte_zmalloc(NULL, 7, 0); > rte_free(p); > *p = 'a'; > ...... > Unfortunately, this won't build with some (too smart) compilers. Can you look at the CI report? Thanks. > If you want to use this feature, > you need to add below compilation options when compiling code: > -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address > "-Dbuildtype=debug": Display code information when coredump occurs > in the program. > "-Db_lundef=false": It is enabled by default, and needs to be > disabled when using asan. > > Signed-off-by: Xueqin Lin > Signed-off-by: Zhihong Peng -- David Marchand