1. 18 12月, 2016 22 次提交
    • K
      isdn/gigaset: use designated initializers · 47941950
      Kees Cook 提交于
      Prepare to mark sensitive kernel structures for randomization by making
      sure they're using designated initializers. These were identified during
      allyesconfig builds of x86, arm, and arm64, with most initializer fixes
      extracted from grsecurity.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      47941950
    • D
      Merge branch 'virtio_net-XDP' · cd333e37
      David S. Miller 提交于
      John Fastabend says:
      
      ====================
      XDP for virtio_net
      
      This implements virtio_net for the mergeable buffers and big_packet
      modes. I tested this with vhost_net running on qemu and did not see
      any issues. For testing num_buf > 1 I added a hack to vhost driver
      to only but 100 bytes per buffer.
      
      There are some restrictions for XDP to be enabled and work well
      (see patch 3) for more details.
      
        1. GUEST_TSO{4|6} must be off
        2. MTU must be less than PAGE_SIZE
        3. queues must be available to dedicate to XDP
        4. num_bufs received in mergeable buffers must be 1
        5. big_packet mode must have all data on single page
      
      To test this I used pktgen in the hypervisor and ran the XDP sample
      programs xdp1 and xdp2 from ./samples/bpf in the host. The default
      mode that is used with these patches with Linux guest and QEMU/Linux
      hypervisor is the mergeable buffers mode. I tested this mode for 2+
      days running xdp2 without issues. Additionally I did a series of
      driver unload/load tests to check the allocate/release paths.
      
      To test the big_packets path I applied the following simple patch against
      the virtio driver forcing big_packets mode,
      
      --- a/drivers/net/virtio_net.c
      +++ b/drivers/net/virtio_net.c
      @@ -2242,7 +2242,7 @@ static int virtnet_probe(struct virtio_device *vdev)
                      vi->big_packets = true;
      
              if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF))
      -               vi->mergeable_rx_bufs = true;
      +               vi->mergeable_rx_bufs = false;
      
              if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF) ||
                  virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
      
      I then repeated the tests with xdp1 and xdp2. After letting them run
      for a few hours I called it good enough.
      
      Testing the unexpected case where virtio receives a packet across
      multiple buffers required patching the hypervisor vhost driver to
      convince it to send these unexpected packets. Then I used ping with
      the -s option to trigger the case with multiple buffers. This mode
      is not expected to be used but as MST pointed out per spec it is
      not strictly speaking illegal to generate multi-buffer packets so we
      need someway to handle these. The following patch can be used to
      generate multiple buffers,
      
      --- a/drivers/vhost/vhost.c
      +++ b/drivers/vhost/vhost.c
      @@ -1777,7 +1777,8 @@ static int translate_desc(struct vhost_virtqueue
      *vq, u64
      
                      _iov = iov + ret;
                      size = node->size - addr + node->start;
      -               _iov->iov_len = min((u64)len - s, size);
      +               printk("%s: build 100 length headers!\n", __func__);
      +               _iov->iov_len = min((u64)len - s, (u64)100);//size);
                      _iov->iov_base = (void __user *)(unsigned long)
                              (node->userspace_addr + addr - node->start);
                      s += size;
      
      The qemu command I most frequently used for testing (although I did test
      various other combinations of devices) is the following,
      
       ./x86_64-softmmu/qemu-system-x86_64              \
          -hda /var/lib/libvirt/images/Fedora-test0.img \
          -m 4096  -enable-kvm -smp 2                   \
          -netdev tap,id=hn0,queues=4,vhost=on          \
          -device virtio-net-pci,netdev=hn0,mq=on,vectors=9,guest_tso4=off,guest_tso6=off \
          -serial stdio
      
      The options 'guest_tso4=off,guest_tso6=off' are required because we
      do not support LRO with XDP at the moment.
      
      Please review any comments/feedback welcome as always.
      ====================
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cd333e37
    • J
      virtio_net: xdp, add slowpath case for non contiguous buffers · 72979a6c
      John Fastabend 提交于
      virtio_net XDP support expects receive buffers to be contiguous.
      If this is not the case we enable a slowpath to allow connectivity
      to continue but at a significan performance overhead associated with
      linearizing data. To make it painfully aware to users that XDP is
      running in a degraded mode we throw an xdp buffer error.
      
      To linearize packets we allocate a page and copy the segments of
      the data, including the header, into it. After this the page can be
      handled by XDP code flow as normal.
      
      Then depending on the return code the page is either freed or sent
      to the XDP xmit path. There is no attempt to optimize this path.
      
      This case is being handled simple as a precaution in case some
      unknown backend were to generate packets in this form. To test this
      I had to hack qemu and force it to generate these packets. I do not
      expect this case to be generated by "real" backends.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      72979a6c
    • J
      virtio_net: add XDP_TX support · 56434a01
      John Fastabend 提交于
      This adds support for the XDP_TX action to virtio_net. When an XDP
      program is run and returns the XDP_TX action the virtio_net XDP
      implementation will transmit the packet on a TX queue that aligns
      with the current CPU that the XDP packet was processed on.
      
      Before sending the packet the header is zeroed.  Also XDP is expected
      to handle checksum correctly so no checksum offload  support is
      provided.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56434a01
    • J
      virtio_net: add dedicated XDP transmit queues · 672aafd5
      John Fastabend 提交于
      XDP requires using isolated transmit queues to avoid interference
      with normal networking stack (BQL, NETDEV_TX_BUSY, etc). This patch
      adds a XDP queue per cpu when a XDP program is loaded and does not
      expose the queues to the OS via the normal API call to
      netif_set_real_num_tx_queues(). This way the stack will never push
      an skb to these queues.
      
      However virtio/vhost/qemu implementation only allows for creating
      TX/RX queue pairs at this time so creating only TX queues was not
      possible. And because the associated RX queues are being created I
      went ahead and exposed these to the stack and let the backend use
      them. This creates more RX queues visible to the network stack than
      TX queues which is worth mentioning but does not cause any issues as
      far as I can tell.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      672aafd5
    • J
      virtio_net: Add XDP support · f600b690
      John Fastabend 提交于
      This adds XDP support to virtio_net. Some requirements must be
      met for XDP to be enabled depending on the mode. First it will
      only be supported with LRO disabled so that data is not pushed
      across multiple buffers. Second the MTU must be less than a page
      size to avoid having to handle XDP across multiple pages.
      
      If mergeable receive is enabled this patch only supports the case
      where header and data are in the same buf which we can check when
      a packet is received by looking at num_buf. If the num_buf is
      greater than 1 and a XDP program is loaded the packet is dropped
      and a warning is thrown. When any_header_sg is set this does not
      happen and both header and data is put in a single buffer as expected
      so we check this when XDP programs are loaded.  Subsequent patches
      will process the packet in a degraded mode to ensure connectivity
      and correctness is not lost even if backend pushes packets into
      multiple buffers.
      
      If big packets mode is enabled and MTU/LRO conditions above are
      met then XDP is allowed.
      
      This patch was tested with qemu with vhost=on and vhost=off where
      mergeable and big_packet modes were forced via hard coding feature
      negotiation. Multiple buffers per packet was forced via a small
      test patch to vhost.c in the vhost=on qemu mode.
      Suggested-by: NShrijeet Mukherjee <shrijeet@gmail.com>
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f600b690
    • J
      net: xdp: add invalid buffer warning · f23bc46c
      John Fastabend 提交于
      This adds a warning for drivers to use when encountering an invalid
      buffer for XDP. For normal cases this should not happen but to catch
      this in virtual/qemu setups that I may not have expected from the
      emulation layer having a standard warning is useful.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f23bc46c
    • X
      sctp: sctp_transport_lookup_process should rcu_read_unlock when transport is null · 08abb795
      Xin Long 提交于
      Prior to this patch, sctp_transport_lookup_process didn't rcu_read_unlock
      when it failed to find a transport by sctp_addrs_lookup_transport.
      
      This patch is to fix it by moving up rcu_read_unlock right before checking
      transport and also to remove the out path.
      
      Fixes: 1cceda78 ("sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock")
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      08abb795
    • X
      sctp: sctp_epaddr_lookup_transport should be protected by rcu_read_lock · 5cb2cd68
      Xin Long 提交于
      Since commit 7fda702f ("sctp: use new rhlist interface on sctp transport
      rhashtable"), sctp has changed to use rhlist_lookup to look up transport, but
      rhlist_lookup doesn't call rcu_read_lock inside, unlike rhashtable_lookup_fast.
      
      It is called in sctp_epaddr_lookup_transport and sctp_addrs_lookup_transport.
      sctp_addrs_lookup_transport is always in the protection of rcu_read_lock(),
      as __sctp_lookup_association is called in rx path or sctp_lookup_association
      which are in the protection of rcu_read_lock() already.
      
      But sctp_epaddr_lookup_transport is called by sctp_endpoint_lookup_assoc, it
      doesn't call rcu_read_lock, which may cause "suspicious rcu_dereference_check
      usage' in __rhashtable_lookup.
      
      This patch is to fix it by adding rcu_read_lock in sctp_endpoint_lookup_assoc
      before calling sctp_epaddr_lookup_transport.
      
      Fixes: 7fda702f ("sctp: use new rhlist interface on sctp transport rhashtable")
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5cb2cd68
    • D
      Merge branch 'dpaa_eth-fixes' · 10a3ecf4
      David S. Miller 提交于
      Madalin Bucur says:
      
      ====================
      dpaa_eth: a couple of fixes
      
      This patch set introduces big endian accessors in the dpaa_eth driver
      making sure accesses to the QBMan HW are correct on little endian
      platforms. Removing a redundant Kconfig dependency on FSL_SOC.
      Adding myself as maintainer of the dpaa_eth driver.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      10a3ecf4
    • M
      MAINTAINERS: net: add entry for Freescale QorIQ DPAA Ethernet driver · 63f4b4b0
      Madalin Bucur 提交于
      Add record for Freescale QORIQ DPAA Ethernet driver adding myself as
      maintainer.
      Signed-off-by: NMadalin Bucur <madalin.bucur@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63f4b4b0
    • M
      708f0f4f
    • C
      dpaa_eth: use big endian accessors · 7d6f8dc0
      Claudiu Manoil 提交于
      Ensure correct access to the big endian QMan HW through proper
      accessors.
      Signed-off-by: NClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: NMadalin Bucur <madalin.bucur@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d6f8dc0
    • L
      irda: irnet: add member name to the miscdevice declaration · 616f6b40
      LABBE Corentin 提交于
      Since the struct miscdevice have many members, it is dangerous to init
      it without members name relying only on member order.
      
      This patch add member name to the init declaration.
      Signed-off-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      616f6b40
    • L
      irda: irnet: Remove unused IRNET_MAJOR define · 33de4d1b
      LABBE Corentin 提交于
      The IRNET_MAJOR define is not used, so this patch remove it.
      Signed-off-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      33de4d1b
    • L
      irnet: ppp: move IRNET_MINOR to include/linux/miscdevice.h · 24c946cc
      LABBE Corentin 提交于
      This patch move the define for IRNET_MINOR to include/linux/miscdevice.h
      It is better that all minor number definitions are in the same place.
      Signed-off-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      24c946cc
    • L
      irda: irnet: Move linux/miscdevice.h include · e2928235
      LABBE Corentin 提交于
      The only use of miscdevice is irda_ppp so no need to include
      linux/miscdevice.h for all irda files.
      This patch move the linux/miscdevice.h include to irnet_ppp.h
      Signed-off-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e2928235
    • L
      irda: irproc.c: Remove unneeded linux/miscdevice.h include · 078497a4
      LABBE Corentin 提交于
      irproc.c does not use any miscdevice so this patch remove this
      unnecessary inclusion.
      Signed-off-by: NCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      078497a4
    • D
      bpf: cgroup: annotate pointers in struct cgroup_bpf with __rcu · dcdc43d6
      Daniel Mack 提交于
      The member 'effective' in 'struct cgroup_bpf' is protected by RCU.
      Annotate it accordingly to squelch a sparse warning.
      Signed-off-by: NDaniel Mack <daniel@zonque.org>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dcdc43d6
    • D
      Merge branch 'inet_csk_get_port-and-soreusport-fixes' · 28055c97
      David S. Miller 提交于
      Tom Herbert says:
      
      ====================
      inet: Fixes for inet_csk_get_port and soreusport
      
      This patch set fixes a couple of issues I noticed while debugging our
      softlockup issue in inet_csk_get_port.
      
      - Don't allow jump into port scan in inet_csk_get_port if function
        was called with non-zero port number (looking up explicit port
        number).
      - When inet_csk_get_port is called with zero port number (ie. perform
        scan) an reuseport is set on the socket, don't match sockets that
        also have reuseport set. The intent from the user should be
        to get a new port number and then explictly bind other
        sockets to that number using soreuseport.
      
      Tested:
      
      Ran first patch on production workload with no ill effect.
      
      For second patch, ran a little listener application and first
      demonstrated that unbound sockets with soreuseport can indeed
      be bound to unrelated soreuseport sockets.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28055c97
    • T
      inet: Fix get port to handle zero port number with soreuseport set · 0643ee4f
      Tom Herbert 提交于
      A user may call listen with binding an explicit port with the intent
      that the kernel will assign an available port to the socket. In this
      case inet_csk_get_port does a port scan. For such sockets, the user may
      also set soreuseport with the intent a creating more sockets for the
      port that is selected. The problem is that the initial socket being
      opened could inadvertently choose an existing and unreleated port
      number that was already created with soreuseport.
      
      This patch adds a boolean parameter to inet_bind_conflict that indicates
      rather soreuseport is allowed for the check (in addition to
      sk->sk_reuseport). In calls to inet_bind_conflict from inet_csk_get_port
      the argument is set to true if an explicit port is being looked up (snum
      argument is nonzero), and is false if port scan is done.
      Signed-off-by: NTom Herbert <tom@herbertland.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0643ee4f
    • T
      inet: Don't go into port scan when looking for specific bind port · 9af7e923
      Tom Herbert 提交于
      inet_csk_get_port is called with port number (snum argument) that may be
      zero or nonzero. If it is zero, then the intent is to find an available
      ephemeral port number to bind to. If snum is non-zero then the caller
      is asking to allocate a specific port number. In the latter case we
      never want to perform the scan in ephemeral port range. It is
      conceivable that this can happen if the "goto again" in "tb_found:"
      is done. This patch adds a check that snum is zero before doing
      the "goto again".
      Signed-off-by: NTom Herbert <tom@herbertland.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9af7e923
  2. 17 12月, 2016 17 次提交
  3. 14 12月, 2016 1 次提交