From patchwork Mon Dec 3 10:06:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 1006757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437gdr4m5tz9s7W for ; Mon, 3 Dec 2018 21:07:12 +1100 (AEDT) Received: from localhost ([::1]:47699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTl8A-0003wl-5C for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2018 05:07:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTl7R-0003sW-Nu for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:06:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTl7M-0004Rc-Hp for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:06:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTl7M-0004R7-Ct for qemu-devel@nongnu.org; Mon, 03 Dec 2018 05:06:20 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E18488313; Mon, 3 Dec 2018 10:06:19 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-56.pek2.redhat.com [10.72.12.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 769C9600C7; Mon, 3 Dec 2018 10:06:10 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 3 Dec 2018 18:06:04 +0800 Message-Id: <20181203100608.28538-1-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 03 Dec 2018 10:06:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH V4 for 3.1 0/4] Fix possible OOB during queuing packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, mst@redhat.com, liq3ea@163.com, Jason Wang , liq3ea@gmail.com, ppandit@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hi: This series tries to fix a possible OOB during queueing packets through qemu_net_queue_append_iov(). This could happen when it tries to queue a packet whose size is larger than INT_MAX which may lead integer overflow. We've fixed similar issue in the past during qemu_net_queue_deliver_iov() by ignoring large packets there. Let's just move the check earlier to qemu_sendv_packet_async() and reduce the limitation to NET_BUFSIZE. A simple qtest were also added this. Please review. Thanks Changes from V1: - slient compiling warnings Changes from V2: - annotate pci_test_start() with GCC_FMT_ATTR() - drop intermediate cmd string variable Jason Wang (4): net: drop too large packet early virtio-net-test: accept variable length argument in pci_test_start() virtio-net-test: remove unused macro virtio-net-test: add large tx buffer test net/net.c | 13 +++++---- tests/virtio-net-test.c | 62 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 13 deletions(-)