1. 09 10月, 2015 29 次提交
  2. 08 10月, 2015 11 次提交
    • D
      Merge branch 'bpf_random32' · df718423
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      BPF/random32 updates
      
      BPF update to split the prandom state apart, and to move the
      *once helpers to the core. For details, please see individual
      patches. Given the changes and since it's in the tree for
      quite some time, net-next is a better choice in our opinion.
      
      v1 -> v2:
       - Make DO_ONCE() type-safe, remove the kvec helper. Credits
         go to Alexei Starovoitov for the __VA_ARGS__ hint, thanks!
       - Add a comment to the DO_ONCE() helper as suggested by Alexei.
       - Rework prandom_init_once() helper to the new API.
       - Keep Alexei's Acked-by on the last patch.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      df718423
    • D
      bpf: split state from prandom_u32() and consolidate {c, e}BPF prngs · 3ad00405
      Daniel Borkmann 提交于
      While recently arguing on a seccomp discussion that raw prandom_u32()
      access shouldn't be exposed to unpriviledged user space, I forgot the
      fact that SKF_AD_RANDOM extension actually already does it for some time
      in cBPF via commit 4cd3675e ("filter: added BPF random opcode").
      
      Since prandom_u32() is being used in a lot of critical networking code,
      lets be more conservative and split their states. Furthermore, consolidate
      eBPF and cBPF prandom handlers to use the new internal PRNG. For eBPF,
      bpf_get_prandom_u32() was only accessible for priviledged users, but
      should that change one day, we also don't want to leak raw sequences
      through things like eBPF maps.
      
      One thought was also to have own per bpf_prog states, but due to ABI
      reasons this is not easily possible, i.e. the program code currently
      cannot access bpf_prog itself, and copying the rnd_state to/from the
      stack scratch space whenever a program uses the prng seems not really
      worth the trouble and seems too hacky. If needed, taus113 could in such
      cases be implemented within eBPF using a map entry to keep the state
      space, or get_random_bytes() could become a second helper in cases where
      performance would not be critical.
      
      Both sides can trigger a one-time late init via prandom_init_once() on
      the shared state. Performance-wise, there should even be a tiny gain
      as bpf_user_rnd_u32() saves one function call. The PRNG needs to live
      inside the BPF core since kernels could have a NET-less config as well.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
      Cc: Chema Gonzalez <chema@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ad00405
    • D
      random32: add prandom_init_once helper for own rngs · 897ece56
      Daniel Borkmann 提交于
      Add a prandom_init_once() facility that works on the rnd_state, so that
      users that are keeping their own state independent from prandom_u32() can
      initialize their taus113 per cpu states.
      
      The motivation here is similar to net_get_random_once(): initialize the
      state as late as possible in the hope that enough entropy has been
      collected for the seeding. prandom_init_once() makes use of the recently
      introduced prandom_seed_full_state() helper and is generic enough so that
      it could also be used on fast-paths due to the DO_ONCE().
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      897ece56
    • D
      random32: add prandom_seed_full_state helper · 0dd50d1b
      Daniel Borkmann 提交于
      Factor out the full reseed handling code that populates the state
      through get_random_bytes() and runs prandom_warmup(). The resulting
      prandom_seed_full_state() will be used later on in more than the
      current __prandom_reseed() user. Fix also two minor whitespace
      issues along the way.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0dd50d1b
    • H
      once: make helper generic for calling functions once · c90aeb94
      Hannes Frederic Sowa 提交于
      Make the get_random_once() helper generic enough, so that functions
      in general would only be called once, where one user of this is then
      net_get_random_once().
      
      The only implementation specific call is to get_random_bytes(), all
      the rest of this *_once() facility would be duplicated among different
      subsystems otherwise. The new DO_ONCE() helper will be used by prandom()
      later on, but might also be useful for other scenarios/subsystems as
      well where a one-time initialization in often-called, possibly fast
      path code could occur.
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c90aeb94
    • H
      net: move net_get_random_once to lib · 46234253
      Hannes Frederic Sowa 提交于
      There's no good reason why users outside of networking should not
      be using this facility, f.e. for initializing their seeds.
      
      Therefore, make it accessible from there as get_random_once().
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      46234253
    • D
      net: Do not drop to make_route if oif is l3mdev · 28335a74
      David Ahern 提交于
      Commit deaa0a6a ("net: Lookup actual route when oif is VRF device")
      exposed a bug in __ip_route_output_key_hash for VRF devices: on FIB lookup
      failure if the oif is specified the current logic drops to make_route on
      the assumption that the route tables are wrong. For VRF/L3 master devices
      this leads to wrong dst entries and route lookups. For example:
          $ ip route ls table vrf-red
          unreachable default
          broadcast 10.2.1.0 dev eth1  proto kernel  scope link  src 10.2.1.2
          10.2.1.0/24 dev eth1  proto kernel  scope link  src 10.2.1.2
          local 10.2.1.2 dev eth1  proto kernel  scope host  src 10.2.1.2
          broadcast 10.2.1.255 dev eth1  proto kernel  scope link  src 10.2.1.2
      
          $ ip route get oif vrf-red 1.1.1.1
          1.1.1.1 dev vrf-red  src 10.0.0.2
              cache
      
      With this patch:
          $  ip route get oif vrf-red 1.1.1.1
          RTNETLINK answers: No route to host
      
      which is the correct response based on the default route
      Signed-off-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28335a74
    • D
      bpf, skb_do_redirect: clear sender_cpu before xmit · cfc81b50
      Daniel Borkmann 提交于
      Similar to commit c29390c6 ("xps: must clear sender_cpu before
      forwarding"), we also need to clear the skb->sender_cpu when moving
      from RX to TX via skb_do_redirect() due to the shared location of
      napi_id (used on RX) and sender_cpu (used on TX).
      
      Fixes: 27b29f63 ("bpf: add bpf_redirect() helper")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cfc81b50
    • A
      net: hns: fix 32-bit build warning · dfdd7230
      Arnd Bergmann 提交于
      The recently added hns driver causes a build warning in ARM
      allmodconfig builds:
      
      drivers/net/ethernet/hisilicon/hns/hnae.c: In function 'handles_show':
      drivers/net/ethernet/hisilicon/hns/hnae.c:452:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                j, (u64)h->qs[i]->io_base);
                   ^
      
      This removes the pointless cast and prints the pointer address using
      the "%p" format string in all three locations.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dfdd7230
    • J
      net: Microchip encx24j600 driver · d70e5326
      Jon Ringle 提交于
      This ethernet driver supports the Micorchip enc424j600/626j600 Ethernet
      controller over a SPI bus interface. This driver makes use of the regmap API to
      optimize access to registers by caching registers where possible.
      
      Datasheet:
      http://ww1.microchip.com/downloads/en/DeviceDoc/39935b.pdfSigned-off-by: NJon Ringle <jringle@gridpoint.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d70e5326
    • D
      Merge branch 'broadcom-iproc' · 494f8eb9
      David S. Miller 提交于
      Arun Parameswaran says:
      
      ====================
      Add support for Broadcom's iProc MDIO and Cygnus Ethernet PHY
      
      This patchset adds support for the iProc MDIO interface and the
      Broadcom Cygnus SoC's internal Ethernet PHY.
      
      The internal Ethernet PHY(s) in the Cygnus SoC's are accessed
      via the MDIO interface found in most of the iProc based chips.
      
      The patch also consolidates the common API's used by the
      Broadcom phys to a common library. Existing Broadcom phy
      drivers have been modified to use the common library API's.
      
      This patch series is based on Linux v4.3-rc1 and is avaliable in:
      https://github.com/Broadcom/cygnus-linux/tree/cygnus-net-phy-mdio-v3
      
      The Ethernet driver for the iProc family will be submitted soon,
      as will the device tree configurations for the different iProc
      family SoCs.
      
      Changes from v2:
      - Modified drivers/net/phy/Kconfig to modify the BCM_CYGNUS_PHY
        driver to 'depends on MDIO_BCM_IPROC' instead of 'select'.
      - Added github branch to the cover letter
      
      Changes from v1:
      - Updated device tree documentation for the iProc MDIO driver
        based on Florian's feedback.
      - Moved the core register defines from the Cygnus PHY driver to
        'include/linux/brcmphy.h' based on Florian's feedback.
      - Created a new patch/commit to modify the bcm7xxx phy driver
        to use the new core register defines.
      - Modified the Kconfig entry for the Broadcom PHY library to
        'tristate' instead of 'bool'
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      494f8eb9