1. 15 1月, 2018 3 次提交
  2. 13 1月, 2018 7 次提交
    • A
      Merge branch 'error-injection' · fdde5f3b
      Alexei Starovoitov 提交于
      Masami Hiramatsu says:
      
      ====================
      Here are the 5th version of patches to moving error injection
      table from kprobes. This version fixes a bug and update
      fail-function to support multiple function error injection.
      
      Here is the previous version:
      
      https://patchwork.ozlabs.org/cover/858663/
      
      Changes in v5:
       - [3/5] Fix a bug that within_error_injection returns false always.
       - [5/5] Update to support multiple function error injection.
      
      Thank you,
      ====================
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      fdde5f3b
    • M
      error-injection: Support fault injection framework · 4b1a29a7
      Masami Hiramatsu 提交于
      Support in-kernel fault-injection framework via debugfs.
      This allows you to inject a conditional error to specified
      function using debugfs interfaces.
      
      Here is the result of test script described in
      Documentation/fault-injection/fault-injection.txt
      
        ===========
        # ./test_fail_function.sh
        1+0 records in
        1+0 records out
        1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0227404 s, 46.1 MB/s
        btrfs-progs v4.4
        See http://btrfs.wiki.kernel.org for more information.
      
        Label:              (null)
        UUID:               bfa96010-12e9-4360-aed0-42eec7af5798
        Node size:          16384
        Sector size:        4096
        Filesystem size:    1001.00MiB
        Block group profiles:
          Data:             single            8.00MiB
          Metadata:         DUP              58.00MiB
          System:           DUP              12.00MiB
        SSD detected:       no
        Incompat features:  extref, skinny-metadata
        Number of devices:  1
        Devices:
           ID        SIZE  PATH
            1  1001.00MiB  /dev/loop2
      
        mount: mount /dev/loop2 on /opt/tmpmnt failed: Cannot allocate memory
        SUCCESS!
        ===========
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      4b1a29a7
    • M
      error-injection: Add injectable error types · 663faf9f
      Masami Hiramatsu 提交于
      Add injectable error types for each error-injectable function.
      
      One motivation of error injection test is to find software flaws,
      mistakes or mis-handlings of expectable errors. If we find such
      flaws by the test, that is a program bug, so we need to fix it.
      
      But if the tester miss input the error (e.g. just return success
      code without processing anything), it causes unexpected behavior
      even if the caller is correctly programmed to handle any errors.
      That is not what we want to test by error injection.
      
      To clarify what type of errors the caller must expect for each
      injectable function, this introduces injectable error types:
      
       - EI_ETYPE_NULL : means the function will return NULL if it
      		    fails. No ERR_PTR, just a NULL.
       - EI_ETYPE_ERRNO : means the function will return -ERRNO
      		    if it fails.
       - EI_ETYPE_ERRNO_NULL : means the function will return -ERRNO
      		       (ERR_PTR) or NULL.
      
      ALLOW_ERROR_INJECTION() macro is expanded to get one of
      NULL, ERRNO, ERRNO_NULL to record the error type for
      each function. e.g.
      
       ALLOW_ERROR_INJECTION(open_ctree, ERRNO)
      
      This error types are shown in debugfs as below.
      
        ====
        / # cat /sys/kernel/debug/error_injection/list
        open_ctree [btrfs]	ERRNO
        io_ctl_init [btrfs]	ERRNO
        ====
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      663faf9f
    • M
      error-injection: Separate error-injection from kprobe · 540adea3
      Masami Hiramatsu 提交于
      Since error-injection framework is not limited to be used
      by kprobes, nor bpf. Other kernel subsystems can use it
      freely for checking safeness of error-injection, e.g.
      livepatch, ftrace etc.
      So this separate error-injection framework from kprobes.
      
      Some differences has been made:
      
      - "kprobe" word is removed from any APIs/structures.
      - BPF_ALLOW_ERROR_INJECTION() is renamed to
        ALLOW_ERROR_INJECTION() since it is not limited for BPF too.
      - CONFIG_FUNCTION_ERROR_INJECTION is the config item of this
        feature. It is automatically enabled if the arch supports
        error injection feature for kprobe or ftrace etc.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      540adea3
    • M
      tracing/kprobe: bpf: Compare instruction pointer with original one · 66665ad2
      Masami Hiramatsu 提交于
      Compare instruction pointer with original one on the
      stack instead using per-cpu bpf_kprobe_override flag.
      
      This patch also consolidates reset_current_kprobe() and
      preempt_enable_no_resched() blocks. Those can be done
      in one place.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      66665ad2
    • M
      tracing/kprobe: bpf: Check error injectable event is on function entry · b4da3340
      Masami Hiramatsu 提交于
      Check whether error injectable event is on function entry or not.
      Currently it checks the event is ftrace-based kprobes or not,
      but that is wrong. It should check if the event is on the entry
      of target function. Since error injection will override a function
      to just return with modified return value, that operation must
      be done before the target function starts making stackframe.
      
      As a side effect, bpf error injection is no need to depend on
      function-tracer. It can work with sw-breakpoint based kprobe
      events too.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Reviewed-by: NJosef Bacik <jbacik@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      b4da3340
    • J
      bpf: simplify xdp_convert_ctx_access for xdp_rxq_info · daaf24c6
      Jesper Dangaard Brouer 提交于
      As pointed out by Daniel Borkmann, using bpf_target_off() is not
      necessary for xdp_rxq_info when extracting queue_index and
      ifindex, as these members are u32 like BPF_W.
      
      Also fix trivial spelling mistake introduced in same commit.
      
      Fixes: 02dd3291 ("bpf: finally expose xdp_rxq_info to XDP bpf-programs")
      Reported-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      daaf24c6
  3. 12 1月, 2018 22 次提交
  4. 11 1月, 2018 8 次提交
    • G
      cxgb4: implement ndo_features_check · 4621ffd6
      Ganesh Goudar 提交于
      Signed-off-by: NGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4621ffd6
    • G
      cxgb4: add support for vxlan segmentation offload · d0a1299c
      Ganesh Goudar 提交于
      add changes to t4_eth_xmit to enable vxlan segmentation
      offload support.
      
      Original work by: Santosh Rastapur <santosh@chelsio.com>
      Signed-off-by: NGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0a1299c
    • G
      cxgb4: implement udp tunnel callbacks · 846eac3f
      Ganesh Goudar 提交于
      Implement ndo_udp_tunnel_add and ndo_udp_tunnel_del
      to support vxlan tunnelling.
      
      Original work by: Santosh Rastapur <santosh@chelsio.com>
      Signed-off-by: NGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      846eac3f
    • G
      cxgb4: add data structures to support vxlan · ef0fd85a
      Ganesh Goudar 提交于
      Add data structures and macros to be used in vxlan
      offload.
      
      Original work by: Santosh Rastapur <santosh@chelsio.com>
      Signed-off-by: NGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef0fd85a
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · cbd0a6a2
      Linus Torvalds 提交于
      Pull vfs regression fix from Al Viro/
      
      Fix a leak in socket() introduced by commit 8e1611e2 ("make
      sock_alloc_file() do sock_release() on failures").
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        Fix a leak in socket(2) when we fail to allocate a file descriptor.
      cbd0a6a2
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 64fce444
      Linus Torvalds 提交于
      Pull networking fixes from David Miller:
      
       1) BPF speculation prevention and BPF_JIT_ALWAYS_ON, from Alexei
          Starovoitov.
      
       2) Revert dev_get_random_name() changes as adjust the error code
          returns seen by userspace definitely breaks stuff.
      
       3) Fix TX DMA map/unmap on older iwlwifi devices, from Emmanuel
          Grumbach.
      
       4) From wrong AF family when requesting sock diag modules, from Andrii
          Vladyka.
      
       5) Don't add new ipv6 routes attached to the null_entry, from Wei Wang.
      
       6) Some SCTP sockopt length fixes from Marcelo Ricardo Leitner.
      
       7) Don't leak when removing VLAN ID 0, from Cong Wang.
      
       8) Hey there's a potential leak in ipv6_make_skb() too, from Eric
          Dumazet.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (27 commits)
        ipv6: sr: fix TLVs not being copied using setsockopt
        ipv6: fix possible mem leaks in ipv6_make_skb()
        mlxsw: spectrum_qdisc: Don't use variable array in mlxsw_sp_tclass_congestion_enable
        mlxsw: pci: Wait after reset before accessing HW
        nfp: always unmask aux interrupts at init
        8021q: fix a memory leak for VLAN 0 device
        of_mdio: avoid MDIO bus removal when a PHY is missing
        caif_usb: use strlcpy() instead of strncpy()
        doc: clarification about setting SO_ZEROCOPY
        net: gianfar_ptp: move set_fipers() to spinlock protecting area
        sctp: make use of pre-calculated len
        sctp: add a ceiling to optlen in some sockopts
        sctp: GFP_ATOMIC is not needed in sctp_setsockopt_events
        bpf: introduce BPF_JIT_ALWAYS_ON config
        bpf: avoid false sharing of map refcount with max_entries
        ipv6: remove null_entry before adding default route
        SolutionEngine771x: add Ether TSU resource
        SolutionEngine771x: fix Ether platform data
        docs-rst: networking: wire up msg_zerocopy
        net: ipv4: emulate READ_ONCE() on ->hdrincl bit-field in raw_sendmsg()
        ...
      64fce444
    • J
      samples/bpf: xdp2skb_meta shows transferring info from XDP to SKB · 36e04a2d
      Jesper Dangaard Brouer 提交于
      Creating a bpf sample that shows howto use the XDP 'data_meta'
      infrastructure, created by Daniel Borkmann.  Very few drivers support
      this feature, but I wanted a functional sample to begin with, when
      working on adding driver support.
      
      XDP data_meta is about creating a communication channel between BPF
      programs.  This can be XDP tail-progs, but also other SKB based BPF
      hooks, like in this case the TC clsact hook. In this sample I show
      that XDP can store info named "mark", and TC/clsact chooses to use
      this info and store it into the skb->mark.
      
      It is a bit annoying that XDP and TC samples uses different tools/libs
      when attaching their BPF hooks.  As the XDP and TC programs need to
      cooperate and agree on a struct-layout, it is best/easiest if the two
      programs can be contained within the same BPF restricted-C file.
      
      As the bpf-loader, I choose to not use bpf_load.c (or libbpf), but
      instead wrote a bash shell scripted named xdp2skb_meta.sh, which
      demonstrate howto use the iproute cmdline tools 'tc' and 'ip' for
      loading BPF programs.  To make it easy for first time users, the shell
      script have command line parsing, and support --verbose and --dry-run
      mode, if you just want to see/learn the tc+ip command syntax:
      
       # ./xdp2skb_meta.sh --dev ixgbe2 --dry-run
       # Dry-run mode: enable VERBOSE and don't call TC+IP
       tc qdisc del dev ixgbe2 clsact
       tc qdisc add dev ixgbe2 clsact
       tc filter add dev ixgbe2 ingress prio 1 handle 1 bpf da obj ./xdp2skb_meta_kern.o sec tc_mark
       # Flush XDP on device: ixgbe2
       ip link set dev ixgbe2 xdp off
       ip link set dev ixgbe2 xdp obj ./xdp2skb_meta_kern.o sec xdp_mark
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      36e04a2d
    • A
      Fix a leak in socket(2) when we fail to allocate a file descriptor. · ce4bb04c
      Al Viro 提交于
      Got broken by "make sock_alloc_file() do sock_release() on failures" -
      cleanup after sock_map_fd() failure got pulled all the way into
      sock_alloc_file(), but it used to serve the case when sock_map_fd()
      failed *before* getting to sock_alloc_file() as well, and that got
      lost.  Trivial to fix, fortunately.
      
      Fixes: 8e1611e2 (make sock_alloc_file() do sock_release() on failures)
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      ce4bb04c