Skip to content
Snippets Groups Projects
  1. Mar 15, 2021
    • Jason Wang's avatar
      net: introduce qemu_receive_packet() · 705df546
      Jason Wang authored
      
      Some NIC supports loopback mode and this is done by calling
      nc->info->receive() directly which in fact suppresses the effort of
      reentrancy check that is done in qemu_net_queue_send().
      
      Unfortunately we can't use qemu_net_queue_send() here since for
      loopback there's no sender as peer, so this patch introduce a
      qemu_receive_packet() which is used for implementing loopback mode
      for a NIC with this check.
      
      NIC that supports loopback mode will be converted to this helper.
      
      This is intended to address CVE-2021-3416.
      
      Cc: Prasad J Pandit <ppandit@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      705df546
  2. Jul 28, 2020
    • Jason Wang's avatar
      net: forbid the reentrant RX · 22dc8663
      Jason Wang authored
      
      The memory API allows DMA into NIC's MMIO area. This means the NIC's
      RX routine must be reentrant. Instead of auditing all the NIC, we can
      simply detect the reentrancy and return early. The queue->delivering
      is set and cleared by qemu_net_queue_deliver() for other queue helpers
      to know whether the delivering in on going (NIC's receive is being
      called). We can check it and return early in qemu_net_queue_flush() to
      forbid reentrant RX.
      
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      22dc8663
  3. Mar 16, 2020
  4. Jan 11, 2019
    • Paolo Bonzini's avatar
      qemu/queue.h: leave head structs anonymous unless necessary · b58deb34
      Paolo Bonzini authored
      
      Most list head structs need not be given a name.  In most cases the
      name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV
      or reverse iteration, but this does not apply to lists of other kinds,
      and even for QTAILQ in practice this is only rarely needed.  In addition,
      we will soon reimplement those macros completely so that they do not
      need a name for the head struct.  So clean up everything, not giving a
      name except in the rare case where it is necessary.
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b58deb34
  5. Feb 04, 2016
    • Peter Maydell's avatar
      net: Clean up includes · 2744d920
      Peter Maydell authored
      
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-11-git-send-email-peter.maydell@linaro.org
      2744d920
  6. Oct 12, 2015
  7. Dec 19, 2014
  8. Sep 04, 2014
  9. Feb 27, 2013
    • Luigi Rizzo's avatar
      net: fix unbounded NetQueue · 7d91ddd2
      Luigi Rizzo authored
      
      In the current implementation of qemu, running without a network
      backend will cause the queue to grow unbounded when the guest is
      transmitting traffic.
      
      This patch fixes the problem by implementing bounded size NetQueue,
      used with an arbitrary limit of 10000 packets, and dropping packets
      when the queue is full _and_ the sender does not pass a callback.
      
      The second condition makes sure that we never drop packets that
      contains a callback (which would be tricky, because the producer
      expects the callback to be run when all previous packets have been
      consumed; so we cannot run it when the packet is dropped).
      
      If documentation is correct, producers that submit a callback should
      stop sending when their packet is queued, so there is no real risk
      that the queue exceeds the max size by large values.
      
      Signed-off-by: default avatarLuigi Rizzo <rizzo@iet.unipi.it>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      7d91ddd2
  10. Dec 19, 2012
  11. Sep 14, 2012
    • Stefan Hajnoczi's avatar
      net: do not report queued packets as sent · 06b5f36d
      Stefan Hajnoczi authored
      
      Net send functions have a return value where 0 means the packet has not
      been sent and will be queued.  A non-zero value means the packet was
      sent or an error caused the packet to be dropped.
      
      This patch fixes two instances where packets are queued but we return
      their size.  This causes callers to believe the packets were sent.  When
      the caller uses the async send interface this creates a real problem
      because the callback will be invoked for a packet that the caller
      believed to be already sent.  This bug can cause double-frees in the
      caller.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      06b5f36d
    • Paolo Bonzini's avatar
      net: notify iothread after flushing queue · 987a9b48
      Paolo Bonzini authored
      
      virtio-net has code to flush the queue and notify the iothread
      whenever new receive buffers are added by the guest.  That is
      fine, and indeed we need to do the same in all other drivers.
      However, notifying the iothread should be work for the network
      subsystem.  And since we are at it we can add a little smartness:
      if some of the queued packets already could not be delivered,
      there is no need to notify the iothread.
      
      Reported-by: default avatarLuigi Rizzo <rizzo@iet.unipi.it>
      Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Cc: Jan Kiszka <jan.kiszka@siemens.de>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: default avatarAmos Kong <akong@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      987a9b48
  12. Aug 01, 2012
  13. Aug 21, 2011
  14. Nov 09, 2009
  15. Oct 30, 2009
  16. Oct 27, 2009
  17. Oct 15, 2009
Loading