1. 22 2月, 2019 1 次提交
  2. 07 2月, 2019 1 次提交
  3. 11 1月, 2019 1 次提交
  4. 04 12月, 2018 1 次提交
    • J
      net: drop too large packet early · 25c01bd1
      Jason Wang 提交于
      We try to detect and drop too large packet (>INT_MAX) in 1592a994
      ("net: ignore packet size greater than INT_MAX") during packet
      delivering. Unfortunately, this is not sufficient as we may hit
      another integer overflow when trying to queue such large packet in
      qemu_net_queue_append_iov():
      
      - size of the allocation may overflow on 32bit
      - packet->size is integer which may overflow even on 64bit
      
      Fixing this by moving the check to qemu_sendv_packet_async() which is
      the entrance of all networking codes and reduce the limit to
      NET_BUFSIZE to be more conservative. This works since:
      
      - For the callers that call qemu_sendv_packet_async() directly, they
        only care about if zero is returned to determine whether to prevent
        the source from producing more packets. A callback will be triggered
        if peer can accept more then source could be enabled. This is
        usually used by high speed networking implementation like virtio-net
        or netmap.
      - For the callers that call qemu_sendv_packet() that calls
        qemu_sendv_packet_async() indirectly, they often ignore the return
        value. In this case qemu will just the drop packets if peer can't
        receive.
      
      Qemu will copy the packet if it was queued. So it was safe for both
      kinds of the callers to assume the packet was sent.
      
      Since we move the check from qemu_deliver_packet_iov() to
      qemu_sendv_packet_async(), it would be safer to make
      qemu_deliver_packet_iov() static to prevent any external user in the
      future.
      
      This is a revised patch of CVE-2018-17963.
      
      Cc: qemu-stable@nongnu.org
      Cc: Li Qiang <liq3ea@163.com>
      Fixes: 1592a994 ("net: ignore packet size greater than INT_MAX")
      Reported-by: NLi Qiang <liq3ea@gmail.com>
      Reviewed-by: NLi Qiang <liq3ea@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Message-id: 20181204035347.6148-2-jasowang@redhat.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      25c01bd1
  5. 19 10月, 2018 2 次提交
  6. 25 9月, 2018 1 次提交
    • T
      net: Deprecate the "name" parameter of -net · 101625a4
      Thomas Huth 提交于
      In early times, network backends were specified by a "vlan" and "name"
      tuple. With the introduction of netdevs, the "name" was replaced by an
      "id" (which is supposed to be unique), but the "name" parameter stayed
      as an alias which could be used instead of "id". Unfortunately, we miss
      the duplication check for "name":
      
       $ qemu-system-x86_64 -net user,name=n1 -net user,name=n1
      
      ... starts without an error, while "id" correctly complains:
      
       $ qemu-system-x86_64 -net user,id=n1 -net user,id=n1
       qemu-system-x86_64: -net user,id=n1: Duplicate ID 'n1' for net
      
      Instead of trying to fix the code for the legacy "name" parameter, let's
      rather get rid of this old interface and deprecate the "name" parameter
      now - this will also be less confusing for the users in the long run.
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      101625a4
  7. 15 6月, 2018 1 次提交
  8. 14 5月, 2018 2 次提交
  9. 26 3月, 2018 1 次提交
    • G
      virtio_net: flush uncompleted TX on reset · 94b52958
      Greg Kurz 提交于
      If the backend could not transmit a packet right away for some reason,
      the packet is queued for asynchronous sending. The corresponding vq
      element is tracked in the async_tx.elem field of the VirtIONetQueue,
      for later freeing when the transmission is complete.
      
      If a reset happens before completion, virtio_net_tx_complete() will push
      async_tx.elem back to the guest anyway, and we end up with the inuse flag
      of the vq being equal to -1. The next call to virtqueue_pop() is then
      likely to fail with "Virtqueue size exceeded".
      
      This can be reproduced easily by starting a guest with an hubport backend
      that is not connected to a functional network, eg,
      
       -device virtio-net-pci,netdev=hub0 -netdev hubport,id=hub0,hubid=0
      
      and no other -netdev hubport,hubid=0 on the command line.
      
      The appropriate fix is to ensure that such an asynchronous transmission
      cannot survive a device reset. So for all queues, we first try to send
      the packet again, and eventually we purge it if the backend still could
      not deliver it.
      
      CC: qemu-stable@nongnu.org
      Reported-by: NR. Nageswara Sastry <nasastry@in.ibm.com>
      Buglink: https://github.com/open-power-host-os/qemu/issues/37Signed-off-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NR. Nageswara Sastry <nasastry@in.ibm.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      94b52958
  10. 05 3月, 2018 6 次提交
  11. 03 3月, 2018 1 次提交
  12. 09 2月, 2018 3 次提交
  13. 29 1月, 2018 1 次提交
    • T
      net: Allow hubports to connect to other netdevs · 18d65d22
      Thomas Huth 提交于
      QEMU can emulate hubs to connect NICs and netdevs. This is currently
      primarily used for the mis-named 'vlan' feature of the networking
      subsystem. Now the 'vlan' feature has been marked as deprecated, since
      its name is rather confusing and the users often rather mis-configure
      their network when trying to use it. But while the 'vlan' parameter
      should be removed at one point in time, the basic idea of emulating
      a hub in QEMU is still good: It's useful for bundling up the output of
      multiple NICs into one single l2tp netdev for example.
      
      Now to be able to use the hubport feature without 'vlan's, there is one
      missing piece: The possibility to connect a hubport to a netdev, too.
      This patch adds this possibility by introducing a new "netdev=..."
      parameter to the hubports.
      
      To bundle up the output of multiple NICs into one socket netdev, you can
      now run QEMU with these parameters for example:
      
      qemu-system-ppc64 ... -netdev socket,id=s1,connect=:11122 \
          -netdev hubport,hubid=1,id=h1,netdev=s1 \
          -netdev hubport,hubid=1,id=h2 -device e1000,netdev=h2 \
          -netdev hubport,hubid=1,id=h3 -device virtio-net-pci,netdev=h3
      
      For using the socket netdev, you have got to start another QEMU as the
      receiving side first, for example with network dumping enabled:
      
      qemu-system-x86_64 -M isapc -netdev socket,id=s0,listen=:11122 \
          -device ne2k_isa,netdev=s0 \
          -object filter-dump,id=f1,netdev=s0,file=/tmp/dump.dat
      
      After the ppc64 guest tried to boot from both NICs, you can see in the
      dump file (using Wireshark, for example), that the output of both NICs
      (the e1000 and the virtio-net-pci) has been successfully transfered
      via the socket netdev in this case.
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      18d65d22
  14. 22 12月, 2017 4 次提交
  15. 19 9月, 2017 2 次提交
    • A
      General warn report fixups · b62e39b4
      Alistair Francis 提交于
      Tidy up some of the warn_report() messages after having converted them
      to use warn_report().
      Signed-off-by: NAlistair Francis <alistair.francis@xilinx.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <9cb1d23551898c9c9a5f84da6773e99871285120.1505158760.git.alistair.francis@xilinx.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b62e39b4
    • A
      Convert multi-line fprintf() to warn_report() · 8297be80
      Alistair Francis 提交于
      Convert all the multi-line uses of fprintf(stderr, "warning:"..."\n"...
      to use warn_report() instead. This helps standardise on a single
      method of printing warnings to the user.
      
      All of the warnings were changed using these commands:
        find ./* -type f -exec sed -i \
          'N; {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N; {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N;N; {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N;N;N {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N;N;N;N {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N;N;N;N;N {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
        find ./* -type f -exec sed -i \
          'N;N;N;N;N;N;N; {s|fprintf(.*".*warning[,:] \(.*\)\\n"\(.*\));|warn_report("\1"\2);|Ig}' \
          {} +
      
      Indentation fixed up manually afterwards.
      
      Some of the lines were manually edited to reduce the line length to below
      80 charecters. Some of the lines with newlines in the middle of the
      string were also manually edit to avoid checkpatch errrors.
      
      The #include lines were manually updated to allow the code to compile.
      
      Several of the warning messages can be improved after this patch, to
      keep this patch mechanical this has been moved into a later patch.
      Signed-off-by: NAlistair Francis <alistair.francis@xilinx.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Anthony Perard <anthony.perard@citrix.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Yongbok Kim <yongbok.kim@imgtec.com>
      Cc: Cornelia Huck <cohuck@redhat.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: David Gibson <david@gibson.dropbear.id.au>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Acked-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <5def63849ca8f551630c6f2b45bcb1c482f765a6.1505158760.git.alistair.francis@xilinx.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8297be80
  16. 08 9月, 2017 1 次提交
  17. 04 9月, 2017 1 次提交
  18. 17 7月, 2017 2 次提交
  19. 23 5月, 2017 1 次提交
  20. 23 2月, 2017 1 次提交
  21. 15 2月, 2017 1 次提交
    • T
      net: Mark 'vlan' parameter as deprecated · a2dbe135
      Thomas Huth 提交于
      The 'vlan' parameter is a continuous source of confusion for the users,
      many people mix it up with the more common term VLAN (the link layer
      packet encapsulation), and even if they realize that the QEMU 'vlan' is
      rather some kind of network hub emulation, there is still a high risk
      that they configure their QEMU networking in a wrong way with this
      parameter (e.g. by hooking NICs together, so they get a 'loopback'
      between one and the other NIC).
      Thus at one point in time, we should finally get rid of the 'vlan'
      feature in QEMU. Let's do a first step in this direction by declaring
      the 'vlan' parameter as deprecated and informing the users to use the
      'netdev' parameter instead.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      a2dbe135
  22. 15 11月, 2016 1 次提交
    • D
      net: fix sending of data with -net socket, listen backend · e79cd406
      Daniel P. Berrange 提交于
      The use of -net socket,listen was broken in the following
      commit
      
        commit 16a3df40
        Author: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
        Date:   Fri May 13 15:35:19 2016 +0800
      
          net/net: Add SocketReadState for reuse codes
      
          This function is from net/socket.c, move it to net.c and net.h.
          Add SocketReadState to make others reuse net_fill_rstate().
          suggestion from jason.
      
      This refactored the state out of NetSocketState into a
      separate SocketReadState. This refactoring requires
      that a callback is provided to be triggered upon
      completion of a packet receive from the guest.
      
      The patch only registered this callback in the codepaths
      hit by -net socket,connect, not -net socket,listen. So
      as a result packets sent by the guest in the latter case
      get dropped on the floor.
      
      This bug is hidden because net_fill_rstate() silently
      does nothing if the callback is not set.
      
      This patch adds in the middle callback registration
      and also adds an assert so that QEMU aborts if there
      are any other codepaths hit which are missing the
      callback.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      e79cd406
  23. 27 9月, 2016 2 次提交
  24. 18 8月, 2016 1 次提交
  25. 20 7月, 2016 1 次提交