1. 21 Jan, 2019 8 commits
    • Mike Marciniszyn's avatar
      IB/hfi1: Add limit test for RC/UC send via loopback · 09ce351d
      Mike Marciniszyn authored
      Fix potential memory corruption and panic in loopback for IB_WR_SEND
      variants.
      
      The code blindly assumes the posted length will fit in the fetched rwqe,
      which is not a valid assumption.
      
      Fix by adding a limit test, and triggering the appropriate send completion
      and putting the QP in an error state.  This mimics the handling for
      non-loopback QPs.
      
      Fixes: 15703461 ("IB/{hfi1, qib, rdmavt}: Move ruc_loopback to rdmavt")
      Cc: <stable@vger.kernel.org> #v4.20+
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      09ce351d
    • Michael J. Ruhl's avatar
      IB/hfi1: Remove overly conservative VM_EXEC flag check · 7709b0dc
      Michael J. Ruhl authored
      Applications that use the stack for execution purposes cause userspace PSM
      jobs to fail during mmap().
      
      Both Fortran (non-standard format parsing) and C (callback functions
      located in the stack) applications can be written such that stack
      execution is required. The linker notes this via the gnu_stack ELF flag.
      
      This causes READ_IMPLIES_EXEC to be set which forces all PROT_READ mmaps
      to have PROT_EXEC for the process.
      
      Checking for VM_EXEC bit and failing the request with EPERM is overly
      conservative and will break any PSM application using executable stacks.
      
      Cc: <stable@vger.kernel.org> #v4.14+
      Fixes: 12220267 ("IB/hfi: Protect against writable mmap")
      Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Signed-off-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      7709b0dc
    • Brian Welty's avatar
      IB/{hfi1, qib}: Fix WC.byte_len calculation for UD_SEND_WITH_IMM · 904bba21
      Brian Welty authored
      The work completion length for a receiving a UD send with immediate is
      short by 4 bytes causing application using this opcode to fail.
      
      The UD receive logic incorrectly subtracts 4 bytes for immediate
      value. These bytes are already included in header length and are used to
      calculate header/payload split, so the result is these 4 bytes are
      subtracted twice, once when the header length subtracted from the overall
      length and once again in the UD opcode specific path.
      
      Remove the extra subtraction when handling the opcode.
      
      Fixes: 77241056 ("IB/hfi1: add driver files")
      Reviewed-by: default avatarMichael J. Ruhl <michael.j.ruhl@intel.com>
      Signed-off-by: default avatarBrian Welty <brian.welty@intel.com>
      Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Signed-off-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      904bba21
    • Jack Morgenstein's avatar
      IB/mlx4: Fix using wrong function to destroy sqp AHs under SRIOV · f45f8edb
      Jack Morgenstein authored
      The commit cited below replaced rdma_create_ah with
      mlx4_ib_create_slave_ah when creating AHs for the paravirtualized special
      QPs.
      
      However, this change also required replacing rdma_destroy_ah with
      mlx4_ib_destroy_ah in the affected flows.
      
      The commit missed 3 places where rdma_destroy_ah should have been replaced
      with mlx4_ib_destroy_ah.
      
      As a result, the pd usecount was decremented when the ah was destroyed --
      although the usecount was NOT incremented when the ah was created.
      
      This caused the pd usecount to become negative, and resulted in the
      WARN_ON stack trace below when the mlx4_ib.ko module was unloaded:
      
      WARNING: CPU: 3 PID: 25303 at drivers/infiniband/core/verbs.c:329 ib_dealloc_pd+0x6d/0x80 [ib_core]
      Modules linked in: rdma_ucm rdma_cm iw_cm ib_cm ib_umad mlx4_ib(-) ib_uverbs ib_core mlx4_en mlx4_core nfsv3 nfs fscache configfs xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c ipt_REJECT nf_reject_ipv4 tun ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bridge stp llc dm_mirror dm_region_hash dm_log dm_mod dax rndis_wlan rndis_host coretemp kvm_intel cdc_ether kvm usbnet iTCO_wdt iTCO_vendor_support cfg80211 irqbypass lpc_ich ipmi_si i2c_i801 mii pcspkr i2c_core mfd_core ipmi_devintf i7core_edac ipmi_msghandler ioatdma pcc_cpufreq dca acpi_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables ext4 mbcache jbd2 sr_mod cdrom ata_generic pata_acpi mptsas scsi_transport_sas mptscsih crc32c_intel ata_piix bnx2 mptbase ipv6 crc_ccitt autofs4 [last unloaded: mlx4_core]
      CPU: 3 PID: 25303 Comm: modprobe Tainted: G        W I       5.0.0-rc1-net-mlx4+ #1
      Hardware name: IBM  -[7148ZV6]-/Node 1, System Card, BIOS -[MLE170CUS-1.70]- 09/23/2011
      RIP: 0010:ib_dealloc_pd+0x6d/0x80 [ib_core]
      Code: 00 00 85 c0 75 02 5b c3 80 3d aa 87 03 00 00 75 f5 48 c7 c7 88 d7 8f a0 31 c0 c6 05 98 87 03 00 01 e8 07 4c 79 e0 0f 0b 5b c3 <0f> 0b eb be 0f 0b eb ab 90 66 2e 0f 1f 84 00 00 00 00 00 66 66 66
      RSP: 0018:ffffc90005347e30 EFLAGS: 00010282
      RAX: 00000000ffffffea RBX: ffff8888589e9540 RCX: 0000000000000006
      RDX: 0000000000000006 RSI: ffff88885d57ad40 RDI: 0000000000000000
      RBP: ffff88885b029c00 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000004 R12: ffff8887f06c0000
      R13: ffff8887f06c13e8 R14: 0000000000000000 R15: 0000000000000000
      FS:  00007fd6743c6740(0000) GS:ffff88887fcc0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000ed1038 CR3: 00000007e3156000 CR4: 00000000000006e0
      Call Trace:
       mlx4_ib_close_sriov+0x125/0x180 [mlx4_ib]
       mlx4_ib_remove+0x57/0x1f0 [mlx4_ib]
       mlx4_remove_device+0x92/0xa0 [mlx4_core]
       mlx4_unregister_interface+0x39/0x90 [mlx4_core]
       mlx4_ib_cleanup+0xc/0xd7 [mlx4_ib]
       __x64_sys_delete_module+0x17d/0x290
       ? trace_hardirqs_off_thunk+0x1a/0x1c
       ? do_syscall_64+0x12/0x180
       do_syscall_64+0x4a/0x180
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 5e62d5ff ("IB/mlx4: Create slave AH's directly")
      Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      f45f8edb
    • Mark Bloch's avatar
      RDMA/mlx5: Fix check for supported user flags when creating a QP · 8af526e0
      Mark Bloch authored
      When the flags verification was added two flags were missed from the
      check:
       * MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC
       * MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC
      
      This causes user applications that were using these flags to break.
      
      Fixes: 2e43bb31 ("IB/mlx5: Verify that driver supports user flags")
      Signed-off-by: default avatarMark Bloch <markb@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      8af526e0
    • Linus Torvalds's avatar
      Linux 5.0-rc3 · 49a57857
      Linus Torvalds authored
      49a57857
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 1e556ba3
      Linus Torvalds authored
      Pull pstore fixes from Kees Cook:
      
       - Fix console ramoops to show the previous boot logs (Sai Prakash
         Ranjan)
      
       - Avoid allocation and leak of platform data
      
      * tag 'pstore-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        pstore/ram: Avoid allocation and leak of platform data
        pstore/ram: Fix console ramoops to show the previous boot logs
      1e556ba3
    • Linus Torvalds's avatar
      Merge tag 'gcc-plugins-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · dbcfc961
      Linus Torvalds authored
      Pull gcc-plugins fixes from Kees Cook:
       "Fix ARM per-task stack protector plugin under GCC 9 (Ard Biesheuvel)"
      
      * tag 'gcc-plugins-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        gcc-plugins: arm_ssp_per_task_plugin: fix for GCC 9+
        gcc-plugins: arm_ssp_per_task_plugin: sign extend the SP mask
      dbcfc961
  2. 20 Jan, 2019 13 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 7d0ae236
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix endless loop in nf_tables, from Phil Sutter.
      
       2) Fix cross namespace ip6_gre tunnel hash list corruption, from
          Olivier Matz.
      
       3) Don't be too strict in phy_start_aneg() otherwise we might not allow
          restarting auto negotiation. From Heiner Kallweit.
      
       4) Fix various KMSAN uninitialized value cases in tipc, from Ying Xue.
      
       5) Memory leak in act_tunnel_key, from Davide Caratti.
      
       6) Handle chip errata of mv88e6390 PHY, from Andrew Lunn.
      
       7) Remove linear SKB assumption in fou/fou6, from Eric Dumazet.
      
       8) Missing udplite rehash callbacks, from Alexey Kodanev.
      
       9) Log dirty pages properly in vhost, from Jason Wang.
      
      10) Use consume_skb() in neigh_probe() as this is a normal free not a
          drop, from Yang Wei. Likewise in macvlan_process_broadcast().
      
      11) Missing device_del() in mdiobus_register() error paths, from Thomas
          Petazzoni.
      
      12) Fix checksum handling of short packets in mlx5, from Cong Wang.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (96 commits)
        bpf: in __bpf_redirect_no_mac pull mac only if present
        virtio_net: bulk free tx skbs
        net: phy: phy driver features are mandatory
        isdn: avm: Fix string plus integer warning from Clang
        net/mlx5e: Fix cb_ident duplicate in indirect block register
        net/mlx5e: Fix wrong (zero) TX drop counter indication for representor
        net/mlx5e: Fix wrong error code return on FEC query failure
        net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames
        tools: bpftool: Cleanup license mess
        bpf: fix inner map masking to prevent oob under speculation
        bpf: pull in pkt_sched.h header for tooling to fix bpftool build
        selftests: forwarding: Add a test case for externally learned FDB entries
        selftests: mlxsw: Test FDB offload indication
        mlxsw: spectrum_switchdev: Do not treat static FDB entries as sticky
        net: bridge: Mark FDB entries that were added by user as such
        mlxsw: spectrum_fid: Update dummy FID index
        mlxsw: pci: Return error on PCI reset timeout
        mlxsw: pci: Increase PCI SW reset timeout
        mlxsw: pci: Ring CQ's doorbell before RDQ's
        MAINTAINERS: update email addresses of liquidio driver maintainers
        ...
      7d0ae236
    • Kees Cook's avatar
      pstore/ram: Avoid allocation and leak of platform data · 5631e857
      Kees Cook authored
      Yue Hu noticed that when parsing device tree the allocated platform data
      was never freed. Since it's not used beyond the function scope, this
      switches to using a stack variable instead.
      Reported-by: default avatarYue Hu <huyue2@yulong.com>
      Fixes: 35da6094 ("pstore/ram: add Device Tree bindings")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      5631e857
    • Ard Biesheuvel's avatar
      gcc-plugins: arm_ssp_per_task_plugin: fix for GCC 9+ · 2c88c742
      Ard Biesheuvel authored
      GCC 9 reworks the way the references to the stack canary are
      emitted, to prevent the value from being spilled to the stack
      before the final comparison in the epilogue, defeating the
      purpose, given that the spill slot is under control of the
      attacker that we are protecting ourselves from.
      
      Since our canary value address is obtained without accessing
      memory (as opposed to pre-v7 code that will obtain it from a
      literal pool), it is unlikely (although not guaranteed) that
      the compiler will spill the canary value in the same way, so
      let's just disable this improvement when building with GCC9+.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      2c88c742
    • Ard Biesheuvel's avatar
      gcc-plugins: arm_ssp_per_task_plugin: sign extend the SP mask · 560706d5
      Ard Biesheuvel authored
      The ARM per-task stack protector GCC plugin hits an assert in
      the compiler in some case, due to the fact the the SP mask
      expression is not sign-extended as it should be. So fix that.
      Suggested-by: default avatarKugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      560706d5
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · bb617b9b
      Linus Torvalds authored
      Pull virtio/vhost fixes and cleanups from Michael Tsirkin:
       "Fixes and cleanups all over the place"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost/scsi: Use copy_to_iter() to send control queue response
        vhost: return EINVAL if iovecs size does not match the message size
        virtio-balloon: tweak config_changed implementation
        virtio: don't allocate vqs when names[i] = NULL
        virtio_pci: use queue idx instead of array idx to set up the vq
        virtio: document virtio_config_ops restrictions
        virtio: fix virtio_config_ops description
      bb617b9b
    • Linus Torvalds's avatar
      Merge tag 'for-5.0-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 1be969f4
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A handful of fixes (some of them in testing for a long time):
      
         - fix some test failures regarding cleanup after transaction abort
      
         - revert of a patch that could cause a deadlock
      
         - delayed iput fixes, that can help in ENOSPC situation when there's
           low space and a lot data to write"
      
      * tag 'for-5.0-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: wakeup cleaner thread when adding delayed iput
        btrfs: run delayed iputs before committing
        btrfs: wait on ordered extents on abort cleanup
        btrfs: handle delayed ref head accounting cleanup in abort
        Revert "btrfs: balance dirty metadata pages in btrfs_finish_ordered_io"
      1be969f4
    • Linus Torvalds's avatar
      Merge tags 'compiler-attributes-for-linus-v5.0-rc3' and... · 315a6d85
      Linus Torvalds authored
      Merge tags 'compiler-attributes-for-linus-v5.0-rc3' and 'clang-format-for-linus-v5.0-rc3' of git://github.com/ojeda/linux
      
      Pull misc clang fixes from Miguel Ojeda:
      
        - A fix for OPTIMIZER_HIDE_VAR from Michael S Tsirkin
      
        - Update clang-format with the latest for_each macro list from Jason
          Gunthorpe
      
      * tag 'compiler-attributes-for-linus-v5.0-rc3' of git://github.com/ojeda/linux:
        include/linux/compiler*.h: fix OPTIMIZER_HIDE_VAR
      
      * tag 'clang-format-for-linus-v5.0-rc3' of git://github.com/ojeda/linux:
        clang-format: Update .clang-format with the latest for_each macro list
      315a6d85
    • Florian La Roche's avatar
      fix int_sqrt64() for very large numbers · fbfaf851
      Florian La Roche authored
      If an input number x for int_sqrt64() has the highest bit set, then
      fls64(x) is 64.  (1UL << 64) is an overflow and breaks the algorithm.
      
      Subtracting 1 is a better guess for the initial value of m anyway and
      that's what also done in int_sqrt() implicitly [*].
      
      [*] Note how int_sqrt() uses __fls() with two underscores, which already
          returns the proper raw bit number.
      
          In contrast, int_sqrt64() used fls64(), and that returns bit numbers
          illogically starting at 1, because of error handling for the "no
          bits set" case. Will points out that he bug probably is due to a
          copy-and-paste error from the regular int_sqrt() case.
      Signed-off-by: default avatarFlorian La Roche <Florian.LaRoche@googlemail.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fbfaf851
    • Will Deacon's avatar
      x86: uaccess: Inhibit speculation past access_ok() in user_access_begin() · 6e693b3f
      Will Deacon authored
      Commit 594cc251 ("make 'user_access_begin()' do 'access_ok()'")
      makes the access_ok() check part of the user_access_begin() preceding a
      series of 'unsafe' accesses.  This has the desirable effect of ensuring
      that all 'unsafe' accesses have been range-checked, without having to
      pick through all of the callsites to verify whether the appropriate
      checking has been made.
      
      However, the consolidated range check does not inhibit speculation, so
      it is still up to the caller to ensure that they are not susceptible to
      any speculative side-channel attacks for user addresses that ultimately
      fail the access_ok() check.
      
      This is an oversight, so use __uaccess_begin_nospec() to ensure that
      speculation is inhibited until the access_ok() check has passed.
      Reported-by: default avatarJulien Thierry <julien.thierry@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6e693b3f
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · b0f3e768
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "Three arm64 fixes for -rc3.
      
        We've plugged a couple of nasty issues involving KASLR-enabled
        kernels, and removed a redundant #define that was introduced as part
        of the KHWASAN fixes from akpm at -rc2.
      
         - Fix broken kpti page-table rewrite in bizarre KASLR configuration
      
         - Fix module loading with KASLR
      
         - Remove redundant definition of ARCH_SLAB_MINALIGN"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        kasan, arm64: remove redundant ARCH_SLAB_MINALIGN define
        arm64: kaslr: ensure randomized quantities are clean to the PoC
        arm64: kpti: Update arm64_kernel_use_ng_mappings() when forced on
      b0f3e768
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 6436408e
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2019-01-20
      
      The following pull-request contains BPF updates for your *net* tree.
      
      The main changes are:
      
      1) Fix a out-of-bounds access in __bpf_redirect_no_mac, from Willem.
      
      2) Fix bpf_setsockopt to reset sock dst on SO_MARK changes, from Peter.
      
      3) Fix map in map masking to prevent out-of-bounds access under
         speculative execution, from Daniel.
      
      4) Fix bpf_setsockopt's SO_MAX_PACING_RATE to support TCP internal
         pacing, from Yuchung.
      
      5) Fix json writer license in bpftool, from Thomas.
      
      6) Fix AF_XDP to check if an actually queue exists during umem
         setup, from Krzysztof.
      
      7) Several fixes to BPF stackmap's build id handling. Another fix
         for bpftool build to account for libbfd variations wrt linking
         requirements, from Stanislav.
      
      8) Fix BPF samples build with clang by working around missing asm
         goto, from Yonghong.
      
      9) Fix libbpf to retry program load on signal interrupt, from Lorenz.
      
      10) Various minor compile warning fixes in BPF code, from Mathieu.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6436408e
    • Willem de Bruijn's avatar
      bpf: in __bpf_redirect_no_mac pull mac only if present · e7c87bd6
      Willem de Bruijn authored
      Syzkaller was able to construct a packet of negative length by
      redirecting from bpf_prog_test_run_skb with BPF_PROG_TYPE_LWT_XMIT:
      
          BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:345 [inline]
          BUG: KASAN: slab-out-of-bounds in skb_copy_from_linear_data include/linux/skbuff.h:3421 [inline]
          BUG: KASAN: slab-out-of-bounds in __pskb_copy_fclone+0x2dd/0xeb0 net/core/skbuff.c:1395
          Read of size 4294967282 at addr ffff8801d798009c by task syz-executor2/12942
      
          kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
          check_memory_region_inline mm/kasan/kasan.c:260 [inline]
          check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
          memcpy+0x23/0x50 mm/kasan/kasan.c:302
          memcpy include/linux/string.h:345 [inline]
          skb_copy_from_linear_data include/linux/skbuff.h:3421 [inline]
          __pskb_copy_fclone+0x2dd/0xeb0 net/core/skbuff.c:1395
          __pskb_copy include/linux/skbuff.h:1053 [inline]
          pskb_copy include/linux/skbuff.h:2904 [inline]
          skb_realloc_headroom+0xe7/0x120 net/core/skbuff.c:1539
          ipip6_tunnel_xmit net/ipv6/sit.c:965 [inline]
          sit_tunnel_xmit+0xe1b/0x30d0 net/ipv6/sit.c:1029
          __netdev_start_xmit include/linux/netdevice.h:4325 [inline]
          netdev_start_xmit include/linux/netdevice.h:4334 [inline]
          xmit_one net/core/dev.c:3219 [inline]
          dev_hard_start_xmit+0x295/0xc90 net/core/dev.c:3235
          __dev_queue_xmit+0x2f0d/0x3950 net/core/dev.c:3805
          dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
          __bpf_tx_skb net/core/filter.c:2016 [inline]
          __bpf_redirect_common net/core/filter.c:2054 [inline]
          __bpf_redirect+0x5cf/0xb20 net/core/filter.c:2061
          ____bpf_clone_redirect net/core/filter.c:2094 [inline]
          bpf_clone_redirect+0x2f6/0x490 net/core/filter.c:2066
          bpf_prog_41f2bcae09cd4ac3+0xb25/0x1000
      
      The generated test constructs a packet with mac header, network
      header, skb->data pointing to network header and skb->len 0.
      
      Redirecting to a sit0 through __bpf_redirect_no_mac pulls the
      mac length, even though skb->data already is at skb->network_header.
      bpf_prog_test_run_skb has already pulled it as LWT_XMIT !is_l2.
      
      Update the offset calculation to pull only if skb->data differs
      from skb->network_header, which is not true in this case.
      
      The test itself can be run only from commit 1cf1cae9 ("bpf:
      introduce BPF_PROG_TEST_RUN command"), but the same type of packets
      with skb at network header could already be built from lwt xmit hooks,
      so this fix is more relevant to that commit.
      
      Also set the mac header on redirect from LWT_XMIT, as even after this
      change to __bpf_redirect_no_mac that field is expected to be set, but
      is not yet in ip_finish_output2.
      
      Fixes: 3a0af8fd ("bpf: BPF for lightweight tunnel infrastructure")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e7c87bd6
    • Michael S. Tsirkin's avatar
      virtio_net: bulk free tx skbs · df133f3f
      Michael S. Tsirkin authored
      Use napi_consume_skb() to get bulk free.  Note that napi_consume_skb is
      safe to call in a non-napi context as long as the napi_budget flag is
      correct.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      df133f3f
  3. 19 Jan, 2019 16 commits
    • Linus Torvalds's avatar
      Merge tag 'mips_fixes_5.0_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · 5d5c303e
      Linus Torvalds authored
      Pull MIPS fixes from Paul Burton:
      
       - Fix IPI handling for Lantiq SoCs, which was broken by changes made
         back in v4.12.
      
       - Enable OF/DT serial support in ath79_defconfig to give us working
         serial by default.
      
       - Fix 64b builds for the Jazz platform.
      
       - Set up a struct device for the BCM47xx SoC to allow BCM47xx drivers
         to perform DMA again following the major DMA mapping changes made in
         v4.19.
      
       - Disable MSI on Cavium Octeon systems when the pcie_disable command
         line parameter introduced in v3.3 is used, in order to avoid
         inadvetently accessing PCIe controller registers despite the command
         line.
      
       - Fix a build failure for Cavium Octeon kernels with kexec enabled,
         introduced in v4.20.
      
       - Fix a regression in the behaviour of semctl/shmctl/msgctl IPC
         syscalls for kernels including n32 support but not o32 support caused
         by some cleanup in v3.19.
      
      * tag 'mips_fixes_5.0_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        MIPS: OCTEON: fix kexec support
        mips: fix n32 compat_ipc_parse_version
        Disable MSI also when pcie-octeon.pcie_disable on
        MIPS: BCM47XX: Setup struct device for the SoC
        MIPS: jazz: fix 64bit build
        MIPS: ath79: Enable OF serial ports in the default config
        MIPS: lantiq: Use CP0_LEGACY_COMPARE_IRQ
        MIPS: lantiq: Fix IPI interrupt handling
      5d5c303e
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 6a0141a0
      Linus Torvalds authored
      Pull Devicetree fix from Rob Herring:
       "A single build fix for powerpc due to device_node.type removal"
      
      * tag 'devicetree-fixes-for-5.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        powerpc: chrp: Use of_node_is_type to access device_type
      6a0141a0
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-fixes-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · 26caabbc
      Linus Torvalds authored
      Pull libnvdimm fixes from Dan Williams:
       "A crash fix, a build warning fix, a miscellaneous small cleanups.
      
        In case anyone is looking for them, there was a regression caught by
        testing that caused two patches to be dropped from this update.  Those
        patches have been reworked and will soak for another week / re-target
        5.0-rc4.
      
         - Fix driver initialization crash due to the inability to report an
           'error' state for a DIMM's security capability.
      
         - Build warning fix for little-endian ARM64 builds
      
         - Fix a potential race between the EDAC driver's usage of the NFIT
           SMBIOS id for a DIMM and the driver shutdown path.
      
         - A small collection of one-line benign cleanups for duplicate
           variable assignments, a duplicate header include and a mis-typed
           function argument"
      
      * tag 'libnvdimm-fixes-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        libnvdimm/security: Fix nvdimm_security_state() state request selection
        acpi/nfit: Remove duplicate set nd_set in acpi_nfit_init_interleave_set()
        acpi/nfit: Fix race accessing memdev in nfit_get_smbios_id()
        libnvdimm/dimm: Fix security capability detection for non-Intel NVDIMMs
        nfit: Mark some functions as __maybe_unused
        ACPI/nfit: delete the function to_acpi_nfit_desc
        ACPI/nfit: delete the redundant header file
      26caabbc
    • Linus Torvalds's avatar
      Merge tag 'linux-watchdog-5.0-rc-fixes' of git://www.linux-watchdog.org/linux-watchdog · f403d718
      Linus Torvalds authored
      Pull watchdog fixes from Wim Van Sebroeck:
      
       - mt7621_wdt/rt2880_wdt: Fix compilation problem
      
       - tqmx86: Fix a couple IS_ERR() vs NULL bugs
      
      * tag 'linux-watchdog-5.0-rc-fixes' of git://www.linux-watchdog.org/linux-watchdog:
        watchdog: tqmx86: Fix a couple IS_ERR() vs NULL bugs
        watchdog: mt7621_wdt/rt2880_wdt: Fix compilation problem
      f403d718
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.0-2' of git://git.linux-nfs.org/projects/anna/linux-nfs · b0efca46
      Linus Torvalds authored
      Pull NFS client fixes from Anna Schumaker:
       "These are mostly fixes for SUNRPC bugs, with a single v4.2
        copy_file_range() fix mixed in.
      
        Stable bugfixes:
         - Fix TCP receive code on archs with flush_dcache_page()
      
        Other bugfixes:
         - Fix error code in rpcrdma_buffer_create()
         - Fix a double free in rpcrdma_send_ctxs_create()
         - Fix kernel BUG at kernel/cred.c:825
         - Fix unnecessary retry in nfs42_proc_copy_file_range()
         - Ensure rq_bytes_sent is reset before request transmission
         - Ensure we respect the RPCSEC_GSS sequence number limit
         - Address Kerberos performance/behavior regression"
      
      * tag 'nfs-for-5.0-2' of git://git.linux-nfs.org/projects/anna/linux-nfs:
        SUNRPC: Address Kerberos performance/behavior regression
        SUNRPC: Ensure we respect the RPCSEC_GSS sequence number limit
        SUNRPC: Ensure rq_bytes_sent is reset before request transmission
        NFSv4.2 fix unnecessary retry in nfs4_copy_file_range
        sunrpc: kernel BUG at kernel/cred.c:825!
        SUNRPC: Fix TCP receive code on archs with flush_dcache_page()
        xprtrdma: Double free in rpcrdma_sendctxs_create()
        xprtrdma: Fix error code in rpcrdma_buffer_create()
      b0efca46
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 4d5f6e02
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "A set of 17 fixes. Most of these are minor or trivial.
      
        The one fix that may be serious is the isci one: the bug can cause hba
        parameters to be set from uninitialized memory. I don't think it's
        exploitable, but you never know"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: cxgb4i: add wait_for_completion()
        scsi: qla1280: set 64bit coherent mask
        scsi: ufs: Fix geometry descriptor size
        scsi: megaraid_sas: Retry reads of outbound_intr_status reg
        scsi: qedi: Add ep_state for login completion on un-reachable targets
        scsi: ufs: Fix system suspend status
        scsi: qla2xxx: Use correct number of vectors for online CPUs
        scsi: hisi_sas: Set protection parameters prior to adding SCSI host
        scsi: tcmu: avoid cmd/qfull timers updated whenever a new cmd comes
        scsi: isci: initialize shost fully before calling scsi_add_host()
        scsi: lpfc: lpfc_sli: Mark expected switch fall-throughs
        scsi: smartpqi_init: fix boolean expression in pqi_device_remove_start
        scsi: core: Synchronize request queue PM status only on successful resume
        scsi: pm80xx: reduce indentation
        scsi: qla4xxx: check return code of qla4xxx_copy_from_fwddb_param
        scsi: megaraid_sas: correct an info message
        scsi: target/iscsi: fix error msg typo when create lio_qr_cache failed
        scsi: sd: Fix cache_type_store()
      4d5f6e02
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190118' of git://git.kernel.dk/linux-block · 0facb892
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - block size setting fixes for loop/nbd (Jan Kara)
      
       - md bio_alloc_mddev() cleanup (Marcos)
      
       - Ensure we don't lose the REQ_INTEGRITY flag (Ming)
      
       - Two NVMe fixes by way of Christoph:
          - Fix NVMe IRQ calculation (Ming)
          - Uninitialized variable in nvmet-tcp (Sagi)
      
       - BFQ comment fix (Paolo)
      
       - License cleanup for recently added blk-mq-debugfs-zoned (Thomas)
      
      * tag 'for-linus-20190118' of git://git.kernel.dk/linux-block:
        block: Cleanup license notice
        nvme-pci: fix nvme_setup_irqs()
        nvmet-tcp: fix uninitialized variable access
        block: don't lose track of REQ_INTEGRITY flag
        blockdev: Fix livelocks on loop device
        nbd: Use set_blocksize() to set device blocksize
        md: Make bio_alloc_mddev use bio_alloc_bioset
        block, bfq: fix comments on __bfq_deactivate_entity
      0facb892
    • Jason Gunthorpe's avatar
      clang-format: Update .clang-format with the latest for_each macro list · 99e309b6
      Jason Gunthorpe authored
      Re-run the shell fragment that generated the original list. In particular
      this adds the missing xarray related functions.
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      99e309b6
    • Camelia Groza's avatar
      net: phy: phy driver features are mandatory · 3e64cf7a
      Camelia Groza authored
      Since phy driver features became a link_mode bitmap, phy drivers that
      don't have a list of features configured will cause the kernel to crash
      when probed.
      
      Prevent the phy driver from registering if the features field is missing.
      
      Fixes: 719655a1 ("net: phy: Replace phy driver features u32 with link_mode bitmap")
      Reported-by: default avatarScott Wood <oss@buserror.net>
      Signed-off-by: default avatarCamelia Groza <camelia.groza@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e64cf7a
    • Nathan Chancellor's avatar
      isdn: avm: Fix string plus integer warning from Clang · 7afa81c5
      Nathan Chancellor authored
      A recent commit in Clang expanded the -Wstring-plus-int warning, showing
      some odd behavior in this file.
      
      drivers/isdn/hardware/avm/b1.c:426:30: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                      cinfo->version[j] = "\0\0" + 1;
                                          ~~~~~~~^~~
      drivers/isdn/hardware/avm/b1.c:426:30: note: use array indexing to silence this warning
                      cinfo->version[j] = "\0\0" + 1;
                                                 ^
                                          &      [  ]
      1 warning generated.
      
      This is equivalent to just "\0". Nick pointed out that it is smarter to
      use "" instead of "\0" because "" is used elsewhere in the kernel and
      can be deduplicated at the linking stage.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/309Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7afa81c5
    • Rob Herring's avatar
      powerpc: chrp: Use of_node_is_type to access device_type · 75a080cd
      Rob Herring authored
      Commit 8ce5f841 ("of: Remove struct device_node.type pointer")
      removed struct device_node.type pointer, but the conversion to use
      of_node_is_type() accessor was missed in chrp_init_IRQ().
      
      Fixes: 8ce5f841 ("of: Remove struct device_node.type pointer")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      75a080cd
    • David S. Miller's avatar
      Merge tag 'mlx5-fixes-2019-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 8a7fa0c3
      David S. Miller authored
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 fixes 2019-01-18
      
      This series introduces some fixes to mlx5 driver.
      
      Please pull and let me know if there is any problem.
      
      For -stable v4.18
      ('net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames')
      
      The patch doesn't apply cleanly to 4.18.y, but it is very simple to
      resolve, what should be the procedure here ?
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8a7fa0c3
    • Eli Britstein's avatar
      net/mlx5e: Fix cb_ident duplicate in indirect block register · 25f2d0e7
      Eli Britstein authored
      Previously the identifier used for indirect block callback registry
      and for block rule cb registry (when done via indirect blocks) was the
      pointer to the tunnel netdev we were interested in receiving updates on.
      This worked fine if a single PF existed that registered one callback for
      the tunnel netdev of interest. However, if multiple PFs are in place then
      the 2nd PF tries to register with the same tunnel netdev identifier. This
      leads to EEXIST errors and/or incorrect cb deletions.
      
      Prevent this conflict by using the rpriv pointer as the identifier for
      netdev indirect block cb registry, allowing each PF to register a unique
      callback per tunnel netdev. For block cb registry, the same PF may
      register multiple cbs to the same block if using TC shared blocks.
      Instead of the rpriv, use the pointer to the allocated indr_priv data as
      the identifier here. This means that there can be a unique block callback
      for each PF/tunnel netdev combo.
      
      Fixes: f5bc2c5d ("net/mlx5e: Support TC indirect block notifications
      for eswitch uplink reprs")
      Signed-off-by: default avatarEli Britstein <elibr@mellanox.com>
      Reviewed-by: default avatarOz Shlomo <ozsh@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      25f2d0e7
    • Tariq Toukan's avatar
      net/mlx5e: Fix wrong (zero) TX drop counter indication for representor · 7fdc1adc
      Tariq Toukan authored
      For representors, the TX dropped counter is not folded from the
      per-ring counters. Fix it.
      Signed-off-by: default avatarTariq Toukan <tariqt@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      7fdc1adc
    • Shay Agroskin's avatar
      net/mlx5e: Fix wrong error code return on FEC query failure · 2eb1e425
      Shay Agroskin authored
      Advertised and configured FEC query failure resulted in printing
      wrong error code.
      
      Fixes: 6cfa9460 ("net/mlx5e: Ethtool driver callback for query/set FEC policy")
      Signed-off-by: default avatarShay Agroskin <shayag@mellanox.com>
      Reported-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      2eb1e425
    • Cong Wang's avatar
      net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames · e8c8b53c
      Cong Wang authored
      When an ethernet frame is padded to meet the minimum ethernet frame
      size, the padding octets are not covered by the hardware checksum.
      Fortunately the padding octets are usually zero's, which don't affect
      checksum. However, we have a switch which pads non-zero octets, this
      causes kernel hardware checksum fault repeatedly.
      
      Prior to:
      commit '88078d98 ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE ...")'
      skb checksum was forced to be CHECKSUM_NONE when padding is detected.
      After it, we need to keep skb->csum updated, like what we do for RXFCS.
      However, fixing up CHECKSUM_COMPLETE requires to verify and parse IP
      headers, it is not worthy the effort as the packets are so small that
      CHECKSUM_COMPLETE can't save anything.
      
      Fixes: 88078d98 ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"),
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Tariq Toukan <tariqt@mellanox.com>
      Cc: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
      e8c8b53c
  4. 18 Jan, 2019 3 commits
    • Thomas Gleixner's avatar
      tools: bpftool: Cleanup license mess · 64cf5481
      Thomas Gleixner authored
      Precise and non-ambiguous license information is important. The recent
      relicensing of the bpftools introduced a license conflict.
      
      The files have now:
      
           SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause
      
      and
      
           * This program is free software; you can redistribute it and/or
           * modify it under the terms of the GNU General Public License
           * as published by the Free Software Foundation; either version
           * 2 of the License, or (at your option) any later version
      
      Amazingly about 20 people acked that change and neither they nor the
      committer noticed. Oh well.
      
      Digging deeper: The files were imported from the iproute2 repository with
      the GPL V2 or later boiler plate text in commit b66e907c ("tools:
      bpftool: copy JSON writer from iproute2 repository")
      
      Looking at the iproute2 repository at
      
        git://git.kernel.org/pub/scm/network/iproute2/iproute2.git
      
      the following commit is the equivivalent:
      
        commit d9d8c839 ("json_writer: add SPDX Identifier (GPL-2/BSD-2)")
      
      That commit explicitly removes the boiler plate and relicenses the code
      uner GPL-2.0-only and BSD-2-Clause. As Steven wrote the original code and
      also the relicensing commit, it's assumed that the relicensing was intended
      to do exaclty that. Just the kernel side update failed to remove the boiler
      plate. Do so now.
      
      Fixes: 907b2236 ("tools: bpftool: dual license all files")
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: Sean Young <sean@mess.org>
      Cc: Jiri Benc <jbenc@redhat.com>
      Cc: David Calavera <david.calavera@gmail.com>
      Cc: Andrey Ignatov <rdna@fb.com>
      Cc: Joe Stringer <joe@wand.net.nz>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Petar Penkov <ppenkov@stanford.edu>
      Cc: Sandipan Das <sandipan@linux.ibm.com>
      Cc: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Quentin Monnet <quentin.monnet@netronome.com>
      CC: okash.khawaja@gmail.com
      Cc: netdev@vger.kernel.org
      Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      64cf5481
    • Daniel Borkmann's avatar
      bpf: fix inner map masking to prevent oob under speculation · 9d5564dd
      Daniel Borkmann authored
      During review I noticed that inner meta map setup for map in
      map is buggy in that it does not propagate all needed data
      from the reference map which the verifier is later accessing.
      
      In particular one such case is index masking to prevent out of
      bounds access under speculative execution due to missing the
      map's unpriv_array/index_mask field propagation. Fix this such
      that the verifier is generating the correct code for inlined
      lookups in case of unpriviledged use.
      
      Before patch (test_verifier's 'map in map access' dump):
      
        # bpftool prog dump xla id 3
           0: (62) *(u32 *)(r10 -4) = 0
           1: (bf) r2 = r10
           2: (07) r2 += -4
           3: (18) r1 = map[id:4]
           5: (07) r1 += 272                |
           6: (61) r0 = *(u32 *)(r2 +0)     |
           7: (35) if r0 >= 0x1 goto pc+6   | Inlined map in map lookup
           8: (54) (u32) r0 &= (u32) 0      | with index masking for
           9: (67) r0 <<= 3                 | map->unpriv_array.
          10: (0f) r0 += r1                 |
          11: (79) r0 = *(u64 *)(r0 +0)     |
          12: (15) if r0 == 0x0 goto pc+1   |
          13: (05) goto pc+1                |
          14: (b7) r0 = 0                   |
          15: (15) if r0 == 0x0 goto pc+11
          16: (62) *(u32 *)(r10 -4) = 0
          17: (bf) r2 = r10
          18: (07) r2 += -4
          19: (bf) r1 = r0
          20: (07) r1 += 272                |
          21: (61) r0 = *(u32 *)(r2 +0)     | Index masking missing (!)
          22: (35) if r0 >= 0x1 goto pc+3   | for inner map despite
          23: (67) r0 <<= 3                 | map->unpriv_array set.
          24: (0f) r0 += r1                 |
          25: (05) goto pc+1                |
          26: (b7) r0 = 0                   |
          27: (b7) r0 = 0
          28: (95) exit
      
      After patch:
      
        # bpftool prog dump xla id 1
           0: (62) *(u32 *)(r10 -4) = 0
           1: (bf) r2 = r10
           2: (07) r2 += -4
           3: (18) r1 = map[id:2]
           5: (07) r1 += 272                |
           6: (61) r0 = *(u32 *)(r2 +0)     |
           7: (35) if r0 >= 0x1 goto pc+6   | Same inlined map in map lookup
           8: (54) (u32) r0 &= (u32) 0      | with index masking due to
           9: (67) r0 <<= 3                 | map->unpriv_array.
          10: (0f) r0 += r1                 |
          11: (79) r0 = *(u64 *)(r0 +0)     |
          12: (15) if r0 == 0x0 goto pc+1   |
          13: (05) goto pc+1                |
          14: (b7) r0 = 0                   |
          15: (15) if r0 == 0x0 goto pc+12
          16: (62) *(u32 *)(r10 -4) = 0
          17: (bf) r2 = r10
          18: (07) r2 += -4
          19: (bf) r1 = r0
          20: (07) r1 += 272                |
          21: (61) r0 = *(u32 *)(r2 +0)     |
          22: (35) if r0 >= 0x1 goto pc+4   | Now fixed inlined inner map
          23: (54) (u32) r0 &= (u32) 0      | lookup with proper index masking
          24: (67) r0 <<= 3                 | for map->unpriv_array.
          25: (0f) r0 += r1                 |
          26: (05) goto pc+1                |
          27: (b7) r0 = 0                   |
          28: (b7) r0 = 0
          29: (95) exit
      
      Fixes: b2157399 ("bpf: prevent out-of-bounds speculation")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      9d5564dd
    • Daniel Borkmann's avatar
      bpf: pull in pkt_sched.h header for tooling to fix bpftool build · ad6dd7a9
      Daniel Borkmann authored
      Dan reported that bpftool does not compile for him:
      
        $ make tools/bpf
          DESCEND  bpf
      
        Auto-detecting system features:
        ..                        libbfd: [ on  ]
        ..        disassembler-four-args: [ OFF ]
      
          DESCEND  bpftool
      
        Auto-detecting system features:
        ..                        libbfd: [ on  ]
        ..        disassembler-four-args: [ OFF ]
      
          CC       /opt/linux.git/tools/bpf/bpftool/net.o
        In file included from /opt/linux.git/tools/include/uapi/linux/pkt_cls.h:6:0,
                       from /opt/linux.git/tools/include/uapi/linux/tc_act/tc_bpf.h:14,
                       from net.c:13:
        net.c: In function 'show_dev_tc_bpf':
        net.c:164:21: error: 'TC_H_CLSACT' undeclared (first use in this function)
          handle = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS);
        [...]
      
      Fix it by importing pkt_sched.h header copy into tooling
      infrastructure.
      
      Fixes: 49a249c3 ("tools/bpftool: copy a few net uapi headers to tools directory")
      Fixes: f6f3bac0 ("tools/bpf: bpftool: add net support")
      Reported-by: default avatarDan Gilson <dan_gilson@yahoo.com>
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=202315Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      ad6dd7a9