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 4194F425C9; Mon, 18 Sep 2023 05:08:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD349402DA; Mon, 18 Sep 2023 05:08:09 +0200 (CEST) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id D456D402B1 for ; Mon, 18 Sep 2023 05:08:07 +0200 (CEST) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-68fcb4dc8a9so3633659b3a.2 for ; Sun, 17 Sep 2023 20:08:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1695006487; x=1695611287; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=iyHtpOqCM1FJcRX4tM9A6gOn0G6prF7LeDoLkjiS3OE=; b=PLzvRn3///Ue9Tj0v2YQyUofjS+3jL1h+oEQsMkk55Ag0yUIEs12nhJH6ORceApkCY Y6gJvK63wa5NB+C/0+QHDj3E5TU5nrB3m66FijOf+jT3nQRK2CVsmTtFOLOwKI9cDUIo 0aK0srRrAN161evJF/PMYMinHJ3KqcHVPub0c3Cyh3f3/qc9KIjnt1Lj88eS3KhYVgmA 8b3oEozRE3eWalLNaHN9/1pXBHWQ7jh1JaGjpJPUpH4e16TarBE/lIhXMhOfDXgMrAV/ yTIJOMxzXJ/JQgzhir1HOqpWS/IVujiz+qJllG/N1eqBRCbwk+qU/SjJLlSdecUM6KMy ftIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695006487; x=1695611287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iyHtpOqCM1FJcRX4tM9A6gOn0G6prF7LeDoLkjiS3OE=; b=BEmhMOrLt3ITxneyMOYAaVoXStxR0+S8dk+iWJTzyOFBh3Wr00ZwdPf3Eo3XICnHKr Gw5J/VrO4NWvfs1RAOScgiSocl7n1DcDLgw/PbRyWxa0P/k0oaH3TwKPZzopbfa0kmav YrcO9MqBpRjqXFEpoRdKRR+uplDWuUq+kcfPr3EAOOnc1U00tpsKuLMMJyiVAAZmw1B3 VrdqaejbKJMnnDhBMgcCNckhu8Y+0LMJBLxprlg0DnmNgdVrHY7aeVzWgyjHvJT+uZoP wXmEhbAMbFsqFp7QhYbO2ZteReI1c8knXdtJPVp2BpfQJPD4YQeBxONh3LsvKPRkQG9x 3Ezg== X-Gm-Message-State: AOJu0YxorJxV1S0Vw7QXHQbcg+qMYO+bS0LXp1dNNAWhNfbXRETNM9Gi Ozn4pBFWKb/3oWARveBpIqraew== X-Google-Smtp-Source: AGHT+IHk5U9kt8Vn4yDE6KMzzmmNoqxgvBtJ/PU2xt4UBWxrl8ilZEV7Fkf1xn/liJnphqsMBNUW0A== X-Received: by 2002:a05:6a00:2da2:b0:68f:c9e0:1a68 with SMTP id fb34-20020a056a002da200b0068fc9e01a68mr7339363pfb.3.1695006486849; Sun, 17 Sep 2023 20:08:06 -0700 (PDT) Received: from hermes.local (204-195-112-131.wavecable.com. [204.195.112.131]) by smtp.gmail.com with ESMTPSA id x24-20020aa793b8000000b0068fadc9226dsm6263174pff.33.2023.09.17.20.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 20:08:06 -0700 (PDT) Date: Sun, 17 Sep 2023 20:08:04 -0700 From: Stephen Hemminger To: David Marchand Cc: =?UTF-8?B?5p2o5L2z5piK?= , dev Subject: Re: confusion about dpdk asan Message-ID: <20230917200804.0c60184b@hermes.local> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Thu, 14 Sep 2023 12:42:20 +0200 David Marchand wrote: > On Thu, Sep 14, 2023 at 10:59=E2=80=AFAM =E6=9D=A8=E4=BD=B3=E6=98=8A wrote: > > > > Thank you for your reply. =20 >=20 > Please, let's keep this discussion on the ml. > Anybody can help and this thread may help others having issues with ASan. > Let's try to understand if something is wrong in your setup or if > there is a bug in the doc or example code. >=20 >=20 > You mentionned initially those versions: > Gcc :9.3.0 > Libasan: 4.8.5 >=20 > Which distribution is it? > It looks close to a Ubuntu 20.04, but latest 20.04 has a more recent > version of gcc (9.4 with libasan 5.x) >=20 >=20 > > Sorry for not describing it in detail. > > I compile dpdk with cmd: > > meson setup -Db_sanitize=3Daddress build -Dmax_numa_nodes=3D1 -Dexample= s=3Dhelloworld =20 >=20 > Well, this segfault is strange and I am suspecting an issue out of > DPDK (in libasan itself?). > As I mentionned in my first mail, what happens if you compile without > -Db_sanitize=3Daddress and run the example? >=20 >=20 > If you don't reproduce the segfault without ASan, my next request is > to try to run with some debug traces in ASan: > ASAN_OPTIONS=3Dverbosity=3D1 ./build/examples/dpdk-helloworld etc... >=20 > Alternatively, recompile with debug symbols and run the example > through gdb to get a better backtrace. >=20 >=20 > > I added code as what asan.txt do: > > > > char *p =3D rte_zmalloc(NULL, 9, 0); > > if (!p) { > > printf("rte_zmalloc error.\n"); > > return -1; > > } > > p[9] =3D 'a'; > > > > But the result is exactly as described in the previous email. =20 >=20 > I tried adding this block on the 21.11 branch, in a Ubuntu 20.04.6 contai= ner. > As I mentionned above, this container has a gcc 9.4 version, coming > with a libasan 5 and I get the expected output from ASan. Tried some code with those flags on Debian stable which has Gcc 12.2. 1. Testpmd fails because it can't setup heap. Looks like asan won't work with hugepages. AL: Detected CPU lcores: 8 EAL: Detected NUMA nodes: 1 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: alloc_pages_on_heap(): couldn't allocate memory due to IOVA exceeding = limits of current DMA mask EAL: alloc_pages_on_heap(): Please try initializing EAL with --iova-mode=3D= pa parameter EAL: error allocating rte services array EAL: FATAL: rte_service_init() failed EAL: rte_service_init() failed EAL: Error - exiting with code: 1 Cause: Cannot init EAL: Cannot allocate memory 2. Same for hello world # ./build/examples/dpdk-helloworld EAL: Detected CPU lcores: 8 EAL: Detected NUMA nodes: 1 EAL: Detected static linkage of DPDK EAL: Multi-process socket /var/run/dpdk/rte/mp_socket EAL: Selected IOVA mode 'VA' EAL: alloc_pages_on_heap(): couldn't allocate memory due to IOVA exceeding = limits of current DMA mask EAL: alloc_pages_on_heap(): Please try initializing EAL with --iova-mode=3D= pa parameter EAL: error allocating rte services array EAL: FATAL: rte_service_init() failed EAL: rte_service_init() failed PANIC in main(): Cannot init EAL 0: /lib/x86_64-linux-gnu/libasan.so.8 (7f8616c00000+0x51f31) [7f8616c51f31] 1: ./build/examples/dpdk-helloworld (rte_dump_stack+0xf5) [55a9b8763045] 2: ./build/examples/dpdk-helloworld (__rte_panic+0x11d) [55a9b7c44958] 3: ./build/examples/dpdk-helloworld (55a9b75fb000+0x611a51) [55a9b7c0ca51] 4: /lib/x86_64-linux-gnu/libc.so.6 (7f861561f000+0x271ca) [7f86156461ca] 5: /lib/x86_64-linux-gnu/libc.so.6 (__libc_start_main+0x85) [7f8615646285] 6: ./build/examples/dpdk-helloworld (_start+0x21) [55a9b81cffd1] Aborted