1. 11 11月, 2017 20 次提交
    • L
      bpf: Fix tcp_synrto_kern.c sample program · 7863f46b
      Lawrence Brakmo 提交于
      The program was returning -1 in some cases which is not allowed
      by the verifier any longer.
      
      Fixes: 390ee7e2 ("bpf: enforce return code for cgroup-bpf programs")
      Signed-off-by: NLawrence Brakmo <brakmo@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7863f46b
    • J
      tipc: improve link resiliency when rps is activated · 8d6e79d3
      Jon Maloy 提交于
      Currently, the TIPC RPS dissector is based only on the incoming packets'
      source node address, hence steering all traffic from a node to the same
      core. We have seen that this makes the links vulnerable to starvation
      and unnecessary resets when we turn down the link tolerance to very low
      values.
      
      To reduce the risk of this happening, we exempt probe and probe replies
      packets from the convergence to one core per source node. Instead, we do
      the opposite, - we try to diverge those packets across as many cores as
      possible, by randomizing the flow selector key.
      
      To make such packets identifiable to the dissector, we add a new
      'is_keepalive' bit to word 0 of the LINK_PROTOCOL header. This bit is
      set both for PROBE and PROBE_REPLY messages, and only for those.
      
      It should be noted that these packets are not part of any flow anyway,
      and only constitute a minuscule fraction of all packets sent across a
      link. Hence, there is no risk that this will affect overall performance.
      Acked-by: NYing Xue <ying.xue@windriver.com>
      Signed-off-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d6e79d3
    • D
      Merge branch 'macb-next' · 141f575f
      David S. Miller 提交于
      Michael Grzeschik says:
      
      ====================
      net: macb: add error handling on probe and
      
      This series adds more error handling to the macb driver.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      141f575f
    • M
      net: macb: add of_node_put to error paths · 66ee6a06
      Michael Grzeschik 提交于
      We add the call of_node_put(bp->phy_node) to all associated error
      paths for memory clean up.
      Signed-off-by: NMichael Grzeschik <m.grzeschik@pengutronix.de>
      Acked-by: NNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      66ee6a06
    • M
      net: macb: add of_phy_deregister_fixed_link to error paths · 9ce98140
      Michael Grzeschik 提交于
      We add the call of_phy_deregister_fixed_link to all associated
      error paths for memory clean up.
      Signed-off-by: NMichael Grzeschik <m.grzeschik@pengutronix.de>
      Acked-by: NNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ce98140
    • M
      net: mvpp2: fix GOP statistics loop start and stop conditions · e5c500eb
      Miquel Raynal 提交于
      GOP statistics from all ports of one instance of the driver are gathered
      with one work recalled in loop in a workqueue. The loop is started when
      a port is up, and stopped when a port is down. This last condition is
      obviously wrong.
      
      Fix this by having a work per port. This way, starting and stoping it
      when the port is up or down will be fine, while minimizing unnecessary
      CPU usage.
      
      Fixes: 118d6298 ("net: mvpp2: add ethtool GOP statistics")
      Reported-by: NStefan Chulski <stefanc@marvell.com>
      Signed-off-by: NMiquel Raynal <miquel.raynal@free-electrons.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e5c500eb
    • D
      Merge branch 'hns3-bug-fixes' · fc981359
      David S. Miller 提交于
      Lipeng says:
      
      ====================
      net: hns3: Bug fixes & Code improvements in HNS3 driver
      
      This patch-set introduces some bug fixes and code improvements.
      As [patch 1/2] depends on the patch {5392902d net: hns3: Consistently using
      GENMASK in hns3 driver}, which exists in net-next, not exists in net, so
      push this serise to nex-next.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc981359
    • F
      net: hns3: cleanup mac auto-negotiation state query in hclge_update_speed_duplex · c040366b
      Fuyun Liang 提交于
      When checking whether auto-negotiation is on, driver only needs to
      check the value of mac.autoneg(SW) directly, and does not need to
      query it from hardware. Because this value is always synchronized
      with the auto-negotiation state of hardware.
      
      This patch removes mac auto-negotiation state query in
      hclge_update_speed_duplex().
      
      Fixes: 46a3df9f (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
      Signed-off-by: NFuyun Liang <liangfuyun1@huawei.com>
      Signed-off-by: NLipeng <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c040366b
    • F
      net: hns3: fix a bug when getting phy address from NCL_config file · 39e2151f
      Fuyun Liang 提交于
      Driver gets phy address from NCL_config file and uses the phy address
      to initialize phydev. There are 5 bits for phy address. And C22 phy
      address has 5 bits. So 0-31 are all valid address for phy. If there
      is no phy, it will crash. Because driver always get a valid phy address.
      
      This patch fixes the phy address to 8 bits, and use 0xff to indicate
      invalid phy address.
      
      Fixes: 46a3df9f (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
      Signed-off-by: NFuyun Liang <liangfuyun1@huawei.com>
      Signed-off-by: NLipeng <lipeng321@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      39e2151f
    • D
      net: netlink: Update attr validation to require exact length for some types · 28033ae4
      David Ahern 提交于
      Attributes using NLA_U* and NLA_S* (where * is 8, 16,32 and 64) are
      expected to be an exact length. Split these data types from
      nla_attr_minlen into nla_attr_len and update validate_nla to require
      the attribute to have exact length for them.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28033ae4
    • M
      net: ipv6: sysctl to specify IPv6 ND traffic class · 2210d6b2
      Maciej Żenczykowski 提交于
      Add a per-device sysctl to specify the default traffic class to use for
      kernel originated IPv6 Neighbour Discovery packets.
      
      Currently this includes:
      
        - Router Solicitation (ICMPv6 type 133)
          ndisc_send_rs() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Neighbour Solicitation (ICMPv6 type 135)
          ndisc_send_ns() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Neighbour Advertisement (ICMPv6 type 136)
          ndisc_send_na() -> ndisc_send_skb() -> ip6_nd_hdr()
      
        - Redirect (ICMPv6 type 137)
          ndisc_send_redirect() -> ndisc_send_skb() -> ip6_nd_hdr()
      
      and if the kernel ever gets around to generating RA's,
      it would presumably also include:
      
        - Router Advertisement (ICMPv6 type 134)
          (radvd daemon could pick up on the kernel setting and use it)
      
      Interface drivers may examine the Traffic Class value and translate
      the DiffServ Code Point into a link-layer appropriate traffic
      prioritization scheme.  An example of mapping IETF DSCP values to
      IEEE 802.11 User Priority values can be found here:
      
          https://tools.ietf.org/html/draft-ietf-tsvwg-ieee-802-11
      
      The expected primary use case is to properly prioritize ND over wifi.
      
      Testing:
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        0
        jzem22:~# echo -1 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        -bash: echo: write error: Invalid argument
        jzem22:~# echo 256 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        -bash: echo: write error: Invalid argument
        jzem22:~# echo 0 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# echo 255 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        255
        jzem22:~# echo 34 > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# cat /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        34
      
        jzem22:~# echo $[0xDC] > /proc/sys/net/ipv6/conf/eth0/ndisc_tclass
        jzem22:~# tcpdump -v -i eth0 icmp6 and src host jzem22.pgc and dst host fe80::1
        tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
        IP6 (class 0xdc, hlim 255, next-header ICMPv6 (58) payload length: 24)
        jzem22.pgc > fe80::1: [icmp6 sum ok] ICMP6, neighbor advertisement,
        length 24, tgt is jzem22.pgc, Flags [solicited]
      
      (based on original change written by Erik Kline, with minor changes)
      
      v2: fix 'suspicious rcu_dereference_check() usage'
          by explicitly grabbing the rcu_read_lock.
      
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NErik Kline <ek@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2210d6b2
    • S
      net/ncsi: Don't return error on normal response · 04bad8bd
      Samuel Mendoza-Jonas 提交于
      Several response handlers return EBUSY if the data corresponding to the
      command/response pair is already set. There is no reason to return an
      error here; the channel is advertising something as enabled because we
      told it to enable it, and it's possible that the feature has been
      enabled previously.
      Signed-off-by: NSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      04bad8bd
    • S
      net/ncsi: Improve general state logging · 9ef8690b
      Samuel Mendoza-Jonas 提交于
      The NCSI driver is mostly silent which becomes a headache when trying to
      determine what has occurred on the NCSI connection. This adds additional
      logging in a few key areas such as state transitions and calling out
      certain errors more visibly.
      Signed-off-by: NSamuel Mendoza-Jonas <sam@mendozajonas.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ef8690b
    • D
      Merge branch 'bpftool-show-filenames-of-pinned-objects' · a8a6f1e4
      David S. Miller 提交于
      Prashant Bhole says:
      
      ====================
      tools: bpftool: show filenames of pinned objects
      
      This patchset adds support to show pinned objects in object details.
      
      Patch1 adds a funtionality to open a path in bpf-fs regardless of its object
      type.
      
      Patch2 adds actual functionality by scanning the bpf-fs once and adding
      object information in hash table, with object id as a key. One object may be
      associated with multiple paths because an object can be pinned multiple times
      
      Patch3 adds command line option to enable this functionality. Making it optional
      because scanning bpf-fs can be costly.
      ====================
      Acked-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      a8a6f1e4
    • P
      tools: bpftool: optionally show filenames of pinned objects · c541b734
      Prashant Bhole 提交于
      Making it optional to show file names of pinned objects because
      it scans complete bpf-fs filesystem which is costly.
      Added option -f|--bpffs. Documentation updated.
      Signed-off-by: NPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c541b734
    • P
      tools: bpftool: show filenames of pinned objects · 4990f1f4
      Prashant Bhole 提交于
      Added support to show filenames of pinned objects.
      
      For example:
      
      root@test# ./bpftool prog
      3: tracepoint  name tracepoint__irq  tag f677a7dd722299a3
          loaded_at Oct 26/11:39  uid 0
          xlated 160B  not jited  memlock 4096B  map_ids 4
          pinned /sys/fs/bpf/softirq_prog
      
      4: tracepoint  name tracepoint__irq  tag ea5dc530d00b92b6
          loaded_at Oct 26/11:39  uid 0
          xlated 392B  not jited  memlock 4096B  map_ids 4,6
      
      root@test# ./bpftool --json --pretty prog
      [{
              "id": 3,
              "type": "tracepoint",
              "name": "tracepoint__irq",
              "tag": "f677a7dd722299a3",
              "loaded_at": "Oct 26/11:39",
              "uid": 0,
              "bytes_xlated": 160,
              "jited": false,
              "bytes_memlock": 4096,
              "map_ids": [4
              ],
              "pinned": ["/sys/fs/bpf/softirq_prog"
              ]
          },{
              "id": 4,
              "type": "tracepoint",
              "name": "tracepoint__irq",
              "tag": "ea5dc530d00b92b6",
              "loaded_at": "Oct 26/11:39",
              "uid": 0,
              "bytes_xlated": 392,
              "jited": false,
              "bytes_memlock": 4096,
              "map_ids": [4,6
              ],
              "pinned": []
          }
      ]
      
      root@test# ./bpftool map
      4: hash  name start  flags 0x0
          key 4B  value 16B  max_entries 10240  memlock 1003520B
          pinned /sys/fs/bpf/softirq_map1
      5: hash  name iptr  flags 0x0
          key 4B  value 8B  max_entries 10240  memlock 921600B
      
      root@test# ./bpftool --json --pretty map
      [{
              "id": 4,
              "type": "hash",
              "name": "start",
              "flags": 0,
              "bytes_key": 4,
              "bytes_value": 16,
              "max_entries": 10240,
              "bytes_memlock": 1003520,
              "pinned": ["/sys/fs/bpf/softirq_map1"
              ]
          },{
              "id": 5,
              "type": "hash",
              "name": "iptr",
              "flags": 0,
              "bytes_key": 4,
              "bytes_value": 8,
              "max_entries": 10240,
              "bytes_memlock": 921600,
              "pinned": []
          }
      ]
      Signed-off-by: NPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4990f1f4
    • P
      tools: bpftool: open pinned object without type check · 18527196
      Prashant Bhole 提交于
      This was needed for opening any file in bpf-fs without knowing
      its object type
      Signed-off-by: NPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      18527196
    • D
      Merge branch 'BPF-directed-error-injection' · 329fca60
      David S. Miller 提交于
      Josef Bacik says:
      
      ====================
      Add the ability to do BPF directed error injection
      
      I'm sending this through Dave since it'll conflict with other BPF changes in his
      tree, but since it touches tracing as well Dave would like a review from
      somebody on the tracing side.
      
      v4->v5:
      - disallow kprobe_override programs from being put in the prog map array so we
        don't tail call into something we didn't check.  This allows us to make the
        normal path still fast without a bunch of percpu operations.
      
      v3->v4:
      - fix a build error found by kbuild test bot (I didn't wait long enough
        apparently.)
      - Added a warning message as per Daniels suggestion.
      
      v2->v3:
      - added a ->kprobe_override flag to bpf_prog.
      - added some sanity checks to disallow attaching bpf progs that have
        ->kprobe_override set that aren't for ftrace kprobes.
      - added the trace_kprobe_ftrace helper to check if the trace_event_call is a
        ftrace kprobe.
      - renamed bpf_kprobe_state to bpf_kprobe_override, fixed it so we only read this
        value in the kprobe path, and thus only write to it if we're overriding or
        clearing the override.
      
      v1->v2:
      - moved things around to make sure that bpf_override_return could really only be
        used for an ftrace kprobe.
      - killed the special return values from trace_call_bpf.
      - renamed pc_modified to bpf_kprobe_state so bpf_override_return could tell if
        it was being called from an ftrace kprobe context.
      - reworked the logic in kprobe_perf_func to take advantage of bpf_kprobe_state.
      - updated the test as per Alexei's review.
      
      - Original message -
      
      A lot of our error paths are not well tested because we have no good way of
      injecting errors generically.  Some subystems (block, memory) have ways to
      inject errors, but they are random so it's hard to get reproduceable results.
      
      With BPF we can add determinism to our error injection.  We can use kprobes and
      other things to verify we are injecting errors at the exact case we are trying
      to test.  This patch gives us the tool to actual do the error injection part.
      It is very simple, we just set the return value of the pt_regs we're given to
      whatever we provide, and then override the PC with a dummy function that simply
      returns.
      
      Right now this only works on x86, but it would be simple enough to expand to
      other architectures.  Thanks,
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      329fca60
    • J
      samples/bpf: add a test for bpf_override_return · eafb3401
      Josef Bacik 提交于
      This adds a basic test for bpf_override_return to verify it works.  We
      override the main function for mounting a btrfs fs so it'll return
      -ENOMEM and then make sure that trying to mount a btrfs fs will fail.
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eafb3401
    • J
      bpf: add a bpf_override_function helper · dd0bb688
      Josef Bacik 提交于
      Error injection is sloppy and very ad-hoc.  BPF could fill this niche
      perfectly with it's kprobe functionality.  We could make sure errors are
      only triggered in specific call chains that we care about with very
      specific situations.  Accomplish this with the bpf_override_funciton
      helper.  This will modify the probe'd callers return value to the
      specified value and set the PC to an override function that simply
      returns, bypassing the originally probed function.  This gives us a nice
      clean way to implement systematic error injection for all of our code
      paths.
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NJosef Bacik <jbacik@fb.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dd0bb688
  2. 10 11月, 2017 20 次提交