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 6A512A0547; Fri, 10 Sep 2021 19:58:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C7A641134; Fri, 10 Sep 2021 19:58:50 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B9A54111D for ; Fri, 10 Sep 2021 19:58:49 +0200 (CEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 18AHXEU8119203; Fri, 10 Sep 2021 13:58:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=FTlDTRNoi6FJJofSbgQ2f7zyHz+jcY5rmZa1+76CTVk=; b=cSd/mkoNkbJdyqFD2gOYIgli1JvLDC/6VMYKVTo5X7FFBjOs9+J4kwaB58tSwOGAax1B Bh/l9jcnjDImmB0UX+sCWf/AhrquznDbvkhsctD7AoDft+HcENeyBAhfmcKHF5GjvlKY BsTQJ9boue//CNu5RqAEF2Ollajvfmd04OsAAozUFT2qEgyk5P2TndWETT//wpRoQdaA /VzmfG0gX1PGNqebh0iEfWYgM9MThSkfLpmyWKQ7ABdSUO9mSvhMemlBQosUHfxfmWr+ k3iQgYhkZVUFd0q+z4G0oA8+aTN7JoPImi+JpeTA12ebCJu7Xor9qwZwOnNPg7zfS1HU /A== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3b08xhmb5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Sep 2021 13:58:48 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18AHvaOx019095; Fri, 10 Sep 2021 17:58:46 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma04wdc.us.ibm.com with ESMTP id 3axcns2ya4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Sep 2021 17:58:46 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18AHwjAt43385126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Sep 2021 17:58:45 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD4F0124052; Fri, 10 Sep 2021 17:58:45 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 99B40124060; Fri, 10 Sep 2021 17:58:44 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.211.70.237]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 10 Sep 2021 17:58:44 +0000 (GMT) To: zhihongx.peng@intel.com, anatoly.burakov@intel.com, konstantin.ananyev@intel.com, stephen@networkplumber.org Cc: dev@dpdk.org, xueqin.lin@intel.com References: <20210910020147.148019-1-zhihongx.peng@intel.com> From: David Christensen Message-ID: Date: Fri, 10 Sep 2021 10:58:43 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <20210910020147.148019-1-zhihongx.peng@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FnRLBYmFXgYq5Z771xC6QbwQOf6CC5Yu X-Proofpoint-ORIG-GUID: FnRLBYmFXgYq5Z771xC6QbwQOf6CC5Yu Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-09-10_07:2021-09-09, 2021-09-10 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 malwarescore=0 mlxlogscore=496 spamscore=0 clxscore=1011 phishscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109100102 Subject: Re: [dpdk-dev] [PATCH] 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" > 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. > > 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 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. On initial inspection, it appears ASAN functionality doesn't work with DPDK on PPC architecture. I tested the patch with several compiler versions (gcc 8.3.1 from RHEL 8.3 through gcc 11.2.1 from the IBM Advanced Toolchain 15.0) and observed the following error when running testpmd with ASAN enabled: AddressSanitizer:DEADLYSIGNAL ================================================================= ==49246==ERROR: AddressSanitizer: SEGV on unknown address 0x0000a0077bd0 (pc 0x000010b4eca4 bp 0x7fffffffe150 sp 0x7fffffffe150 T0) ==49246==The signal is caused by a UNKNOWN memory access. #0 0x10b4eca4 in asan_set_shadow ../lib/eal/common/malloc_elem.h:120 #1 0x10b4ed68 in asan_set_zone ../lib/eal/common/malloc_elem.h:135 #2 0x10b4ee90 in asan_clear_split_alloczone ../lib/eal/common/malloc_elem.h:162 #3 0x10b51f84 in malloc_elem_alloc ../lib/eal/common/malloc_elem.c:477 ... Can you incorporate an exception for PPC architecture with this patch while I look into the problem further? Dave