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 C6C18A0C48; Tue, 6 Jul 2021 22:41:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 568C94128B; Tue, 6 Jul 2021 22:41:01 +0200 (CEST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by mails.dpdk.org (Postfix) with ESMTP id 0A17D4120E for ; Tue, 6 Jul 2021 22:40:59 +0200 (CEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 166KY7hd014499; Tue, 6 Jul 2021 16:40:59 -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=VOeL/FZKzZ+AvOOt8Nq1JvHMnKN5RNuSJzASV85MQWw=; b=amCfBJKDivrCKBnBr7VuEb15j5lHphO01HN4ds9ULc7CWoFXBj1Dj1FJcwYrAXPHCAfw TVxcxWow+0sRUxNr2l+BlYqCi/nvLDAXsWeurZOkveYQGRuhjGljuPudrTm0wSUtQ3kl bzWdzcHQy8Vg/MwYOfQs1M3idbd3+Im7KpO1LK6QDUAkVlvbLSColX3/GNAPgUAflxgk X73qmQ0pd9PR33M5DBwfI1AvqzJq5UATB/wWaaBiTldTYKgF6pVwrUE+Ha8MJKgdtNSJ 0tmsZs7LFbbhkow+85dzHAMXwU+I6ybFW+m+rwOttf1Up7t/bhAPP7lTjcQpzAfZ3dxf Bg== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com with ESMTP id 39m8xt86y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jul 2021 16:40:59 -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 166KVxUL023431; Tue, 6 Jul 2021 20:40:58 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma04wdc.us.ibm.com with ESMTP id 39ju3b131k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Jul 2021 20:40:58 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 166KewZw47448454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Jul 2021 20:40:58 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E24DD112062; Tue, 6 Jul 2021 20:40:57 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3942B112063; Tue, 6 Jul 2021 20:40:57 +0000 (GMT) Received: from Davids-MBP.randomparity.org (unknown [9.163.29.254]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 6 Jul 2021 20:40:57 +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: <20210610051352.48493-1-zhihongx.peng@intel.com> <20210615081205.101071-1-zhihongx.peng@intel.com> From: David Christensen Message-ID: <8eff3541-919d-37fe-76f9-1c4141b33af0@linux.vnet.ibm.com> Date: Tue, 6 Jul 2021 13:40:56 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20210615081205.101071-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-ORIG-GUID: D3TJ1hbQkwMkYSxcnQwA8XkpyoDaff0S X-Proofpoint-GUID: D3TJ1hbQkwMkYSxcnQwA8XkpyoDaff0S 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-07-06_10:2021-07-06, 2021-07-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 adultscore=0 malwarescore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107060095 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 6/15/21 1:12 AM, zhihongx.peng@intel.com 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 Any library dependencies here that might be architecture specific? I applied the patch to a POWER9 system with RHEL 8.3 and observed a SEGV: sudo /home/drc/src/dpdk/build/app/dpdk-testpmd -l 64-71 --vdev=net_memif0,role=server,id=0 --vdev=net_memif1,role=client,id=0 --no-pci -- -i --numa --port-numa-config=0,8,1,8 --ring-numa-config=0,3,8,1,3,8 --socket-num=8 EAL: Detected 128 lcore(s) EAL: Detected 2 NUMA nodes EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: No available 1048576 kB hugepages reported EAL: VFIO support initialized AddressSanitizer:DEADLYSIGNAL ================================================================= ==3011526==ERROR: AddressSanitizer: SEGV on unknown address 0x0002a0177bd0 (pc 0x000011411ce0 bp 0x7fffccd738b0 sp 0x7fffccd738b0 T0) ==3011526==The signal is caused by a UNKNOWN memory access. #0 0x11411cdc in asan_set_shadow.constprop.4 (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11411cdc) #1 0x114131ec in malloc_elem_alloc (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x114131ec) #2 0x11416adc in heap_alloc.isra.1 (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11416adc) #3 0x11419570 in malloc_heap_alloc_on_heap_id.isra.5 (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11419570) #4 0x1141977c in malloc_heap_alloc (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x1141977c) #5 0x11421794 in rte_malloc_socket (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11421794) #6 0x11421e14 in rte_zmalloc_socket (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11421e14) #7 0x11422250 in rte_zmalloc (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11422250) #8 0x114222f4 in rte_calloc (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x114222f4) #9 0x11428fa4 in rte_service_init (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11428fa4) #10 0x11433680 in rte_eal_init (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11433680) #11 0x1039a734 in main (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x1039a734) #12 0x7fffa3664074 in generic_start_main ../csu/libc-start.c:308 #13 0x7fffa3664260 in __libc_start_main ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:102 AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/home/drc/src/dpdk/build/app/dpdk-testpmd+0x11411cdc) in asan_set_shadow.constprop.4 ==3011526==ABORTING Dave