1. 10 Jun, 2017 3 commits
    • David S. Miller's avatar
      Merge branch 'bnx2x-Fix-malicious-VFs-indication' · d9a8d6a1
      David S. Miller authored
      Yuval Mintz says:
      
      ====================
      bnx2x: Fix malicious VFs indication
      
      It was discovered that for a VF there's a simple [yet uncommon] scenario
      which would cause device firmware to declare that VF as malicious -
      Add a vlan interface on top of a VF and disable txvlan offloading for
      that VF [causing VF to transmit packets where vlan is on payload].
      
      Patch #1 corrects driver transmission to prevent this issue.
      Patch #2 is a by-product correcting PF behavior once a VF is declared
      malicious.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9a8d6a1
    • Mintz, Yuval's avatar
      bnx2x: Don't post statistics to malicious VFs · 35238822
      Mintz, Yuval authored
      Once firmware indicates that a given VF is malicious and until
      that VF passes an FLR all bets are off - PF can't know anything
      is happening to the VF [since VF can't communicate anything to its PF].
      But PF is currently still periodically asking device to collect
      statistics for the VF which might in turn fill logs by IOMMU blocking
      memory access done by the VF's PCI function [in the case VF has unmapped
      its buffers].
      Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      35238822
    • Mintz, Yuval's avatar
      bnx2x: Allow vfs to disable txvlan offload · 92f85f05
      Mintz, Yuval authored
      VF clients are configured as enforced, meaning firmware is validating
      the correctness of their ethertype/vid during transmission.
      Once txvlan is disabled, VF would start getting SKBs for transmission
      here vlan is on the payload - but it'll pass the packet's ethertype
      instead of the vid, leading to firmware declaring it as malicious.
      Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      92f85f05
  2. 09 Jun, 2017 14 commits
  3. 08 Jun, 2017 21 commits
  4. 07 Jun, 2017 2 commits
    • David S. Miller's avatar
      net: Fix inconsistent teardown and release of private netdev state. · cf124db5
      David S. Miller authored
      Network devices can allocate reasources and private memory using
      netdev_ops->ndo_init().  However, the release of these resources
      can occur in one of two different places.
      
      Either netdev_ops->ndo_uninit() or netdev->destructor().
      
      The decision of which operation frees the resources depends upon
      whether it is necessary for all netdev refs to be released before it
      is safe to perform the freeing.
      
      netdev_ops->ndo_uninit() presumably can occur right after the
      NETDEV_UNREGISTER notifier completes and the unicast and multicast
      address lists are flushed.
      
      netdev->destructor(), on the other hand, does not run until the
      netdev references all go away.
      
      Further complicating the situation is that netdev->destructor()
      almost universally does also a free_netdev().
      
      This creates a problem for the logic in register_netdevice().
      Because all callers of register_netdevice() manage the freeing
      of the netdev, and invoke free_netdev(dev) if register_netdevice()
      fails.
      
      If netdev_ops->ndo_init() succeeds, but something else fails inside
      of register_netdevice(), it does call ndo_ops->ndo_uninit().  But
      it is not able to invoke netdev->destructor().
      
      This is because netdev->destructor() will do a free_netdev() and
      then the caller of register_netdevice() will do the same.
      
      However, this means that the resources that would normally be released
      by netdev->destructor() will not be.
      
      Over the years drivers have added local hacks to deal with this, by
      invoking their destructor parts by hand when register_netdevice()
      fails.
      
      Many drivers do not try to deal with this, and instead we have leaks.
      
      Let's close this hole by formalizing the distinction between what
      private things need to be freed up by netdev->destructor() and whether
      the driver needs unregister_netdevice() to perform the free_netdev().
      
      netdev->priv_destructor() performs all actions to free up the private
      resources that used to be freed by netdev->destructor(), except for
      free_netdev().
      
      netdev->needs_free_netdev is a boolean that indicates whether
      free_netdev() should be done at the end of unregister_netdevice().
      
      Now, register_netdevice() can sanely release all resources after
      ndo_ops->ndo_init() succeeds, by invoking both ndo_ops->ndo_uninit()
      and netdev->priv_destructor().
      
      And at the end of unregister_netdevice(), we invoke
      netdev->priv_destructor() and optionally call free_netdev().
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf124db5
    • Daniel Borkmann's avatar
      bpf, arm64: use separate register for state in stxr · 7005cade
      Daniel Borkmann authored
      Will reported that in BPF_XADD we must use a different register in stxr
      instruction for the status flag due to otherwise CONSTRAINED UNPREDICTABLE
      behavior per architecture. Reference manual says [1]:
      
        If s == t, then one of the following behaviors must occur:
      
         * The instruction is UNDEFINED.
         * The instruction executes as a NOP.
         * The instruction performs the store to the specified address, but
           the value stored is UNKNOWN.
      
      Thus, use a different temporary register for the status flag to fix it.
      
      Disassembly extract from test 226/STX_XADD_DW from test_bpf.ko:
      
        [...]
        0000003c:  c85f7d4b  ldxr x11, [x10]
        00000040:  8b07016b  add x11, x11, x7
        00000044:  c80c7d4b  stxr w12, x11, [x10]
        00000048:  35ffffac  cbnz w12, 0x0000003c
        [...]
      
        [1] https://static.docs.arm.com/ddi0487/b/DDI0487B_a_armv8_arm.pdf, p.6132
      
      Fixes: 85f68fe8 ("bpf, arm64: implement jiting of BPF_XADD")
      Reported-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7005cade