1. 18 Aug, 2022 1 commit
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 3f5f728a
      Jakub Kicinski authored
      Andrii Nakryiko says:
      
      ====================
      bpf-next 2022-08-17
      
      We've added 45 non-merge commits during the last 14 day(s) which contain
      a total of 61 files changed, 986 insertions(+), 372 deletions(-).
      
      The main changes are:
      
      1) New bpf_ktime_get_tai_ns() BPF helper to access CLOCK_TAI, from Kurt
         Kanzenbach and Jesper Dangaard Brouer.
      
      2) Few clean ups and improvements for libbpf 1.0, from Andrii Nakryiko.
      
      3) Expose crash_kexec() as kfunc for BPF programs, from Artem Savkov.
      
      4) Add ability to define sleepable-only kfuncs, from Benjamin Tissoires.
      
      5) Teach libbpf's bpf_prog_load() and bpf_map_create() to gracefully handle
         unsupported names on old kernels, from Hangbin Liu.
      
      6) Allow opting out from auto-attaching BPF programs by libbpf's BPF skeleton,
         from Hao Luo.
      
      7) Relax libbpf's requirement for shared libs to be marked executable, from
         Henqgi Chen.
      
      8) Improve bpf_iter internals handling of error returns, from Hao Luo.
      
      9) Few accommodations in libbpf to support GCC-BPF quirks, from James Hilliard.
      
      10) Fix BPF verifier logic around tracking dynptr ref_obj_id, from Joanne Koong.
      
      11) bpftool improvements to handle full BPF program names better, from Manu
          Bretelle.
      
      12) bpftool fixes around libcap use, from Quentin Monnet.
      
      13) BPF map internals clean ups and improvements around memory allocations,
          from Yafang Shao.
      
      14) Allow to use cgroup_get_from_file() on cgroupv1, allowing BPF cgroup
          iterator to work on cgroupv1, from Yosry Ahmed.
      
      15) BPF verifier internal clean ups, from Dave Marchevsky and Joanne Koong.
      
      16) Various fixes and clean ups for selftests/bpf and vmtest.sh, from Daniel
          Xu, Artem Savkov, Joanne Koong, Andrii Nakryiko, Shibin Koikkara Reeny.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (45 commits)
        selftests/bpf: Few fixes for selftests/bpf built in release mode
        libbpf: Clean up deprecated and legacy aliases
        libbpf: Streamline bpf_attr and perf_event_attr initialization
        libbpf: Fix potential NULL dereference when parsing ELF
        selftests/bpf: Tests libbpf autoattach APIs
        libbpf: Allows disabling auto attach
        selftests/bpf: Fix attach point for non-x86 arches in test_progs/lsm
        libbpf: Making bpf_prog_load() ignore name if kernel doesn't support
        selftests/bpf: Update CI kconfig
        selftests/bpf: Add connmark read test
        selftests/bpf: Add existing connection bpf_*_ct_lookup() test
        bpftool: Clear errno after libcap's checks
        bpf: Clear up confusion in bpf_skb_adjust_room()'s documentation
        bpftool: Fix a typo in a comment
        libbpf: Add names for auxiliary maps
        bpf: Use bpf_map_area_alloc consistently on bpf map creation
        bpf: Make __GFP_NOWARN consistent in bpf map creation
        bpf: Use bpf_map_area_free instread of kvfree
        bpf: Remove unneeded memset in queue_stack_map creation
        libbpf: preserve errno across pr_warn/pr_info/pr_debug
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220817215656.1180215-1-andrii@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3f5f728a
  2. 17 Aug, 2022 23 commits
  3. 16 Aug, 2022 7 commits
    • Artem Savkov's avatar
      selftests/bpf: Fix attach point for non-x86 arches in test_progs/lsm · 807662ca
      Artem Savkov authored
      Use SYS_PREFIX macro from bpf_misc.h instead of hard-coded '__x64_'
      prefix for sys_setdomainname attach point in lsm test.
      Signed-off-by: default avatarArtem Savkov <asavkov@redhat.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220816055231.717006-1-asavkov@redhat.com
      807662ca
    • Jacob Keller's avatar
      ice: introduce ice_ptp_reset_cached_phctime function · b1a582e6
      Jacob Keller authored
      If the PTP hardware clock is adjusted, the ice driver must update the
      cached PHC timestamp. This is required in order to perform timestamp
      extension on the shorter timestamps captured by the PHY.
      
      Currently, we simply call ice_ptp_update_cached_phctime in the settime and
      adjtime callbacks. This has a few issues:
      
      1) if ICE_CFG_BUSY is set because another thread is updating the Rx rings,
         we will exit with an error. This is not checked, and the functions do
         not re-schedule the update. This could leave the cached timestamp
         incorrect until the next scheduled work item execution.
      
      2) even if we did handle an update, any currently outstanding Tx timestamp
         would be extended using the wrong cached PHC time. This would produce
         incorrect results.
      
      To fix these issues, introduce a new ice_ptp_reset_cached_phctime function.
      This function calls the ice_ptp_update_cached_phctime, and discards
      outstanding Tx timestamps.
      
      If the ice_ptp_update_cached_phctime function fails because ICE_CFG_BUSY is
      set, we log a warning and schedule the thread to execute soon. The update
      function is modified so that it always updates the cached copy in the PF
      regardless. This ensures we have the most up to date values possible and
      minimizes the risk of a packet timestamp being extended with the wrong
      value.
      
      It would be nice if we could skip reporting Rx timestamps until the cached
      values are up to date. However, we can't access the Rx rings while
      ICE_CFG_BUSY is set because they are actively being updated by another
      thread.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      b1a582e6
    • Jacob Keller's avatar
      ice: re-arrange some static functions in ice_ptp.c · 4b1251bd
      Jacob Keller authored
      A following change is going to want to make use of ice_ptp_flush_tx_tracker
      earlier in the ice_ptp.c file. To make this work, move the Tx timestamp
      tracking functions higher up in the file, and pull the
      ice_ptp_update_cached_timestamp function below them. This should have no
      functional change.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      4b1251bd
    • Jacob Keller's avatar
      ice: track and warn when PHC update is late · cd25507a
      Jacob Keller authored
      The ice driver requires a cached copy of the PHC time in order to perform
      timestamp extension on Tx and Rx hardware timestamp values. This cached PHC
      time must always be updated at least once every 2 seconds. Otherwise, the
      math used to perform the extension would produce invalid results.
      
      The updates are supposed to occur periodically in the PTP kthread work
      item, which is scheduled to run every half second. Thus, we do not expect
      an update to be delayed for so long. However, there are error conditions
      which can cause the update to be delayed.
      
      Track this situation by using jiffies to determine approximately how long
      ago the last update occurred. Add a new statistic and a dev_warn when we
      have failed to update the cached PHC time. This makes the error case more
      obvious.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      cd25507a
    • Jacob Keller's avatar
      ice: track Tx timestamp stats similar to other Intel drivers · f020481b
      Jacob Keller authored
      Several Intel networking drivers which support PTP track when Tx timestamps
      are skipped or when they timeout without a timestamp from hardware. The
      conditions which could cause these events are rare, but it can be useful to
      know when and how often they occur.
      
      Implement similar statistics for the ice driver, tx_hwtstamp_skipped,
      tx_hwtstamp_timeouts, and tx_hwtstamp_flushed.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      f020481b
    • Jacob Keller's avatar
      ice: initialize cached_phctime when creating Rx rings · cf6b82fd
      Jacob Keller authored
      When we create new Rx rings, the cached_phctime field is zero initialized.
      This could result in incorrect timestamp reporting due to the cached value
      not yet being updated. Although a background task will periodically update
      the cached value, ensure it matches the existing cached value in the PF
      structure at ring initialization.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      cf6b82fd
    • Jacob Keller's avatar
      ice: set tx_tstamps when creating new Tx rings via ethtool · b3b17374
      Jacob Keller authored
      When the user changes the number of queues via ethtool, the driver
      allocates new rings. This allocation did not initialize tx_tstamps. This
      results in the tx_tstamps field being zero (due to kcalloc allocation), and
      would result in a NULL pointer dereference when attempting a transmit
      timestamp on the new ring.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      b3b17374
  4. 15 Aug, 2022 7 commits
  5. 11 Aug, 2022 2 commits
    • Hangbin Liu's avatar
      libbpf: Add names for auxiliary maps · 10b62d6a
      Hangbin Liu authored
      The bpftool self-created maps can appear in final map show output due to
      deferred removal in kernel. These maps don't have a name, which would make
      users confused about where it comes from.
      
      With a libbpf_ prefix name, users could know who created these maps.
      It also could make some tests (like test_offload.py, which skip base maps
      without names as a workaround) filter them out.
      
      Kernel adds bpf prog/map name support in the same merge
      commit fadad670 ("Merge branch 'bpf-extend-info'"). So we can also use
      kernel_supports(NULL, FEAT_PROG_NAME) to check if kernel supports map name.
      
      As discussed [1], Let's make bpf_map_create accept non-null
      name string, and silently ignore the name if kernel doesn't support.
      
        [1] https://lore.kernel.org/bpf/CAEf4BzYL1TQwo1231s83pjTdFPk9XWWhfZC5=KzkU-VO0k=0Ug@mail.gmail.com/Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220811034020.529685-1-liuhangbin@gmail.com
      10b62d6a
    • Linus Torvalds's avatar
      Merge tag 'net-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 7ebfc85e
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bluetooth, bpf, can and netfilter.
      
        A little larger than usual but it's all fixes, no late features. It's
        large partially because of timing, and partially because of follow ups
        to stuff that got merged a week or so before the merge window and
        wasn't as widely tested. Maybe the Bluetooth fixes are a little
        alarming so we'll address that, but the rest seems okay and not scary.
      
        Notably we're including a fix for the netfilter Kconfig [1], your WiFi
        warning [2] and a bluetooth fix which should unblock syzbot [3].
      
        Current release - regressions:
      
         - Bluetooth:
            - don't try to cancel uninitialized works [3]
            - L2CAP: fix use-after-free caused by l2cap_chan_put
      
         - tls: rx: fix device offload after recent rework
      
         - devlink: fix UAF on failed reload and leftover locks in mlxsw
      
        Current release - new code bugs:
      
         - netfilter:
            - flowtable: fix incorrect Kconfig dependencies [1]
            - nf_tables: fix crash when nf_trace is enabled
      
         - bpf:
            - use proper target btf when exporting attach_btf_obj_id
            - arm64: fixes for bpf trampoline support
      
         - Bluetooth:
            - ISO: unlock on error path in iso_sock_setsockopt()
            - ISO: fix info leak in iso_sock_getsockopt()
            - ISO: fix iso_sock_getsockopt for BT_DEFER_SETUP
            - ISO: fix memory corruption on iso_pinfo.base
            - ISO: fix not using the correct QoS
            - hci_conn: fix updating ISO QoS PHY
      
         - phy: dp83867: fix get nvmem cell fail
      
        Previous releases - regressions:
      
         - wifi: cfg80211: fix validating BSS pointers in
           __cfg80211_connect_result [2]
      
         - atm: bring back zatm uAPI after ATM had been removed
      
         - properly fix old bug making bonding ARP monitor mode not being able
           to work with software devices with lockless Tx
      
         - tap: fix null-deref on skb->dev in dev_parse_header_protocol
      
         - revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP" it helps some
           devices and breaks others
      
         - netfilter:
            - nf_tables: many fixes rejecting cross-object linking which may
              lead to UAFs
            - nf_tables: fix null deref due to zeroed list head
            - nf_tables: validate variable length element extension
      
         - bgmac: fix a BUG triggered by wrong bytes_compl
      
         - bcmgenet: indicate MAC is in charge of PHY PM
      
        Previous releases - always broken:
      
         - bpf:
            - fix bad pointer deref in bpf_sys_bpf() injected via test infra
            - disallow non-builtin bpf programs calling the prog_run command
            - don't reinit map value in prealloc_lru_pop
            - fix UAFs during the read of map iterator fd
            - fix invalidity check for values in sk local storage map
            - reject sleepable program for non-resched map iterator
      
         - mptcp:
            - move subflow cleanup in mptcp_destroy_common()
            - do not queue data on closed subflows
      
         - virtio_net: fix memory leak inside XDP_TX with mergeable
      
         - vsock: fix memory leak when multiple threads try to connect()
      
         - rework sk_user_data sharing to prevent psock leaks
      
         - geneve: fix TOS inheriting for ipv4
      
         - tunnels & drivers: do not use RT_TOS for IPv6 flowlabel
      
         - phy: c45 baset1: do not skip aneg configuration if clock role is
           not specified
      
         - rose: avoid overflow when /proc displays timer information
      
         - x25: fix call timeouts in blocking connects
      
         - can: mcp251x: fix race condition on receive interrupt
      
         - can: j1939:
            - replace user-reachable WARN_ON_ONCE() with netdev_warn_once()
            - fix memory leak of skbs in j1939_session_destroy()
      
        Misc:
      
         - docs: bpf: clarify that many things are not uAPI
      
         - seg6: initialize induction variable to first valid array index (to
           silence clang vs objtool warning)
      
         - can: ems_usb: fix clang 14's -Wunaligned-access warning"
      
      * tag 'net-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (117 commits)
        net: atm: bring back zatm uAPI
        dpaa2-eth: trace the allocated address instead of page struct
        net: add missing kdoc for struct genl_multicast_group::flags
        nfp: fix use-after-free in area_cache_get()
        MAINTAINERS: use my korg address for mt7601u
        mlxsw: minimal: Fix deadlock in ports creation
        bonding: fix reference count leak in balance-alb mode
        net: usb: qmi_wwan: Add support for Cinterion MV32
        bpf: Shut up kern_sys_bpf warning.
        net/tls: Use RCU API to access tls_ctx->netdev
        tls: rx: device: don't try to copy too much on detach
        tls: rx: device: bound the frag walk
        net_sched: cls_route: remove from list when handle is 0
        selftests: forwarding: Fix failing tests with old libnet
        net: refactor bpf_sk_reuseport_detach()
        net: fix refcount bug in sk_psock_get (2)
        selftests/bpf: Ensure sleepable program is rejected by hash map iter
        selftests/bpf: Add write tests for sk local storage map iterator
        selftests/bpf: Add tests for reading a dangling map iter fd
        bpf: Only allow sleepable program for resched-able iterator
        ...
      7ebfc85e