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 038AFA0C41 for ; Wed, 15 Sep 2021 20:37:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1AE34003C; Wed, 15 Sep 2021 20:37:56 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 6DB504003C for ; Wed, 15 Sep 2021 20:37:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631731074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bxEfKDfbnLUdOB3+W+eb9wU28QmKm/XH2URVaPYafMc=; b=CBdZv9D1XyCM1R1UX2/LyFzaVHycrZrt1ryJqPsbzz1TqJ6e7C0vXS94FMhK1Xz+scuscy ciMBf0sJt67f8N8595N5uvX4hl4J0Z4xNCOE+42Z/aNxEQzeWDHQc81y9xtcpNmYV7qr0T Lk0LtQxWbmp5uKNy4c3icXwkGsZbEJ4= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-99X-anF8OgKEduBB7SqqFA-1; Wed, 15 Sep 2021 14:37:53 -0400 X-MC-Unique: 99X-anF8OgKEduBB7SqqFA-1 Received: by mail-lf1-f70.google.com with SMTP id v19-20020a056512349300b003f72647edb4so1604391lfr.6 for ; Wed, 15 Sep 2021 11:37:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bxEfKDfbnLUdOB3+W+eb9wU28QmKm/XH2URVaPYafMc=; b=QJ+HFDPX8wby+psbhbREWTi9YTehW2sa6EAHFPG14EITD2NnTRwIxq9DY6wgfEL7WB DBP5RwU6UOOOvpxZa950aPdT/MQuya0FTB25Dq66yaco/VAnOmhmk4aAs0SPu7gHAHZ1 +r2LIzBFB36h/PgeIs8ynVaUSkMMPvQwRBylvnf20fZ2vV+kZ3y5/aHwbdQWH+4zwjJ5 r8lEwBCMvs41nkF8qPaXw0tomtaTU3+UdNI7/TW7/oPpSFDmQKyi1dr18T4ccdkBzPUV cqW1LTV3Ieu+GXhsp80OUI7Il03AmqPY/uW+13/VYYqwd4o55AwIWty71627HmWwpXLZ 56oQ== X-Gm-Message-State: AOAM533aMY14Y69+/H1u0+bTbFaHd4km34Qen16oMx1N2p+Opr+bnck6 Mx/8ycTIJ7p10n2DGEGds+HZ32mCJLfkl/KEkKEnDC2x8C4XGfxZP+LS2wmoaX43zuwtzxQW8I7 U5HVMTs7X9rXbwFsyPMS5MyE= X-Received: by 2002:a05:6512:3f0c:: with SMTP id y12mr1015097lfa.499.1631731071918; Wed, 15 Sep 2021 11:37:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycaC8+JWqQ12DLI1z9m3wIwk+zsytUxtSkp/fXrDezeaHyQ3NYRLqsgX0wVefb8nBhJKNm+LepdfIIEV/vDSs= X-Received: by 2002:a05:6512:3f0c:: with SMTP id y12mr1015076lfa.499.1631731071559; Wed, 15 Sep 2021 11:37:51 -0700 (PDT) MIME-Version: 1.0 References: <20210804083128.64981-1-zhihongx.peng@intel.com> In-Reply-To: <20210804083128.64981-1-zhihongx.peng@intel.com> From: David Marchand Date: Wed, 15 Sep 2021 20:37:40 +0200 Message-ID: To: Zhihong Peng Cc: "Xia, Chenbo" , Maxime Coquelin , dev , Ivan Ilchenko , dpdk stable , Christian Ehrhardt , "Xueming(Steven) Li" , Luca Boccassi , Kevin Traynor Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [DPDK] net/virtio: fix check scatter on all Rx queues X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Wed, Aug 4, 2021 at 10:36 AM wrote: > > From: Zhihong Peng > > This patch fixes the wrong way to obtain virtqueue. > The end of virtqueue cannot be judged based on whether > the array is NULL. Indeed, good catch. I can reproduce a crash with v20.11.3 which has backport of 4e8169eb0d2d. I can not see it with main: maybe due to a lucky allocation or size requested to rte_zmalloc... ? The usecase is simple, I am surprised no validation caught it. # gdb ./build/app/dpdk-testpmd -ex 'run --vdev net_virtio_user0,path=/dev/vhost-net,iface=titi,queues=3 -a 0:0:0.0 -- -i' ... Thread 1 "dpdk-testpmd" received signal SIGSEGV, Segmentation fault. virtio_rx_mem_pool_buf_size (mp=0x110429983) at ../drivers/net/virtio/virtio_ethdev.c:873 873 return rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; Missing separate debuginfos, use: yum debuginfo-install elfutils-libelf-0.182-3.el8.x86_64 libbpf-0.2.0-1.el8.x86_64 (gdb) bt #0 virtio_rx_mem_pool_buf_size (mp=0x110429983) at ../drivers/net/virtio/virtio_ethdev.c:873 #1 0x0000000000e370d1 in virtio_check_scatter_on_all_rx_queues (frame_size=1530, dev=0x1799a40 ) at ../drivers/net/virtio/virtio_ethdev.c:907 #2 virtio_mtu_set (dev=0x1799a40 , mtu=) at ../drivers/net/virtio/virtio_ethdev.c:938 #3 0x00000000008c30e5 in rte_eth_dev_set_mtu (port_id=port_id@entry=0, mtu=) at ../lib/librte_ethdev/rte_ethdev.c:3484 #4 0x00000000006a61d8 in update_jumbo_frame_offload (portid=portid@entry=0) at ../app/test-pmd/testpmd.c:3371 #5 0x00000000006a62bc in init_config_port_offloads (pid=0, socket_id=0) at ../app/test-pmd/testpmd.c:1416 #6 0x000000000061770c in init_config () at ../app/test-pmd/testpmd.c:1505 #7 main (argc=, argv=) at ../app/test-pmd/testpmd.c:3800 (gdb) f 1 #1 0x0000000000e370d1 in virtio_check_scatter_on_all_rx_queues (frame_size=1530, dev=0x1799a40 ) at ../drivers/net/virtio/virtio_ethdev.c:907 907 buf_size = virtio_rx_mem_pool_buf_size(rxvq->mpool); (gdb) p hw->max_queue_pairs $1 = 3 (gdb) p qidx $2 = 5 (gdb) p hw->vqs[0] $3 = (struct virtqueue *) 0x17ffb03c0 (gdb) p hw->vqs[2] $4 = (struct virtqueue *) 0x17ff9dcc0 (gdb) p hw->vqs[4] $5 = (struct virtqueue *) 0x17ff8acc0 (gdb) p hw->vqs[6] $6 = (struct virtqueue *) 0x17ff77cc0 (gdb) p hw->vqs[7] $7 = (struct virtqueue *) 0x0 (gdb) p hw->vqs[8] $8 = (struct virtqueue *) 0x100004ac0 (gdb) p hw->vqs[9] $9 = (struct virtqueue *) 0x17ffb1600 (gdb) p hw->vqs[10] $10 = (struct virtqueue *) 0x17ffb18c0 -- David Marchand