Skip to content
  1. Jul 16, 2019
    • Ilya Leoshkevich's avatar
      selftests/bpf: make directory prerequisites order-only · e46fc22e
      Ilya Leoshkevich authored
      
      
      When directories are used as prerequisites in Makefiles, they can cause
      a lot of unnecessary rebuilds, because a directory is considered changed
      whenever a file in this directory is added, removed or modified.
      
      If the only thing a target is interested in is the existence of the
      directory it depends on, which is the case for selftests/bpf, this
      directory should be specified as an order-only prerequisite: it would
      still be created in case it does not exist, but it would not trigger a
      rebuild of a target in case it's considered changed.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e46fc22e
    • Ilya Leoshkevich's avatar
      selftests/bpf: fix attach_probe on s390 · 025c0c09
      Ilya Leoshkevich authored
      
      
      attach_probe test fails, because it cannot install a kprobe on a
      non-existent sys_nanosleep symbol.
      
      Use the correct symbol name for the nanosleep syscall on 64-bit s390.
      Don't bother adding one for 31-bit mode, since tests are compiled only
      in 64-bit mode.
      
      Fixes: 1e8611bb ("selftests/bpf: add kprobe/uprobe selftests")
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      025c0c09
    • Daniel Borkmann's avatar
      Merge branch 'bpf-btf-size-verification-fix' · 896bcc90
      Daniel Borkmann authored
      
      
      Andrii Nakryiko says:
      
      ====================
      BTF size resolution logic isn't always resolving type size correctly, leading
      to erroneous map creation failures due to value size mismatch.
      
      This patch set:
      1. fixes the issue (patch #1);
      2. adds tests for trickier cases (patch #2);
      3. and converts few test cases utilizing BTF-defined maps, that previously
         couldn't use typedef'ed arrays due to kernel bug (patch #3).
      ====================
      
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      896bcc90
    • Andrii Nakryiko's avatar
      selftests/bpf: use typedef'ed arrays as map values · 8981e56f
      Andrii Nakryiko authored
      
      
      Convert few tests that couldn't use typedef'ed arrays due to kernel bug.
      
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      8981e56f
    • Andrii Nakryiko's avatar
      selftests/bpf: add trickier size resolution tests · dd13f3ca
      Andrii Nakryiko authored
      
      
      Add more BTF tests, validating that size resolution logic is correct in
      few trickier cases.
      
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      dd13f3ca
    • Andrii Nakryiko's avatar
      bpf: fix BTF verifier size resolution logic · 1acc5d5c
      Andrii Nakryiko authored
      
      
      BTF verifier has a size resolution bug which in some circumstances leads to
      invalid size resolution for, e.g., TYPEDEF modifier.  This happens if we have
      [1] PTR -> [2] TYPEDEF -> [3] ARRAY, in which case due to being in pointer
      context ARRAY size won't be resolved (because for pointer it doesn't matter, so
      it's a sink in pointer context), but it will be permanently remembered as zero
      for TYPEDEF and TYPEDEF will be marked as RESOLVED. Eventually ARRAY size will
      be resolved correctly, but TYPEDEF resolved_size won't be updated anymore.
      This, subsequently, will lead to erroneous map creation failure, if that
      TYPEDEF is specified as either key or value, as key_size/value_size won't
      correspond to resolved size of TYPEDEF (kernel will believe it's zero).
      
      Note, that if BTF was ordered as [1] ARRAY <- [2] TYPEDEF <- [3] PTR, this
      won't be a problem, as by the time we get to TYPEDEF, ARRAY's size is already
      calculated and stored.
      
      This bug manifests itself in rejecting BTF-defined maps that use array
      typedef as a value type:
      
      typedef int array_t[16];
      
      struct {
          __uint(type, BPF_MAP_TYPE_ARRAY);
          __type(value, array_t); /* i.e., array_t *value; */
      } test_map SEC(".maps");
      
      The fix consists on not relying on modifier's resolved_size and instead using
      modifier's resolved_id (type ID for "concrete" type to which modifier
      eventually resolves) and doing size determination for that resolved type. This
      allow to preserve existing "early DFS termination" logic for PTR or
      STRUCT_OR_ARRAY contexts, but still do correct size determination for modifier
      types.
      
      Fixes: eb3f595d ("bpf: btf: Validate type reference")
      Cc: Martin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      1acc5d5c
  2. Jul 12, 2019
    • Ilya Leoshkevich's avatar
      selftests/bpf: fix compiling loop{1, 2, 3}.c on s390 · af3c24e0
      Ilya Leoshkevich authored
      
      
      Use PT_REGS_RC(ctx) instead of ctx->rax, which is not present on s390.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarStanislav Fomichev <sdf@google.com>
      Tested-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      af3c24e0
    • Ilya Leoshkevich's avatar
      selftests/bpf: make PT_REGS_* work in userspace · 7cd04535
      Ilya Leoshkevich authored
      
      
      Right now, on certain architectures, these macros are usable only with
      kernel headers. This patch makes it possible to use them with userspace
      headers and, as a consequence, not only in BPF samples, but also in BPF
      selftests.
      
      On s390, provide the forward declaration of struct pt_regs and cast it
      to user_pt_regs in PT_REGS_* macros. This is necessary, because instead
      of the full struct pt_regs, s390 exposes only its first member
      user_pt_regs to userspace, and bpf_helpers.h is used with both userspace
      (in selftests) and kernel (in samples) headers. It was added in commit
      466698e6 ("s390/bpf: correct broken uapi for
      BPF_PROG_TYPE_PERF_EVENT program type").
      
      Ditto on arm64.
      
      On x86, provide userspace versions of PT_REGS_* macros. Unlike s390 and
      arm64, x86 provides struct pt_regs to both userspace and kernel, however,
      with different member names.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Reviewed-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      7cd04535
    • Ilya Leoshkevich's avatar
      selftests/bpf: fix s930 -> s390 typo · 05c2dc17
      Ilya Leoshkevich authored
      
      
      Also check for __s390__ instead of __s390x__, just in case bpf_helpers.h
      is ever used by 32-bit userspace.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Reviewed-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      05c2dc17
    • Ilya Leoshkevich's avatar
      selftests/bpf: compile progs with -D__TARGET_ARCH_$(SRCARCH) · 748e50c1
      Ilya Leoshkevich authored
      
      
      This opens up the possibility of accessing registers in an
      arch-independent way.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Reviewed-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      748e50c1
    • Ilya Leoshkevich's avatar
      selftests/bpf: do not ignore clang failures · 9cae4ace
      Ilya Leoshkevich authored
      
      
      When compiling an eBPF prog fails, make still returns 0, because
      failing clang command's output is piped to llc and therefore its
      exit status is ignored.
      
      When clang fails, pipe the string "clang failed" to llc. This will make
      llc fail with an informative error message. This solution was chosen
      over using pipefail, having separate targets or getting rid of llc
      invocation due to its simplicity.
      
      In addition, pull Kbuild.include in order to get .DELETE_ON_ERROR target,
      which would cause partial .o files to be removed.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      9cae4ace
    • Daniel T. Lee's avatar
      tools: bpftool: add raw_tracepoint_writable prog type to header · 216b65fb
      Daniel T. Lee authored
      
      
      From commit 9df1c28b ("bpf: add writable context for raw tracepoints"),
      a new type of BPF_PROG, RAW_TRACEPOINT_WRITABLE has been added.
      
      Since this BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE is not listed at
      bpftool's header, it causes a segfault when executing 'bpftool feature'.
      
      This commit adds BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE entry to
      prog_type_name enum, and will eventually fixes the segfault issue.
      
      Fixes: 9df1c28b ("bpf: add writable context for raw tracepoints")
      Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      216b65fb
    • Gustavo A. R. Silva's avatar
      bpf: verifier: avoid fall-through warnings · ed4ed404
      Gustavo A. R. Silva authored
      
      
      In preparation to enabling -Wimplicit-fallthrough, this patch silences
      the following warning:
      
      kernel/bpf/verifier.c: In function ‘check_return_code’:
      kernel/bpf/verifier.c:6106:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
         if (env->prog->expected_attach_type == BPF_CGROUP_UDP4_RECVMSG ||
            ^
      kernel/bpf/verifier.c:6109:2: note: here
        case BPF_PROG_TYPE_CGROUP_SKB:
        ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      Notice that is much clearer to explicitly add breaks in each case
      statement (that actually contains some code), rather than letting
      the code to fall through.
      
      This patch is part of the ongoing efforts to enable
      -Wimplicit-fallthrough.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      ed4ed404
    • Ilya Leoshkevich's avatar
      selftests/bpf: fix bpf_target_sparc check · 59d82657
      Ilya Leoshkevich authored
      
      
      bpf_helpers.h fails to compile on sparc: the code should be checking
      for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.
      
      Also change #ifdef bpf_target_powerpc to #if defined() for consistency.
      
      Signed-off-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      59d82657
    • Ilya Maximets's avatar
      xdp: fix potential deadlock on socket mutex · 5464c3a0
      Ilya Maximets authored
      
      
      There are 2 call chains:
      
        a) xsk_bind --> xdp_umem_assign_dev
        b) unregister_netdevice_queue --> xsk_notifier
      
      with the following locking order:
      
        a) xs->mutex --> rtnl_lock
        b) rtnl_lock --> xdp.lock --> xs->mutex
      
      Different order of taking 'xs->mutex' and 'rtnl_lock' could produce a
      deadlock here. Fix that by moving the 'rtnl_lock' before 'xs->lock' in
      the bind call chain (a).
      
      Reported-by: default avatar <syzbot+bf64ec93de836d7f4c2c@syzkaller.appspotmail.com>
      Fixes: 455302d1 ("xdp: fix hang while unregistering device bound to xdp socket")
      Signed-off-by: default avatarIlya Maximets <i.maximets@samsung.com>
      Acked-by: default avatarJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      5464c3a0
    • Ilya Maximets's avatar
      xdp: fix possible cq entry leak · 67571640
      Ilya Maximets authored
      
      
      Completion queue address reservation could not be undone.
      In case of bad 'queue_id' or skb allocation failure, reserved entry
      will be leaked reducing the total capacity of completion queue.
      
      Fix that by moving reservation to the point where failure is not
      possible. Additionally, 'queue_id' checking moved out from the loop
      since there is no point to check it there.
      
      Fixes: 35fcde7f ("xsk: support for Tx")
      Signed-off-by: default avatarIlya Maximets <i.maximets@samsung.com>
      Acked-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Tested-by: default avatarWilliam Tu <u9012063@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      67571640
    • Andrii Nakryiko's avatar
      libbpf: fix ptr to u64 conversion warning on 32-bit platforms · 36db2a94
      Andrii Nakryiko authored
      
      
      On 32-bit platforms compiler complains about conversion:
      
      libbpf.c: In function ‘perf_event_open_probe’:
      libbpf.c:4112:17: error: cast from pointer to integer of different
      size [-Werror=pointer-to-int-cast]
        attr.config1 = (uint64_t)(void *)name; /* kprobe_func or uprobe_path */
                       ^
      
      Reported-by: default avatarMatt Hart <matthew.hart@linaro.org>
      Fixes: b2650027 ("libbpf: add kprobe/uprobe attach API")
      Tested-by: default avatarMatt Hart <matthew.hart@linaro.org>
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      36db2a94
    • Andrii Nakryiko's avatar
      bpf: fix precision bit propagation for BPF_ST instructions · b3b50f05
      Andrii Nakryiko authored
      
      
      When backtracking instructions to propagate precision bit for registers
      and stack slots, one class of instructions (BPF_ST) weren't handled
      causing extra stack slots to be propagated into parent state. Parent
      state might not have that much stack allocated, though, which causes
      warning on invalid stack slot usage.
      
      This patch adds handling of BPF_ST instructions:
      
      BPF_MEM | <size> | BPF_ST:   *(size *) (dst_reg + off) = imm32
      
      Reported-by: default avatar <syzbot+4da3ff23081bafe74fc2@syzkaller.appspotmail.com>
      Fixes: b5dc0163 ("bpf: precise scalar_value tracking")
      Cc: Alexei Starovoitov <ast@fb.com>
      Signed-off-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      b3b50f05
    • Vasily Gorbik's avatar
      MAINTAINERS: update BPF JIT S390 maintainers · 327835fb
      Vasily Gorbik authored
      
      
      Ilya Leoshkevich is joining as s390 bpf maintainer. With his background
      as gcc developer he would be valuable for the team and community as a
      whole. Ilya, have fun!
      
      Since there is now enough eyes on s390 bpf, relieve Christian Borntraeger,
      so that he could focus on his maintainer tasks for other components.
      
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Acked-by: default avatarChristian Borntraeger <borntraeger@e.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      327835fb
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2019-07-11' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 114a5c32
      David S. Miller authored
      
      
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 fixes 2019-07-11
      
      This series introduces some fixes to mlx5 driver.
      
      Please pull and let me know if there is any problem.
      
      For -stable v4.15
      ('net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn')
      
      For -stable v5.1
      ('net/mlx5e: Fix port tunnel GRE entropy control')
      ('net/mlx5e: Rx, Fix checksum calculation for new hardware')
      ('net/mlx5e: Fix return value from timeout recover function')
      ('net/mlx5e: Fix error flow in tx reporter diagnose')
      
      For -stable v5.2
      ('net/mlx5: E-Switch, Fix default encap mode')
      
      Conflict note: This pull request will produce a small conflict when
      merged with net-next.
      In drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
      Take the hunk from net and replace:
      esw_offloads_steering_init(esw, vf_nvports, total_nvports);
      with:
      esw_offloads_steering_init(esw);
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      114a5c32
    • David S. Miller's avatar
      Merge branch 'mlx5-build-fixes' · 08d14c49
      David S. Miller authored
      
      
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 build fixes
      
      I know net-next is closed but these patches are fixing some compiler
      build and warnings issues people have been complaining about.
      
      I hope it is not too late, but in case it is a lot of trouble for you,
      I guess they can wait.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08d14c49
    • Saeed Mahameed's avatar
      net/mlx5: E-Switch, Reduce ingress acl modify metadata stack usage · 9446d17e
      Saeed Mahameed authored
      
      
      Fix the following compiler warning:
      In function ‘esw_vport_add_ingress_acl_modify_metadata’:
      the frame size of 1084 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      
      Since the structure is never written to, we can statically allocate
      it to avoid the stack usage.
      
      Fixes: 7445cfb1 ("net/mlx5: E-Switch, Tag packet with vport number in VF vports and uplink ingress ACLs")
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Reviewed-by: default avatarJianbo Liu <jianbol@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9446d17e
    • Saeed Mahameed's avatar
      net/mlx5e: Fix unused variable warning when CONFIG_MLX5_ESWITCH is off · 2f1f5a77
      Saeed Mahameed authored
      
      
      In mlx5e_setup_tc "priv" variable is not being used if
      CONFIG_MLX5_ESWITCH is off, one way to fix this is to actually use it.
      
      mlx5e_setup_tc_mqprio also needs the "priv" variable and it extracts it
      on its own. We can simply pass priv to mlx5e_setup_tc_mqprio instead of
      netdev and avoid extracting the priv var, which will also resolve the
      compiler warning.
      
      Fixes: 4e95bc26 ("net: flow_offload: add flow_block_cb_setup_simple()")
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      CC: Nathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2f1f5a77
    • Tariq Toukan's avatar
      net/mlx5e: Fix compilation error in TLS code · c93dfec1
      Tariq Toukan authored
      
      
      In the cited patch below, the Kconfig flags combination of:
      CONFIG_MLX5_FPGA is not set
      CONFIG_MLX5_TLS=y
      CONFIG_MLX5_EN_TLS=y
      
      leads to the compilation error:
      
      ./include/linux/mlx5/device.h:61:39: error: invalid application of
      sizeof to incomplete type struct mlx5_ifc_tls_flow_bits.
      
      Fix it.
      
      Fixes: 90687e1a9a50 ("net/mlx5: Kconfig, Better organize compilation flags")
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      CC: Mao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c93dfec1
    • Eric Dumazet's avatar
      ipv6: fix static key imbalance in fl_create() · d44e3fa5
      Eric Dumazet authored
      
      
      fl_create() should call static_branch_deferred_inc() only in
      case of success.
      
      Also we should not call fl_free() in error path, as this could
      cause a static key imbalance.
      
      jump label: negative count!
      WARNING: CPU: 0 PID: 15907 at kernel/jump_label.c:221 static_key_slow_try_dec kernel/jump_label.c:221 [inline]
      WARNING: CPU: 0 PID: 15907 at kernel/jump_label.c:221 static_key_slow_try_dec+0x1ab/0x1d0 kernel/jump_label.c:206
      Kernel panic - not syncing: panic_on_warn set ...
      CPU: 0 PID: 15907 Comm: syz-executor.2 Not tainted 5.2.0-rc6+ #62
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x172/0x1f0 lib/dump_stack.c:113
       panic+0x2cb/0x744 kernel/panic.c:219
       __warn.cold+0x20/0x4d kernel/panic.c:576
       report_bug+0x263/0x2b0 lib/bug.c:186
       fixup_bug arch/x86/kernel/traps.c:179 [inline]
       fixup_bug arch/x86/kernel/traps.c:174 [inline]
       do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
       do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
       invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
      RIP: 0010:static_key_slow_try_dec kernel/jump_label.c:221 [inline]
      RIP: 0010:static_key_slow_try_dec+0x1ab/0x1d0 kernel/jump_label.c:206
      Code: c0 e8 e9 3e e5 ff 83 fb 01 0f 85 32 ff ff ff e8 5b 3d e5 ff 45 31 ff eb a0 e8 51 3d e5 ff 48 c7 c7 40 99 92 87 e8 13 75 b7 ff <0f> 0b eb 8b 4c 89 e7 e8 a9 c0 1e 00 e9 de fe ff ff e8 bf 6d b7 ff
      RSP: 0018:ffff88805f9c7450 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 00000000ffffffff RCX: 0000000000000000
      RDX: 000000000000e3e1 RSI: ffffffff815adb06 RDI: ffffed100bf38e7c
      RBP: ffff88805f9c74e0 R08: ffff88806acf0700 R09: ffffed1015d060a9
      R10: ffffed1015d060a8 R11: ffff8880ae830547 R12: ffffffff89832ce0
      R13: ffff88805f9c74b8 R14: 1ffff1100bf38e8b R15: 00000000ffffff01
       __static_key_slow_dec_deferred+0x65/0x110 kernel/jump_label.c:272
       fl_free+0xa9/0xe0 net/ipv6/ip6_flowlabel.c:121
       fl_create+0x6af/0x9f0 net/ipv6/ip6_flowlabel.c:457
       ipv6_flowlabel_opt+0x80e/0x2730 net/ipv6/ip6_flowlabel.c:624
       do_ipv6_setsockopt.isra.0+0x2119/0x4100 net/ipv6/ipv6_sockglue.c:825
       ipv6_setsockopt+0xf6/0x170 net/ipv6/ipv6_sockglue.c:944
       tcp_setsockopt net/ipv4/tcp.c:3131 [inline]
       tcp_setsockopt+0x8f/0xe0 net/ipv4/tcp.c:3125
       sock_common_setsockopt+0x94/0xd0 net/core/sock.c:3130
       __sys_setsockopt+0x253/0x4b0 net/socket.c:2080
       __do_sys_setsockopt net/socket.c:2096 [inline]
       __se_sys_setsockopt net/socket.c:2093 [inline]
       __x64_sys_setsockopt+0xbe/0x150 net/socket.c:2093
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x4597c9
      Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f2670556c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
      RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00000000004597c9
      RDX: 0000000000000020 RSI: 0000000000000029 RDI: 0000000000000003
      RBP: 000000000075bfc8 R08: 000000000000fdf7 R09: 0000000000000000
      R10: 0000000020000000 R11: 0000000000000246 R12: 00007f26705576d4
      R13: 00000000004cec00 R14: 00000000004dd520 R15: 00000000ffffffff
      Kernel Offset: disabled
      Rebooting in 86400 seconds..
      
      Fixes: 59c820b2 ("ipv6: elide flowlabel check if no exclusive leases exist")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d44e3fa5
    • Eric Dumazet's avatar
      ipv6: fix potential crash in ip6_datagram_dst_update() · 8975a3ab
      Eric Dumazet authored
      
      
      Willem forgot to change one of the calls to fl6_sock_lookup(),
      which can now return an error or NULL.
      
      syzbot reported :
      
      kasan: CONFIG_KASAN_INLINE enabled
      kasan: GPF could be caused by NULL-ptr deref or user memory access
      general protection fault: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 31763 Comm: syz-executor.0 Not tainted 5.2.0-rc6+ #63
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:ip6_datagram_dst_update+0x559/0xc30 net/ipv6/datagram.c:83
      Code: 00 00 e8 ea 29 3f fb 4d 85 f6 0f 84 96 04 00 00 e8 dc 29 3f fb 49 8d 7e 20 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 16 06 00 00 4d 8b 6e 20 e8 b4 29 3f fb 4c 89 ee
      RSP: 0018:ffff88809ba97ae0 EFLAGS: 00010207
      RAX: dffffc0000000000 RBX: ffff8880a81254b0 RCX: ffffc90008118000
      RDX: 0000000000000003 RSI: ffffffff86319a84 RDI: 000000000000001e
      RBP: ffff88809ba97c10 R08: ffff888065e9e700 R09: ffffed1015d26c80
      R10: ffffed1015d26c7f R11: ffff8880ae9363fb R12: ffff8880a8124f40
      R13: 0000000000000001 R14: fffffffffffffffe R15: ffff88809ba97b40
      FS:  00007f38e606a700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000202c0140 CR3: 00000000a026a000 CR4: 00000000001406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __ip6_datagram_connect+0x5e9/0x1390 net/ipv6/datagram.c:246
       ip6_datagram_connect+0x30/0x50 net/ipv6/datagram.c:269
       ip6_datagram_connect_v6_only+0x69/0x90 net/ipv6/datagram.c:281
       inet_dgram_connect+0x14a/0x2d0 net/ipv4/af_inet.c:571
       __sys_connect+0x264/0x330 net/socket.c:1824
       __do_sys_connect net/socket.c:1835 [inline]
       __se_sys_connect net/socket.c:1832 [inline]
       __x64_sys_connect+0x73/0xb0 net/socket.c:1832
       do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x4597c9
      Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f38e6069c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004597c9
      RDX: 000000000000001c RSI: 0000000020000040 RDI: 0000000000000003
      RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007f38e606a6d4
      R13: 00000000004bfd07 R14: 00000000004d1838 R15: 00000000ffffffff
      Modules linked in:
      RIP: 0010:ip6_datagram_dst_update+0x559/0xc30 net/ipv6/datagram.c:83
      Code: 00 00 e8 ea 29 3f fb 4d 85 f6 0f 84 96 04 00 00 e8 dc 29 3f fb 49 8d 7e 20 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 16 06 00 00 4d 8b 6e 20 e8 b4 29 3f fb 4c 89 ee
      
      Fixes: 59c820b2 ("ipv6: elide flowlabel check if no exclusive leases exist")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8975a3ab
    • Eric Dumazet's avatar
      ipv6: tcp: fix flowlabels reflection for RST packets · 052e0690
      Eric Dumazet authored
      
      
      In 323a53c4 ("ipv6: tcp: enable flowlabel reflection in some RST packets")
      and 50a8accf ("ipv6: tcp: send consistent flowlabel in TIME_WAIT state")
      we took care of IPv6 flowlabel reflections for two cases.
      
      This patch takes care of the remaining case, when the RST packet
      is sent on behalf of a 'full' socket.
      
      In Marek use case, this was a socket in TCP_CLOSE state.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarMarek Majkowski <marek@cloudflare.com>
      Tested-by: default avatarMarek Majkowski <marek@cloudflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      052e0690
    • yangxingwu's avatar
      ipv6: Use ipv6_authlen for len · 416e8126
      yangxingwu authored
      
      
      The length of AH header is computed manually as (hp->hdrlen+2)<<2.
      However, in include/linux/ipv6.h, a macro named ipv6_authlen is
      already defined for exactly the same job. This commit replaces
      the manual computation code with the macro.
      
      Signed-off-by: default avataryangxingwu <xingwu.yang@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      416e8126
    • Cong Wang's avatar
      hsr: switch ->dellink() to ->ndo_uninit() · 311633b6
      Cong Wang authored
      
      
      Switching from ->priv_destructor to dellink() has an unexpected
      consequence: existing RCU readers, that is, hsr_port_get_hsr()
      callers, may still be able to read the port list.
      
      Instead of checking the return value of each hsr_port_get_hsr(),
      we can just move it to ->ndo_uninit() which is called after
      device unregister and synchronize_net(), and we still have RTNL
      lock there.
      
      Fixes: b9a1e627 ("hsr: implement dellink to clean up resources")
      Fixes: edf070a0 ("hsr: fix a NULL pointer deref in hsr_dev_xmit()")
      Reported-by: default avatar <syzbot+097ef84cdc95843fbaa8@syzkaller.appspotmail.com>
      Cc: Arvid Brodin <arvid.brodin@alten.se>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      311633b6
    • Joe Perches's avatar
      net: stmmac: Fix misuses of GENMASK macro · aa4c0c90
      Joe Perches authored
      
      
      Arguments are supposed to be ordered high then low.
      
      Fixes: 293e4365 ("stmmac: change descriptor layout")
      Fixes: 9f93ac8d ("net-next: stmmac: Add dwmac-sun8i")
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa4c0c90
    • Joe Perches's avatar
      net: ethernet: mediatek: Fix misuses of GENMASK macro · 937a9440
      Joe Perches authored
      
      
      Arguments are supposed to be ordered high then low.
      
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      937a9440
    • Petar Penkov's avatar
      net: fib_rules: do not flow dissect local packets · 63f9ba1b
      Petar Penkov authored
      
      
      Rules matching on loopback iif do not need early flow dissection as the
      packet originates from the host. Stop counting such rules in
      fib_rule_requires_fldissect
      
      Signed-off-by: default avatarPetar Penkov <ppenkov@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63f9ba1b
    • Aya Levin's avatar
      net/mlx5e: IPoIB, Add error path in mlx5_rdma_setup_rn · ef1ce7d7
      Aya Levin authored
      
      
      Check return value from mlx5e_attach_netdev, add error path on failure.
      
      Fixes: 48935bbb ("net/mlx5e: IPoIB, Add netdevice profile skeleton")
      Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
      Reviewed-by: default avatarFeras Daoud <ferasda@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      ef1ce7d7
    • Aya Levin's avatar
      net/mlx5e: Fix error flow in tx reporter diagnose · 99d31cbd
      Aya Levin authored
      
      
      Fix tx reporter's diagnose callback. Propagate error when failing to
      gather diagnostics information or failing to print diagnostic data per
      queue.
      
      Fixes: de8650a8 ("net/mlx5e: Add tx reporter support")
      Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      99d31cbd
    • Aya Levin's avatar
      net/mlx5e: Fix return value from timeout recover function · 39825350
      Aya Levin authored
      
      
      Fix timeout recover function to return a meaningful return value.
      When an interrupt was not sent by the FW, return IO error instead of
      'true'.
      
      Fixes: c7981bea ("net/mlx5e: Fix return status of TX reporter timeout recover")
      Signed-off-by: default avatarAya Levin <ayal@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      39825350
    • Saeed Mahameed's avatar
      net/mlx5e: Rx, Fix checksum calculation for new hardware · db849faa
      Saeed Mahameed authored
      
      
      CQE checksum full mode in new HW, provides a full checksum of rx frame.
      Covering bytes starting from eth protocol up to last byte in the received
      frame (frame_size - ETH_HLEN), as expected by the stack.
      
      Fixing up skb->csum by the driver is not required in such case. This fix
      is to avoid wrong checksum calculation in drivers which already support
      the new hardware with the new checksum mode.
      
      Fixes: 85327a9c ("net/mlx5: Update the list of the PCI supported devices")
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      db849faa
    • Eli Britstein's avatar
      net/mlx5e: Fix port tunnel GRE entropy control · 914adbb1
      Eli Britstein authored
      
      
      GRE entropy calculation is a single bit per card, and not per port.
      Force disable GRE entropy calculation upon the first GRE encap rule,
      and release the force at the last GRE encap rule removal. This is done
      per port.
      
      Fixes: 97417f61 ("net/mlx5e: Fix GRE key by controlling port tunnel entropy calculation")
      Signed-off-by: default avatarEli Britstein <elibr@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      914adbb1
    • Maor Gottlieb's avatar
      net/mlx5: E-Switch, Fix default encap mode · 9a64144d
      Maor Gottlieb authored
      
      
      Encap mode is related to switchdev mode only. Move the init of
      the encap mode to eswitch_offloads. Before this change, we reported
      that eswitch supports encap, even tough the device was in non
      SRIOV mode.
      
      Fixes: 7768d197 ('net/mlx5: E-Switch, Add control for encapsulation')
      Signed-off-by: default avatarMaor Gottlieb <maorg@mellanox.com>
      Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      9a64144d
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · a131c2bf
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "Revert a recent ACPICA commit causing systems to hang at boot time"
      
      * tag 'acpi-5.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        Revert "ACPICA: Update table load object initialization"
      a131c2bf
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next · 237f83df
      Linus Torvalds authored
      Pull networking updates from David Miller:
       "Some highlights from this development cycle:
      
         1) Big refactoring of ipv6 route and neigh handling to support
            nexthop objects configurable as units from userspace. From David
            Ahern.
      
         2) Convert explored_states in BPF verifier into a hash table,
            significantly decreased state held for programs with bpf2bpf
            calls, from Alexei Starovoitov.
      
         3) Implement bpf_send_signal() helper, from Yonghong Song.
      
         4) Various classifier enhancements to mvpp2 driver, from Maxime
            Chevallier.
      
         5) Add aRFS support to hns3 driver, from Jian Shen.
      
         6) Fix use after free in inet frags by allocating fqdirs dynamically
            and reworking how rhashtable dismantle occurs, from Eric Dumazet.
      
         7) Add act_ctinfo packet classifier action, from Kevin
            Darbyshire-Bryant.
      
         8) Add TFO key backup infrastructure, from Jason Baron.
      
         9) Remove several old and unused ISDN drivers, from Arnd Bergmann.
      
        10) Add devlink notifications for flash update status to mlxsw driver,
            from Jiri Pirko.
      
        11) Lots of kTLS offload infrastructure fixes, from Jakub Kicinski.
      
        12) Add support for mv88e6250 DSA chips, from Rasmus Villemoes.
      
        13) Various enhancements to ipv6 flow label handling, from Eric
            Dumazet and Willem de Bruijn.
      
        14) Support TLS offload in nfp driver, from Jakub Kicinski, Dirk van
            der Merwe, and others.
      
        15) Various improvements to axienet driver including converting it to
            phylink, from Robert Hancock.
      
        16) Add PTP support to sja1105 DSA driver, from Vladimir Oltean.
      
        17) Add mqprio qdisc offload support to dpaa2-eth, from Ioana
            Radulescu.
      
        18) Add devlink health reporting to mlx5, from Moshe Shemesh.
      
        19) Convert stmmac over to phylink, from Jose Abreu.
      
        20) Add PTP PHC (Physical Hardware Clock) support to mlxsw, from
            Shalom Toledo.
      
        21) Add nftables SYNPROXY support, from Fernando Fernandez Mancera.
      
        22) Convert tcp_fastopen over to use SipHash, from Ard Biesheuvel.
      
        23) Track spill/fill of constants in BPF verifier, from Alexei
            Starovoitov.
      
        24) Support bounded loops in BPF, from Alexei Starovoitov.
      
        25) Various page_pool API fixes and improvements, from Jesper Dangaard
            Brouer.
      
        26) Just like ipv4, support ref-countless ipv6 route handling. From
            Wei Wang.
      
        27) Support VLAN offloading in aquantia driver, from Igor Russkikh.
      
        28) Add AF_XDP zero-copy support to mlx5, from Maxim Mikityanskiy.
      
        29) Add flower GRE encap/decap support to nfp driver, from Pieter
            Jansen van Vuuren.
      
        30) Protect against stack overflow when using act_mirred, from John
            Hurley.
      
        31) Allow devmap map lookups from eBPF, from Toke Høiland-Jørgensen.
      
        32) Use page_pool API in netsec driver, Ilias Apalodimas.
      
        33) Add Google gve network driver, from Catherine Sullivan.
      
        34) More indirect call avoidance, from Paolo Abeni.
      
        35) Add kTLS TX HW offload support to mlx5, from Tariq Toukan.
      
        36) Add XDP_REDIRECT support to bnxt_en, from Andy Gospodarek.
      
        37) Add MPLS manipulation actions to TC, from John Hurley.
      
        38) Add sending a packet to connection tracking from TC actions, and
            then allow flower classifier matching on conntrack state. From
            Paul Blakey.
      
        39) Netfilter hw offload support, from Pablo Neira Ayuso"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2080 commits)
        net/mlx5e: Return in default case statement in tx_post_resync_params
        mlx5: Return -EINVAL when WARN_ON_ONCE triggers in mlx5e_tls_resync().
        net: dsa: add support for BRIDGE_MROUTER attribute
        pkt_sched: Include const.h
        net: netsec: remove static declaration for netsec_set_tx_de()
        net: netsec: remove superfluous if statement
        netfilter: nf_tables: add hardware offload support
        net: flow_offload: rename tc_cls_flower_offload to flow_cls_offload
        net: flow_offload: add flow_block_cb_is_busy() and use it
        net: sched: remove tcf block API
        drivers: net: use flow block API
        net: sched: use flow block API
        net: flow_offload: add flow_block_cb_{priv, incref, decref}()
        net: flow_offload: add list handling functions
        net: flow_offload: add flow_block_cb_alloc() and flow_block_cb_free()
        net: flow_offload: rename TCF_BLOCK_BINDER_TYPE_* to FLOW_BLOCK_BINDER_TYPE_*
        net: flow_offload: rename TC_BLOCK_{UN}BIND to FLOW_BLOCK_{UN}BIND
        net: flow_offload: add flow_block_cb_setup_simple()
        net: hisilicon: Add an tx_desc to adapt HI13X1_GMAC
        net: hisilicon: Add an rx_desc to adapt HI13X1_GMAC
        ...
      237f83df