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 5C9FF455B7; Sun, 7 Jul 2024 16:05:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C15AA40656; Sun, 7 Jul 2024 16:05:47 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2045.outbound.protection.outlook.com [40.107.237.45]) by mails.dpdk.org (Postfix) with ESMTP id 062F640272; Sun, 7 Jul 2024 16:05:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dS22CGVqzFtp3wrIzNE9+yRPECvP3NFrXa/HoOp456U9gXewNjrFs2DvE/8Jk7R0Ly+Z02QBPBZ+8WZNOQZi+ZApLfVgeMxGskuC+KdYCacvVbWINuIVukiuCPMOHvUdBTuJdoHL1kUEB26yxza+MiPoafoy6msNYk/+sTe+RmLOrIEnEQLtrmKwML3wTYNosKID5gokm8mu5JLBvKgds4UaMcfxyQajbTzEn4xc4iK5lAf7n9Ni1C2G0Z3ZL7KIp+6RJ7wrp/S1gAWcWsVid0T8HuWJZuM6PtSWBhj4fKvL+dJI/qU0CibGF6oF9UH5MqIR/6+WkFL7ydZhxUA+kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SXAu4/F8HL88CKE73Y1NRnXiCX8NmYE1DgRTLkWkCO0=; b=Y91lH7qX6OiLHgEDInowLlTTqqVGaWYfYmXv27hVCScNFwoaYFQk54eUACBYEpu1B5MdhwiTdHs0tEcjr6a0KNDJlV7L0f/sieFLZ1MFdSyNM3+4lpdifSJxmh4sHJ1iJJdUJro+be+Dae8Wq1KVUwpuXT8dlcUgzuCXoirhZPjh3G7Jdv5L3Ihu3T2B+z673JJXgvglO35GUEi3haJInsxXs3AWoBIoqlZaX5U2efonbm9EU4Ve8m79qbZdgY3bQF3I8TjUrdbPVxt28XOpuh1qFhYZdnB7T2XM2CcmBqIR4RlD4ixJ4Wdn+7Y6GIPWOgN3Fp+DW1kSPsO4LEVq+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SXAu4/F8HL88CKE73Y1NRnXiCX8NmYE1DgRTLkWkCO0=; b=P7Nwb5emYqWRsFsBRG2Mojktxyevb7GIrr72ssqKRMSnD9u+5xIjXyA24psQr42u+tl8CXHbu6FYkmNbqh40gbuBkVL3TQAIMM7hlKcdBnjmqcnTb34Q15PEO11jySkDUWPFGTfMnNl/L9rOpq0uqeJ9wPtiZFbDfaGJiDj14Sk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by MW4PR12MB6975.namprd12.prod.outlook.com (2603:10b6:303:20a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.34; Sun, 7 Jul 2024 14:05:40 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::ebfb:2f9f:f9ca:82cd]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::ebfb:2f9f:f9ca:82cd%4]) with mapi id 15.20.7741.033; Sun, 7 Jul 2024 14:05:40 +0000 Message-ID: Date: Sun, 7 Jul 2024 15:05:35 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] net/memif: fix buffer overflow in zero copy Rx To: Mihai Brodschi , Jakub Grajciar Cc: dev@dpdk.org, stable@dpdk.org References: <8bf5e505-191b-46ea-8b90-0ed4fc15d306@broadcom.com> Content-Language: en-US From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRTPtCKKm/6BQJkdyEEBQkE3meNAAoJEFRTPtCK Km/6UdcP/0/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KuyO 8Zk= In-Reply-To: <8bf5e505-191b-46ea-8b90-0ed4fc15d306@broadcom.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0058.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::8) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|MW4PR12MB6975:EE_ X-MS-Office365-Filtering-Correlation-Id: 55c04c5a-1b8a-4a36-6a6a-08dc9e8de22b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?cjkwT0R6MWFqVjhDRkRrWC9qRW5UbDV2VXZIRnFFQ0o5a0I1VElCY0wwZkxY?= =?utf-8?B?ZmV4KzgwcERMbVl5UmZIV3kwdldpQTFuRk51Rm1ZVTFaci9kNktSM09iOXpu?= =?utf-8?B?ZDlmZlZCbEM1RzBPM3hMa0srM2xYcUlNT25oamROc0tPb01sUSs3cnIxdHZV?= =?utf-8?B?MVJpUU9BZi9nc095cDdYa3I5Rk1Eek9paFFncHBFeGtjUmZEZEZhKzI0bGYz?= =?utf-8?B?d2ZXdkJ3TWpTZ2V1Y2dCdUxGTlljcko3VkJoZU84SWRxNTYzSE9Oa2lhdzUx?= =?utf-8?B?aFZkVnhGSHYzeVUwTHJlaGJyelpjRG8yVjVNUDJCVnNQcnR4ZEh1WllPSVRT?= =?utf-8?B?bmg5TFJJaC92UTh3VmxBWlVkOGtaMlN1VldSRDk3M2dGK2UzNS8rbkJpQUlu?= =?utf-8?B?WTdwK00wSkFHOStIQWNDSDhlN0RKVFNNUnZYOGFkeWFKK1RjOWNZc2FJNUR1?= =?utf-8?B?bDNKaUZOd2RCRXlubFNpd0VBZFcrN3dxN0xoM1R6O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GTk5SMlIwV0Y2YjRjYi9ya2YzM2VRS3RXdHdnb1Mv?= =?utf-8?B?K0FDZFUzK0U5SlQ3SU9LMkk3dDNndGRjcVUvUVAxbTBJUVhDZ25uWms2OEJP?= =?utf-8?B?Um9OUVFyUVZxS3dKRUszZjdoM2VNVkFNV21pWWYwWVJCVmtHUFloOTRPbk9s?= =?utf-8?B?Q2Y4RWJyMlk4U3Awb2JoUXBVTXpRd1FJNXdkSVU2dlErcjBFbHdQUklhTVJo?= =?utf-8?B?SldvTlJ4VnhXbE5YRUZvSDVPY0hJWU1WQ3BCblFyUStTdjZnM1ZoQTB5b1pY?= =?utf-8?B?RzFScWVPdXRrQWh0VEV4ejc4dlVGd0wvWDRpUFdIY0ZlalFiVnViZWFSMjJF?= =?utf-8?B?cVA5Ulh2ditNbEs4NXQ1WUZWOFNKUDJ3Qm9acXUvZ2ZaaXRaTjlNdUc1c3FH?= =?utf-8?B?MHZGYmJLUnlJQnJLQmQ3UT09?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?S2E3T3dWWlpaUnRsbVlTVTBYMGRWNThaYzNPNUgxeEc4cXdmWDZVM25QL0Yy?= =?utf-8?B?N2hqZlI0M1pHU2lKNUlaMlFIOHZudjdoaGk3T1RlWXlwUUlYanJqM3hKOFNr?= =?utf-8?B?OXhBRG91N0tud293ajcvNE9yS3IycUlEVFdHZmo2SVM3VjFwNHZjS1FqaEFO?= =?utf-8?B?NktNVjZLWUQraGw3ZDRGUi9ZbUV5T1IzQ00rMlFPOEN3WVdkdEhQOFFDTGhF?= =?utf-8?B?NVFUR01kR2ZsRFROaDNwUnNubHoxK0dJbFZo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2l3aGxwVUJidFFlZ09PVHpINDhXV1A0cTJrUjFTY3JuK3JRdjN0?= =?utf-8?Q?5Tdj3W2JiMwg/3Pf15hHADvVI?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55c04c5a-1b8a-4a36-6a6a-08dc9e8de22b X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2024 14:05:40.4205 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gOu/I/sdr6MS/014d4ppm+G/qH6a9TLDOTwN26qSTneWUD3sIctJ0ONFgzX6wRO0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6975 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 7/7/2024 6:50 AM, Mihai Brodschi wrote: > Hi Ferruh, > > On 07/07/2024 05:12, Ferruh Yigit wrote: >> On 6/28/2024 10:01 PM, Mihai Brodschi wrote: >>> rte_pktmbuf_alloc_bulk is called by the zero-copy receiver to allocate >>> new mbufs to be provided to the sender. The allocated mbuf pointers >>> are stored in a ring, but the alloc function doesn't implement index >>> wrap-around, so it writes past the end of the array. This results in >>> memory corruption and duplicate mbufs being received. >>> >> >> Hi Mihai, >> >> I am not sure writing past the ring actually occurs. >> >> As far as I can see is to keep the ring full as much as possible, when >> initially 'head' and 'tail' are 0, it fills all ring. >> Later tails moves and emptied space filled again. So head (in modulo) is >> always just behind tail after refill. In next run, refill will only fill >> the part tail moved, and this is calculated by 'n_slots'. As this is >> only the size of the gap, starting from 'head' (with modulo) shouldn't >> pass the ring length. >> >> Do you observe this issue practically? If so can you please provide your >> backtrace and numbers that is showing how to reproduce the issue? > > The alloc function writes starting from the ring's head, but the ring's > head can be located at the end of the ring's memory buffer (ring_size - 1). > The correct behavior would be to wrap around to the start of the buffer (0), > but the alloc function has no awareness of the fact that it's writing to a > ring, so it writes to ring_size, ring_size + 1, etc. > > Let's look at the existing code: > We assume the ring size is 256 and we just received 32 packets. > The previous tail was at index 255, now it's at index 31. > The head is initially at index 255. > > head = __atomic_load_n(&ring->head, __ATOMIC_RELAXED); // head = 255 > n_slots = ring_size - head + mq->last_tail; // n_slots = 32 > > if (n_slots < 32) // not taken > goto no_free_mbufs; > > ret = rte_pktmbuf_alloc_bulk(mq->mempool, &mq->buffers[head & mask], n_slots); > // This will write 32 mbuf pointers starting at index (head & mask) = 255. > // The ring size is 256, so apart from the first one all pointers will be > // written out of bounds (index 256 .. 286, when it should be 0 .. 30). > My expectation is numbers should be like following: Initially: size = 256 head = 0 tail = 0 In first refill: n_slots = 256 head = 256 tail = 0 Subsequent run that 32 slots used: head = 256 tail = 32 n_slots = 32 rte_pktmbuf_alloc_bulk(mq, buf[head & mask], n_slots); head & mask = 0 // So it fills first 32 elements of buffer, which is inbound This will continue as above, combination of only gap filled and head masked with 'mask' provides the wrapping required. > I can reproduce a crash 100% of the time with my application, but the output > is not very helpful, since it crashes elsewhere because of mempool corruption. > Applying this patch fixes the crashes completely. > This causing always reproducible crash means existing memif zero copy Rx is broken and nobody can use it, but I am suspicions that this is the case, perhaps something special in your usecase triggering this issue. @Jakup, can you please confirm that memif Rx zero copy is tested? >>> Allocate 2x the space for the mbuf ring, so that the alloc function >>> has a contiguous array to write to, then copy the excess entries >>> to the start of the array. >>> >> >> Even issue is valid, I am not sure about solution to double to buffer >> memory, but lets confirm the issue first before discussing the solution. > > Initially, I thought about splitting the call to rte_pktmbuf_alloc_bulk in two, > but I thought that might be bad for performance if the mempool is being used > concurrently from multiple threads. > > If we want to use only one call to rte_pktmbuf_alloc_bulk, we need an array > to store the allocated mbuf pointers. This array must be of length ring_size, > since that's the maximum amount of mbufs which may be allocated in one go. > We need to copy the pointers from this array to the ring. > > If we instead allocate twice the space for the ring, we can skip copying > the pointers which were written to the ring, and only copy those that were > written outside of its bounds. > First thing comes my mind was also using two 'rte_pktmbuf_alloc_bulk()' calls. I can see why you prefer doubling the buffer size, but it comes with copying overhead. So both options comes with some overhead, not sure which one is better, although I am leaning to the first solution we should do some measurements to decide. BUT first lets agree on the problem first, before doing more work, I am not still fully convinced that original code is wrong. >>> Fixes: 43b815d88188 ("net/memif: support zero-copy slave") >>> Cc: stable@dpdk.org >>> Signed-off-by: Mihai Brodschi >>> --- >>> v2: >>> - fix email formatting >>> >>> --- >>> drivers/net/memif/rte_eth_memif.c | 10 +++++++++- >>> 1 file changed, 9 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c >>> index 16da22b5c6..3491c53cf1 100644 >>> --- a/drivers/net/memif/rte_eth_memif.c >>> +++ b/drivers/net/memif/rte_eth_memif.c >>> @@ -600,6 +600,10 @@ eth_memif_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) >>> ret = rte_pktmbuf_alloc_bulk(mq->mempool, &mq->buffers[head & mask], n_slots); >>> if (unlikely(ret < 0)) >>> goto no_free_mbufs; >>> + if (unlikely(n_slots > ring_size - (head & mask))) { >>> + rte_memcpy(mq->buffers, &mq->buffers[ring_size], >>> + (n_slots + (head & mask) - ring_size) * sizeof(struct rte_mbuf *)); >>> + } >>> >>> while (n_slots--) { >>> s0 = head++ & mask; >>> @@ -1245,8 +1249,12 @@ memif_init_queues(struct rte_eth_dev *dev) >>> } >>> mq->buffers = NULL; >>> if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) { >>> + /* >>> + * Allocate 2x ring_size to reserve a contiguous array for >>> + * rte_pktmbuf_alloc_bulk (to store allocated mbufs). >>> + */ >>> mq->buffers = rte_zmalloc("bufs", sizeof(struct rte_mbuf *) * >>> - (1 << mq->log2_ring_size), 0); >>> + (1 << (mq->log2_ring_size + 1)), 0); >>> if (mq->buffers == NULL) >>> return -ENOMEM; >>> } >> > > Apologies for sending this multiple times, I'm not familiar with mailing lists. > >