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 5920EA0C41; Wed, 15 Sep 2021 20:37:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A28E4068F; Wed, 15 Sep 2021 20:37:58 +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 601394003C for ; Wed, 15 Sep 2021 20:37:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631731075; 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=dcWQ9/8+4rnE93kaMMAqguebP2hw2Npiy0/VZzRTOtE2nnB0W4tcFqH0Rc2TL8ORTrg+2B HWy8+VsxbNnZm9ukP17nQ0XoibIHjiip7HoRW1vk0evwb2gyVvXo158t4YQst11VjjGAao U3VfVdYNwYQ+1EGymm7/mim0GieaVvY= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-597-QVPaM43nOr6rrZx0j8yZHw-1; Wed, 15 Sep 2021 14:37:53 -0400 X-MC-Unique: QVPaM43nOr6rrZx0j8yZHw-1 Received: by mail-lf1-f69.google.com with SMTP id s28-20020a056512203c00b003f42015e912so1598223lfs.4 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=sNKwoL3AOWl2+bm94Txp4QkXymKrGtHEsrN1dwlchuYz18CRNf9FQjHBs3oUkHrr2N e5EuZSRUuJOXLYt7TnKsKOgXdq+ShNLhbnCrf1UDGxW2yiHXr+wVxyLGr75sfGs8l9UD Xd0i1am8X9ImVSaCbUjmaX527NF4HiwDFpV+oYQjsCt9xrjiojI13ISBFEg8RSEWk5N6 Posb5I1YP1I0LHF70FSQ7afEVU+2TlGCUCGrRmQOl8eMwLlKKFL7UKW57iqRwxRKivEM r8JVqavD/l6EYcsyCBlSLKh26nOTgVyIHOR3WL2i/SopqXiA8kgnfiWTjn409chb9r8l uqew== X-Gm-Message-State: AOAM532vbvmQwmyb2BjKsMfSnuu+eYQInMNPreoNWPxk9w3si90mRzj5 XSSlBekNUCnqiMToWgTHs2xHhwSHJ5GoMn9+mUQ5L+L2ogvouxLpveW5vdRJptD8wpn3lbHQo2h RTIL3704rKHtvmbYSub0= X-Received: by 2002:a05:6512:3f0c:: with SMTP id y12mr1015081lfa.499.1631731071755; 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-dev] [dpdk-stable] [DPDK] net/virtio: fix check scatter on all Rx queues 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 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