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 A60A345AF9; Thu, 10 Oct 2024 02:30:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5407A4025E; Thu, 10 Oct 2024 02:30:18 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id BB39A4025E for ; Thu, 10 Oct 2024 02:30:16 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71df0dbee46so293094b3a.0 for ; Wed, 09 Oct 2024 17:30:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728520216; x=1729125016; 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=XkEzNnD+FXGSx8nf4Jc1EABQ2A3FuWP2uDtmYi/lEOw=; b=nRO/eSiNTIiNthTxOTi6QHngABfrx4fjheZsR8tm3Mlfvt6ObqI+U0fzpFq/FqypPv B35LwAF3sWqrihiCQCLdyZZ5tE1Zr/MVtfHEUrlva9zdI5kHHN6Q9R7qjh+GubLkGdhk ry0fHMw/npLmNoJpgM3g+gbBYdRo/73mMF5MzBx8jbTeezLpEPY2RKUrUJPimyfOgXss /HIi/Z5kiaJmcW+77lJeGL1ktoIO+4tzLanYh0bzxHdpfSOZ9/RMmpzfIWU9Vt7/CMb2 yyJeh23jzqsH4FUYz0ZSZTFZD6uRY/A/2ZXPWP9ihZ0hZkTngpF0oUaXbEhOow2YSdcn KsHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728520216; x=1729125016; 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=XkEzNnD+FXGSx8nf4Jc1EABQ2A3FuWP2uDtmYi/lEOw=; b=LJacq63jWQ90X7iZz8PVenk8nf/vejKb9UbLfJ3LgKI+BSHY7mB1n+gPZEJmM3P6V/ bT4nrTz54UYotZKWtEVI+faqj8E5B4zE+ZYLvCptiyQ+E3qSGmB2jJs8XST2WzxFtVRr LLPoPbIUdOu6uKmopv6sC3kc2+Gq9vtRzw3Bt8YFXiZVo5rqDoOyNrWyWOIEiwqLo/Oe c+bNsBJ8Es6i+sjx5NZknuXbkd2W3myl1+e7qf/QOoGIOMECQ25Jch+M/kLLM2SZWkM/ 15CP8KEZ+/AV2D7wDA3RW758yXcWDle/xmM1c0yoROydm3Ed4cvl28FRLZ6obXnOGBUB KOaw== X-Gm-Message-State: AOJu0YwYiODcBRjGWvghjThAvj+FS1TxRE18aUzOUJn2IjOaUoLqJFWV Jg8XNC0TzPZElQmvKJSZvzmF8LFIs6njD1aHfHRqRoed/U/DtnnLvVgtDE1Qt9Ld4LoWTkGfrZf I X-Google-Smtp-Source: AGHT+IFk4Y289SaJkfaR0PsTmQkrIxcm7+hShoEQdId4FRi/5vpWmlAU9u5gfvZsDS/J4R6iBKaeYA== X-Received: by 2002:a05:6a00:1a8b:b0:71d:f821:1981 with SMTP id d2e1a72fcca58-71e1db64904mr7648601b3a.4.1728520215769; Wed, 09 Oct 2024 17:30:15 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e2aab9b12sm14175b3a.151.2024.10.09.17.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 17:30:15 -0700 (PDT) Date: Wed, 9 Oct 2024 17:30:13 -0700 From: Stephen Hemminger To: Konstantin Ananyev Cc: dev@dpdk.org, songx.jiale@intel.com, Konstantin Ananyev , stable@dpdk.org Subject: Re: [PATCH v2 1/2] examples/l3fwd: fix read beyond array bondaries Message-ID: <20241009173013.0d964751@hermes.local> In-Reply-To: <20240730122235.1084-2-konstantin.v.ananyev@yandex.ru> References: <20240726194302.920-1-konstantin.v.ananyev@yandex.ru> <20240730122235.1084-1-konstantin.v.ananyev@yandex.ru> <20240730122235.1084-2-konstantin.v.ananyev@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Tue, 30 Jul 2024 13:22:34 +0100 Konstantin Ananyev wrote: > From: Konstantin Ananyev > > ASAN report: > ERROR: AddressSanitizer: unknown-crash on address 0x7ffffef92e32 at pc 0x00000053d1e9 bp 0x7ffffef92c00 sp 0x7ffffef92bf8 > READ of size 16 at 0x7ffffef92e32 thread T0 > #0 0x53d1e8 in _mm_loadu_si128 /usr/lib64/gcc/x86_64-suse-linux/11/include/emmintrin.h:703 > #1 0x53d1e8 in send_packets_multi ../examples/l3fwd/l3fwd_sse.h:125 > #2 0x53d1e8 in acl_send_packets ../examples/l3fwd/l3fwd_acl.c:1048 > #3 0x53ec18 in acl_main_loop ../examples/l3fwd/l3fwd_acl.c:1127 > #4 0x12151eb in rte_eal_mp_remote_launch ../lib/eal/common/eal_common_launch.c:83 > #5 0x5bf2df in main ../examples/l3fwd/main.c:1647 > #6 0x7f6d42a0d2bc in __libc_start_main (/lib64/libc.so.6+0x352bc) > #7 0x527499 in _start (/home/kananyev/dpdk-l3fwd-acl/x86_64-native-linuxapp-gcc-dbg-b1/examples/dpdk-l3fwd+0x527499) > > Reason for that is that send_packets_multi() uses 16B loads to access > input dst_port[]and might read beyond array boundaries. > Right now, it doesn't cause any real issue - junk values are ignored, also > inside l3fwd we always allocate dst_port[] array on the stack, so > memory beyond it is always available. > Anyway, it probably need to be fixed. > The patch below simply allocates extra space for dst_port[], so > send_packets_multi() will never read beyond its boundaries. > > Probably a better fix would be to change send_packets_multi() > itself to avoid access beyond 'nb_rx' entries. > > Bugzilla ID: 1502 > Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") > Cc: stable@dpdk.org > > Signed-off-by: Konstantin Ananyev Acked-by: Stephen Hemminger