1. 27 Oct, 2023 28 commits
  2. 26 Oct, 2023 12 commits
    • Jakub Kicinski's avatar
      netlink: make range pointers in policies const · ea23fbd2
      Jakub Kicinski authored
      struct nla_policy is usually constant itself, but unless
      we make the ranges inside constant we won't be able to
      make range structs const. The ranges are not modified
      by the core.
      Reviewed-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Link: https://lore.kernel.org/r/20231025162204.132528-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ea23fbd2
    • Przemek Kitszel's avatar
      net/mlx5: fix uninit value use · 5af8d8ce
      Przemek Kitszel authored
      Avoid use of uninitialized state variable.
      
      In case of mlx5e_tx_reporter_build_diagnose_output_sq_common() it's better
      to still collect other data than bail out entirely.
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Link: https://lore.kernel.org/netdev/8bd30131-c9f2-4075-a575-7fa2793a1760@moroto.mountain
      Fixes: d17f98bf ("net/mlx5: devlink health: use retained error fmsg API")
      Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Link: https://lore.kernel.org/r/20231025145050.36114-1-przemyslaw.kitszel@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5af8d8ce
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · ec4c20ca
      Jakub Kicinski authored
      Cross-merge networking fixes after downstream PR.
      
      Conflicts:
      
      net/mac80211/rx.c
        91535613 ("wifi: mac80211: don't drop all unprotected public action frames")
        6c02fab7 ("wifi: mac80211: split ieee80211_drop_unencrypted_mgmt() return value")
      
      Adjacent changes:
      
      drivers/net/ethernet/apm/xgene/xgene_enet_main.c
        61471264 ("net: ethernet: apm: Convert to platform remove callback returning void")
        d2ca43f3 ("net: xgene: Fix unused xgene_enet_of_match warning for !CONFIG_OF")
      
      net/vmw_vsock/virtio_transport.c
        64c99d2d ("vsock/virtio: support to send non-linear skb")
        53b08c49 ("vsock/virtio: initialize the_virtio_vsock before using VQs")
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec4c20ca
    • Linus Torvalds's avatar
      Merge tag 'net-6.6-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · c17cda15
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from WiFi and netfilter.
      
        Most regressions addressed here come from quite old versions, with the
        exceptions of the iavf one and the WiFi fixes. No known outstanding
        reports or investigation.
      
        Fixes to fixes:
      
         - eth: iavf: in iavf_down, disable queues when removing the driver
      
        Previous releases - regressions:
      
         - sched: act_ct: additional checks for outdated flows
      
         - tcp: do not leave an empty skb in write queue
      
         - tcp: fix wrong RTO timeout when received SACK reneging
      
         - wifi: cfg80211: pass correct pointer to rdev_inform_bss()
      
         - eth: i40e: sync next_to_clean and next_to_process for programming
           status desc
      
         - eth: iavf: initialize waitqueues before starting watchdog_task
      
        Previous releases - always broken:
      
         - eth: r8169: fix data-races
      
         - eth: igb: fix potential memory leak in igb_add_ethtool_nfc_entry
      
         - eth: r8152: avoid writing garbage to the adapter's registers
      
         - eth: gtp: fix fragmentation needed check with gso"
      
      * tag 'net-6.6-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (43 commits)
        iavf: in iavf_down, disable queues when removing the driver
        vsock/virtio: initialize the_virtio_vsock before using VQs
        net: ipv6: fix typo in comments
        net: ipv4: fix typo in comments
        net/sched: act_ct: additional checks for outdated flows
        netfilter: flowtable: GC pushes back packets to classic path
        i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
        gtp: fix fragmentation needed check with gso
        gtp: uapi: fix GTPA_MAX
        Fix NULL pointer dereference in cn_filter()
        sfc: cleanup and reduce netlink error messages
        net/handshake: fix file ref count in handshake_nl_accept_doit()
        wifi: mac80211: don't drop all unprotected public action frames
        wifi: cfg80211: fix assoc response warning on failed links
        wifi: cfg80211: pass correct pointer to rdev_inform_bss()
        isdn: mISDN: hfcsusb: Spelling fix in comment
        tcp: fix wrong RTO timeout when received SACK reneging
        r8152: Block future register access if register access fails
        r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE
        r8152: Check for unplug in r8153b_ups_en() / r8153c_ups_en()
        ...
      c17cda15
    • Nikolay Aleksandrov's avatar
      netkit: Remove explicit active/peer ptr initialization · ea41b880
      Nikolay Aleksandrov authored
      Remove the explicit NULLing of active/peer pointers and rely on the
      implicit one done at net device allocation.
      Suggested-by: default avatarJiri Pirko <jiri@resnulli.us>
      Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20231026094106.1505892-2-razor@blackwall.org
      ea41b880
    • Yafang Shao's avatar
      selftests/bpf: Fix selftests broken by mitigations=off · 399f6185
      Yafang Shao authored
      When we configure the kernel command line with 'mitigations=off' and set
      the sysctl knob 'kernel.unprivileged_bpf_disabled' to 0, the commit
      bc5bc309 ("bpf: Inherit system settings for CPU security mitigations")
      causes issues in the execution of `test_progs -t verifier`. This is
      because 'mitigations=off' bypasses Spectre v1 and Spectre v4 protections.
      
      Currently, when a program requests to run in unprivileged mode
      (kernel.unprivileged_bpf_disabled = 0), the BPF verifier may prevent
      it from running due to the following conditions not being enabled:
      
        - bypass_spec_v1
        - bypass_spec_v4
        - allow_ptr_leaks
        - allow_uninit_stack
      
      While 'mitigations=off' enables the first two conditions, it does not
      enable the latter two. As a result, some test cases in
      'test_progs -t verifier' that were expected to fail to run may run
      successfully, while others still fail but with different error messages.
      This makes it challenging to address them comprehensively.
      
      Moreover, in the future, we may introduce more fine-grained control over
      CPU mitigations, such as enabling only bypass_spec_v1 or bypass_spec_v4.
      
      Given the complexity of the situation, rather than fixing each broken test
      case individually, it's preferable to skip them when 'mitigations=off' is
      in effect and introduce specific test cases for the new 'mitigations=off'
      scenario. For instance, we can introduce new BTF declaration tags like
      '__failure__nospec', '__failure_nospecv1' and '__failure_nospecv4'.
      
      In this patch, the approach is to simply skip the broken test cases when
      'mitigations=off' is enabled. The result of `test_progs -t verifier` as
      follows after this commit,
      
      Before this commit
      ==================
      
      - without 'mitigations=off'
        - kernel.unprivileged_bpf_disabled = 2
          Summary: 74/948 PASSED, 388 SKIPPED, 0 FAILED
        - kernel.unprivileged_bpf_disabled = 0
          Summary: 74/1336 PASSED, 0 SKIPPED, 0 FAILED    <<<<
      - with 'mitigations=off'
        - kernel.unprivileged_bpf_disabled = 2
          Summary: 74/948 PASSED, 388 SKIPPED, 0 FAILED
        - kernel.unprivileged_bpf_disabled = 0
          Summary: 63/1276 PASSED, 0 SKIPPED, 11 FAILED   <<<< 11 FAILED
      
      After this commit
      =================
      
      - without 'mitigations=off'
        - kernel.unprivileged_bpf_disabled = 2
          Summary: 74/948 PASSED, 388 SKIPPED, 0 FAILED
        - kernel.unprivileged_bpf_disabled = 0
          Summary: 74/1336 PASSED, 0 SKIPPED, 0 FAILED    <<<<
      - with this patch, with 'mitigations=off'
        - kernel.unprivileged_bpf_disabled = 2
          Summary: 74/948 PASSED, 388 SKIPPED, 0 FAILED
        - kernel.unprivileged_bpf_disabled = 0
          Summary: 74/948 PASSED, 388 SKIPPED, 0 FAILED   <<<< SKIPPED
      
      Fixes: bc5bc309 ("bpf: Inherit system settings for CPU security mitigations")
      Reported-by: default avatarAlexei Starovoitov <alexei.starovoitov@gmail.com>
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
      Closes: https://lore.kernel.org/bpf/CAADnVQKUBJqg+hHtbLeeC2jhoJAWqnmRAzXW3hmUCNSV9kx4sQ@mail.gmail.com
      Link: https://lore.kernel.org/bpf/20231025031144.5508-1-laoar.shao@gmail.com
      399f6185
    • Viktor Malik's avatar
      samples/bpf: Allow building with custom bpftool · 37db10bc
      Viktor Malik authored
      samples/bpf build its own bpftool boostrap to generate vmlinux.h as well
      as some BPF objects. This is a redundant step if bpftool has been
      already built, so update samples/bpf/Makefile such that it accepts a
      path to bpftool passed via the BPFTOOL variable. The approach is
      practically the same as tools/testing/selftests/bpf/Makefile uses.
      Signed-off-by: default avatarViktor Malik <vmalik@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/bd746954ac271b02468d8d951ff9f11e655d485b.1698213811.git.vmalik@redhat.com
      37db10bc
    • Viktor Malik's avatar
      samples/bpf: Fix passing LDFLAGS to libbpf · f56bcfad
      Viktor Malik authored
      samples/bpf/Makefile passes LDFLAGS=$(TPROGS_LDFLAGS) to libbpf build
      without surrounding quotes, which may cause compilation errors when
      passing custom TPROGS_USER_LDFLAGS.
      
      For example:
      
          $ make -C samples/bpf/ TPROGS_USER_LDFLAGS="-Wl,--as-needed -specs=/usr/lib/gcc/x86_64-redhat-linux/13/libsanitizer.spec"
          make: Entering directory './samples/bpf'
          make -C ../../ M=./samples/bpf BPF_SAMPLES_PATH=./samples/bpf
          make[1]: Entering directory '.'
          make -C ./samples/bpf/../../tools/lib/bpf RM='rm -rf' EXTRA_CFLAGS="-Wall -O2 -Wmissing-prototypes -Wstrict-prototypes  -I./usr/include -I./tools/testing/selftests/bpf/ -I./samples/bpf/libbpf/include -I./tools/include -I./tools/perf -I./tools/lib -DHAVE_ATTR_TEST=0" \
                  LDFLAGS=-Wl,--as-needed -specs=/usr/lib/gcc/x86_64-redhat-linux/13/libsanitizer.spec srctree=./samples/bpf/../../ \
                  O= OUTPUT=./samples/bpf/libbpf/ DESTDIR=./samples/bpf/libbpf prefix= \
                  ./samples/bpf/libbpf/libbpf.a install_headers
          make: invalid option -- 'c'
          make: invalid option -- '='
          make: invalid option -- '/'
          make: invalid option -- 'u'
          make: invalid option -- '/'
          [...]
      
      Fix the error by properly quoting $(TPROGS_LDFLAGS).
      Suggested-by: default avatarDonald Zickus <dzickus@redhat.com>
      Signed-off-by: default avatarViktor Malik <vmalik@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/c690de6671cc6c983d32a566d33fd7eabd18b526.1698213811.git.vmalik@redhat.com
      f56bcfad
    • Viktor Malik's avatar
      samples/bpf: Allow building with custom CFLAGS/LDFLAGS · 870f09f1
      Viktor Malik authored
      Currently, it is not possible to specify custom flags when building
      samples/bpf. The flags are defined in TPROGS_CFLAGS/TPROGS_LDFLAGS
      variables, however, when trying to override those from the make command,
      compilation fails.
      
      For example, when trying to build with PIE:
      
          $ make -C samples/bpf TPROGS_CFLAGS="-fpie" TPROGS_LDFLAGS="-pie"
      
      This is because samples/bpf/Makefile updates these variables, especially
      appends include paths to TPROGS_CFLAGS and these updates are overridden
      by setting the variables from the make command.
      
      This patch introduces variables TPROGS_USER_CFLAGS/TPROGS_USER_LDFLAGS
      for this purpose, which can be set from the make command and their
      values are propagated to TPROGS_CFLAGS/TPROGS_LDFLAGS.
      Signed-off-by: default avatarViktor Malik <vmalik@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/2d81100b830a71f0e72329cc7781edaefab75f62.1698213811.git.vmalik@redhat.com
      870f09f1
    • Beniamino Galvani's avatar
      bareudp: use ports to lookup route · ef113733
      Beniamino Galvani authored
      The source and destination ports should be taken into account when
      determining the route destination; they can affect the result, for
      example in case there are routing rules defined.
      Signed-off-by: default avatarBeniamino Galvani <b.galvani@gmail.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/20231025094441.417464-1-b.galvani@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      ef113733
    • Hou Tao's avatar
      bpf: Add more WARN_ON_ONCE checks for mismatched alloc and free · c421c125
      Hou Tao authored
      There are two possible mismatched alloc and free cases in BPF memory
      allocator:
      
      1) allocate from cache X but free by cache Y with a different unit_size
      2) allocate from per-cpu cache but free by kmalloc cache or vice versa
      
      So add more WARN_ON_ONCE checks in free_bulk() and __free_by_rcu() to
      spot these mismatched alloc and free early.
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20231021014959.3563841-1-houtao@huaweicloud.com
      c421c125
    • Paolo Abeni's avatar
      Merge tag 'nf-next-23-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next · 39673361
      Paolo Abeni authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter updates for net-next
      
      The following patchset contains Netfilter updates for net-next. Mostly
      nf_tables updates with two patches for connlabel and br_netfilter.
      
      1) Rename function name to perform on-demand GC for rbtree elements,
         and replace async GC in rbtree by sync GC. Patches from Florian Westphal.
      
      2) Use commit_mutex for NFT_MSG_GETRULE_RESET to ensure that two
         concurrent threads invoking this command do not underrun stateful
         objects. Patches from Phil Sutter.
      
      3) Use single hook to deal with IP and ARP packets in br_netfilter.
         Patch from Florian Westphal.
      
      4) Use atomic_t in netns->connlabel use counter instead of using a
         spinlock, also patch from Florian.
      
      5) Cleanups for stateful objects infrastructure in nf_tables.
         Patches from Phil Sutter.
      
      6) Flush path uses opaque set element offered by the iterator, instead of
         calling pipapo_deactivate() which looks up for it again.
      
      7) Set backend .flush interface always succeeds, make it return void
         instead.
      
      8) Add struct nft_elem_priv placeholder structure and use it by replacing
         void * to pass opaque set element representation from backend to frontend
         which defeats compiler type checks.
      
      9) Shrink memory consumption of set element transactions, by reducing
         struct nft_trans_elem object size and reducing stack memory usage.
      
      10) Use struct nft_elem_priv also for set backend .insert operation too.
      
      11) Carry reset flag in nft_set_dump_ctx structure, instead of passing it
          as a function argument, from Phil Sutter.
      
      netfilter pull request 23-10-25
      
      * tag 'nf-next-23-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next:
        netfilter: nf_tables: Carry reset boolean in nft_set_dump_ctx
        netfilter: nf_tables: set->ops->insert returns opaque set element in case of EEXIST
        netfilter: nf_tables: shrink memory consumption of set elements
        netfilter: nf_tables: expose opaque set element as struct nft_elem_priv
        netfilter: nf_tables: set backend .flush always succeeds
        netfilter: nft_set_pipapo: no need to call pipapo_deactivate() from flush
        netfilter: nf_tables: Carry reset boolean in nft_obj_dump_ctx
        netfilter: nf_tables: nft_obj_filter fits into cb->ctx
        netfilter: nf_tables: Carry s_idx in nft_obj_dump_ctx
        netfilter: nf_tables: A better name for nft_obj_filter
        netfilter: nf_tables: Unconditionally allocate nft_obj_filter
        netfilter: nf_tables: Drop pointless memset in nf_tables_dump_obj
        netfilter: conntrack: switch connlabels to atomic_t
        br_netfilter: use single forward hook for ip and arp
        netfilter: nf_tables: Add locking for NFT_MSG_GETRULE_RESET requests
        netfilter: nf_tables: Introduce nf_tables_getrule_single()
        netfilter: nf_tables: Open-code audit log call in nf_tables_getrule()
        netfilter: nft_set_rbtree: prefer sync gc to async worker
        netfilter: nft_set_rbtree: rename gc deactivate+erase function
      ====================
      
      Link: https://lore.kernel.org/r/20231025212555.132775-1-pablo@netfilter.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      39673361