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 64E5AA0C46; Fri, 17 Sep 2021 10:23:24 +0200 (CEST) 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