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 DEAD2A0C48; Wed, 7 Jul 2021 01:12:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 613834069E; Wed, 7 Jul 2021 01:12:18 +0200 (CEST) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id 2373B4003C for ; Wed, 7 Jul 2021 01:12:17 +0200 (CEST) Received: by mail-pj1-f52.google.com with SMTP id h1-20020a17090a3d01b0290172d33bb8bcso2530084pjc.0 for ; Tue, 06 Jul 2021 16:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7CSSKLg8tkXzf6sRk3XyzMbseUPgDJqrAes/qxax3vQ=; b=fWWH1GNgDqIM3z0UDECZOtVSijBH7jKaafHlKKp16Mu9B+rrC66dVVnaPsnAbzWru2 OPQ0Z6QoRLAtvrJEqMiMr+xUPhR3LuHBDl0SmrXziEpoMOhFzAHBHOYhFRlrKjZXUs88 N3gxt5mPYb6Xw3oyU7XvLnT6pt5mE+l4lv5RsKTByA8gsUsGO9KXHcGIJXx5HL6bWkQf kaidZPrve31nBBxnsCnVrLi4cuWvojiJYeZWLYM0SepPpBGlYNkmfAdpHrMlwA+mBrwD lxGzT3+UAFW5TjJGW/In97X2HVjueEzWeKZmWQybErPzu1dz9D+ihNmO6CBwsQxt6hFk w8Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7CSSKLg8tkXzf6sRk3XyzMbseUPgDJqrAes/qxax3vQ=; b=T2NAD/HdilV8PvOvQXXLlmiKkOLrtkNLMVj75+qq/2GTQTgU9XJQmi7Gr9CNe+vbRr vmJ6CuG/Zhk8l+VSgWGUoMhLP6dxp2lhGhX4Y9wikIFU5nVDPP04/lJ6RKakeeTJoQW6 jll63QKXpyegphXjBDf0D1i2BxXT49UbJVXCV8Ma8YnMH8IOAYMt6gI9rY+OUnsTAXcS aTrPhEWe14cqfOcfvy80xG6BpMkZTR/NwGgibE7b11REFTSdlANMBeECTgiGddN1GP8U c6Ye+48SZ5jkThbaDWLfSTC1bR3afzgUh9zUjUPaZZ5Nldz7VUqAC1VFSvL2t3VR38XC yrFw== X-Gm-Message-State: AOAM5319MQyCQbwPTx2Du5cnb1ZgoTkGsiecZd/sv2HlhLm/+ZrpL8xQ Y3viKohPUovofEaNjJIyCmOCcg== X-Google-Smtp-Source: ABdhPJwDWXpuBM3OTcQBNduWEk1NNSeBhcesFBQ0HrZZ+Y4DrntD/AogCvcTaMNEQvOMux385EyJBw== X-Received: by 2002:a17:902:d909:b029:11b:870f:ddad with SMTP id c9-20020a170902d909b029011b870fddadmr18699969plz.81.1625613136112; Tue, 06 Jul 2021 16:12:16 -0700 (PDT) Received: from hermes.local (204-195-33-123.wavecable.com. [204.195.33.123]) by smtp.gmail.com with ESMTPSA id y6sm19336799pgk.79.2021.07.06.16.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 16:12:15 -0700 (PDT) Date: Tue, 6 Jul 2021 16:12:13 -0700 From: Stephen Hemminger To: David Christensen Cc: zhihongx.peng@intel.com, anatoly.burakov@intel.com, konstantin.ananyev@intel.com, dev@dpdk.org, xueqin.lin@intel.com Message-ID: <20210706161213.48249906@hermes.local> In-Reply-To: <8eff3541-919d-37fe-76f9-1c4141b33af0@linux.vnet.ibm.com> References: <20210610051352.48493-1-zhihongx.peng@intel.com> <20210615081205.101071-1-zhihongx.peng@intel.com> <8eff3541-919d-37fe-76f9-1c4141b33af0@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Tue, 6 Jul 2021 13:40:56 -0700 David Christensen wrote: > 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 ASAN says you should use -fno-omit-frame-pointer to get reasonable backtrace.