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 3AC62A0C49; Wed, 16 Jun 2021 13:35:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE7E74067A; Wed, 16 Jun 2021 13:35:10 +0200 (CEST) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by mails.dpdk.org (Postfix) with ESMTP id B0E5340140 for ; Wed, 16 Jun 2021 13:35:09 +0200 (CEST) Received: by mail-il1-f180.google.com with SMTP id x12so2048292ill.4 for ; Wed, 16 Jun 2021 04:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ofOFOTEF1tgV4OoNRzxjBPsL3YLgo0advYX605418is=; b=HFtFhhsanwpaI9RusEKgvdzNihLsGfDxdAFz+g+FJTlFs/kF2Oe+zcqLfiSVEv0Zd8 +LNDEx0GUfJpp6E6UKSCaGjPRtsmWjDmyV13eAFhHAtAzHVCLvpYZVNDOrC5bBwDCwtr Fe4q9/UELCvZNfy7RJ9+GYuuKMUm9u4w67/u3ssiEq6F8DO4M+cpsLyEd4sec25Xk04u AtGiIMS6V+MkJyLk9QWpqz3uUeOzEzs+qoubfu6Fsytj24bKC3pyIfiTF7UZeZ+QMY7q 29UBOalQFnb/DY71HbffqZ/oq/5YOFX7yxesS2b8K3vl2bWdPrN3GHWKqI9N7htVDod9 pESg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ofOFOTEF1tgV4OoNRzxjBPsL3YLgo0advYX605418is=; b=ai+TjoXt3WfWA0lEwAjbUaDACKK9olAccttgICVl47JOTEKCihBpVoOljdfWhvBnqr 4nIwdiKxQ91aq20aJsJwEl8VH27AYHAO5BjaBjV8g0EsDrRCEIYdzrFIacgN9c8NxmeA RFHPSqqR7B8nT9nCkxLa5xcdo3h2PxUEtBV9MXpYXm5pRraz6tSQUbQ1s+RTl3RlCHxV UYf96PZf9C3QoOo3sa3iHBcL1oF050DDHDXIeBFQKZfQXdcG6jCvr6XK7tOAwOEhVi7I r5Mlyi7/6p9k1f2rZOsEmwGr+XRVuWr+VG5QiisEW3P+xq43sNg8jkrulOk05n3s8KJO 540A== X-Gm-Message-State: AOAM53284lk69O9th2fYcbMLhqSdjKxQBz1IvjfWlrkCvyT5FB3Vy6ai pKxtUy50vVtAMJCOnNwHVa0ojRRZHciL7hfLSeU= X-Google-Smtp-Source: ABdhPJzPDq9LtgB1nRNQyQi20Q/rNyBW/1E2nxzaxLkR51XEB+dnE0NpyKcVU3BxyFd0lkk0TqT90euD32d7U+J+Hjg= X-Received: by 2002:a05:6e02:1a6a:: with SMTP id w10mr3511451ilv.130.1623843308585; Wed, 16 Jun 2021 04:35:08 -0700 (PDT) MIME-Version: 1.0 References: <20210610051352.48493-1-zhihongx.peng@intel.com> <20210615081205.101071-1-zhihongx.peng@intel.com> In-Reply-To: From: Jerin Jacob Date: Wed, 16 Jun 2021 17:04:52 +0530 Message-ID: To: "Lin, Xueqin" Cc: "Peng, ZhihongX" , "Burakov, Anatoly" , "Ananyev, Konstantin" , Stephen Hemminger , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [RFC v2] porting AddressSanitizer feature to 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 Wed, Jun 16, 2021 at 2:43 PM Lin, Xueqin wrote: > > > -----Original Message----- > > From: Jerin Jacob > > Sent: Tuesday, June 15, 2021 4:40 PM > > To: Peng, ZhihongX > > Cc: Burakov, Anatoly ; Ananyev, Konstantin > > ; Stephen Hemminger > > ; dpdk-dev ; Lin, Xueqin > > > > Subject: Re: [dpdk-dev] [RFC v2] porting AddressSanitizer feature to DPDK > > > > On Tue, Jun 15, 2021 at 1:46 PM 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), > > > ported heap-buffer-overflow and use-after-freefunctions to dpdk. > > > > > > 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'; > > > ...... > > > > > > If you want to use this feature, > > > you need to use the following compilation options: > > > -Db_lundef=false -Db_sanitize=address > > > > # Thanks for this patch. It is a useful item. > > > > # Subject could be changed > > from: > > porting AddressSanitizer feature to DPDK to > > eal: support for AddressSanitizer > > or so > > Thanks for your positive feedback and review. > Good point, we will update the title in next version. > > > > > # Could you add a section in the documentation for Sanitizers to document the > > build time option and other points that users need to know. > > Make sense to add build option and key points to document, will add this part in doc folder. > > > We can add other sanitizers such as UBSan etc in the future here > WIP to research other sanitizer tool. UBsan is a good candate. Some old DPDK patch for the same: http://patches.dpdk.org/project/dpdk/patch/1573832013-18946-1-git-send-email-hkalra@marvell.com/ > > > > # Add a UT test case to make sure it is working in app/test or so. > > This tool could help to detect memory issue, need to change bad code to check if working. It is better to have a UT to test things are working. You could add it in app/test/test_address_sanity.c. Tests can be such that - Skip if not complied with Sanity enabled - Pass if the code detects the known bad code. You can have test cases with pubic rte_ API that internally exercise the verify your implementation related to new asan_* APIs. > Suggest listing demo code and tool capture information for user to try if tool works, also add this part into doc. > > > > > # Also, Please update the release note for this feature. > Sure, we can update the release note if code merge. Probably you can send v1 version next i.e change the RFC status to get merged. >