1. Aug 02, 2022
  2. Aug 01, 2022
  3. Jul 30, 2022
    • Jakub Kicinski's avatar
      Merge tag 'mlx5-updates-2022-07-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 63757225
      Jakub Kicinski authored
      Saeed Mahameed says:
      
      ====================
      mlx5-updates-2022-07-28
      
      Misc updates to mlx5 driver:
      
      1) Gal corrects to use skb_tcp_all_headers on encapsulated skbs.
      
      2) Roi Adds the support for offloading standalone police actions.
      
      3) lama, did some refactoring to minimize code coupling with
      mlx5e_priv "god object" in some of the follows, and converts some of the
      objects to pointers to preserve on memory when these objects aren't needed.
      This is part one of two parts series.
      
      * tag 'mlx5-updates-2022-07-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
        net/mlx5e: Move mlx5e_init_l2_addr to en_main
        net/mlx5e: Split en_fs ndo's and move to en_main
        net/mlx5e: Separate mlx5e_set_rx_mode_work and move caller to en_main
        net/mlx5e: Add mdev to flow_steering struct
        net/mlx5e: Report flow steering errors with mdev err report API
        net/mlx5e: Convert mlx5e_flow_steering member of mlx5e_priv to pointer
        net/mlx5e: Allocate VLAN and TC for featured profiles only
        net/mlx5e: Make mlx5e_tc_table private
        net/mlx5e: Convert mlx5e_tc_table member of mlx5e_flow_steering to pointer
        net/mlx5e: TC, Support tc action api for police
        net/mlx5e: TC, Separate get/update/replace meter functions
        net/mlx5e: Add red and green counters for metering
        net/mlx5e: TC, Allocate post meter ft per rule
        net/mlx5: DR, Add support for flow metering ASO
        net/mlx5e: Fix wrong use of skb_tcp_all_headers() with encapsulation
      ====================
      
      Link: https://lore.kernel.org/r/20220728205728.143074-1-saeed@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      63757225
    • Jakub Kicinski's avatar
      Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue · 84a8d931
      Jakub Kicinski authored
      Tony Nguyen says:
      
      ====================
      100GbE Intel Wired LAN Driver Updates 2022-07-28
      
      This series contains updates to ice driver only.
      
      Michal allows for VF true promiscuous mode to be set for multiple VFs
      and adds clearing of promiscuous filters when VF trust is removed.
      
      Maciej refactors ice_set_features() to track/check changed features
      instead of constantly checking against netdev features and adds support for
      NETIF_F_LOOPBACK.
      
      * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue:
        ice: allow toggling loopback mode via ndo_set_features callback
        ice: compress branches in ice_set_features()
        ice: Fix promiscuous mode not turning off
        ice: Introduce enabling promiscuous mode on multiple VF's
      ====================
      
      Link: https://lore.kernel.org/r/20220728195538.3391360-1-anthony.l.nguyen@intel.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      84a8d931
    • Jakub Kicinski's avatar
      Merge branch 'sfc-vf-representors-for-ef100-rx-side' · ed3849e4
      Jakub Kicinski authored
      Edward Cree says:
      
      ====================
      sfc: VF representors for EF100 - RX side
      
      This series adds the receive path for EF100 VF representors, plus other
       minor features such as statistics.
      ====================
      
      Link: https://lore.kernel.org/r/cover.1659034549.git.ecree.xilinx@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ed3849e4
    • Edward Cree's avatar
      sfc: implement ethtool get/set RX ring size for EF100 reps · 7267aa6d
      Edward Cree authored
      
      
      It's not truly a ring, but the maximum length of the list of queued RX
       SKBs is analogous to an RX ring size, so use that API to configure it.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7267aa6d
    • Edward Cree's avatar
      sfc: use a dynamic m-port for representor RX and set it promisc · e37f3b15
      Edward Cree authored
      
      
      Representors do not want to be subject to the PF's Ethernet address
       filters, since traffic from VFs will typically have a destination
       either elsewhere on the link segment or on an overlay network.
      So, create a dynamic m-port with promiscuous and all-multicast
       filters, and set it as the egress port of representor default rules.
       Since the m-port is an alias of the calling PF's own m-port, traffic
       will still be delivered to the PF's RXQs, but it will be subject to
       the VNRX filter rules installed on the dynamic m-port (specified by
       the v-port ID field of the filter spec).
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e37f3b15
    • Edward Cree's avatar
      sfc: move table locking into filter_table_{probe,remove} methods · 77eb4074
      Edward Cree authored
      
      
      We need to be able to drop the efx->filter_sem in ef100_filter_table_up()
       so that we can call functions that insert filters (and thus take that
       rwsem for read), which means the efx->type->filter_table_probe method
       needs to be responsible for taking the lock in the first place.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      77eb4074
    • Edward Cree's avatar
      sfc: insert default MAE rules to connect VFs to representors · 67ab160e
      Edward Cree authored
      
      
      Default rules are low-priority switching rules which the hardware uses
       in the absence of higher-priority rules.  Each representor requires a
       corresponding rule matching traffic from its representee VF and
       delivering to the PF (where a check on INGRESS_MPORT in
       __ef100_rx_packet() will direct it to the representor).  No rule is
       required in the reverse direction, because representor TX uses a TX
       override descriptor to bypass the MAE and deliver directly to the VF.
      Since inserting any rule into the MAE disables the firmware's own
       default rules, also insert a pair of rules to connect the PF to the
       physical network port and vice-versa.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      67ab160e
    • Edward Cree's avatar
      sfc: receive packets from EF100 VFs into representors · f50e8fcd
      Edward Cree authored
      
      
      If the source m-port of a packet in __ef100_rx_packet() is a VF,
       hand off the packet to the corresponding representor with
       efx_ef100_rep_rx_packet().
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f50e8fcd
    • Edward Cree's avatar
      sfc: check ef100 RX packets are from the wire · 08d0b16e
      Edward Cree authored
      
      
      If not, for now drop them and warn.  A subsequent patch will look up
       the source m-port to try and find a representor to deliver them to.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      08d0b16e
    • Edward Cree's avatar
      sfc: determine wire m-port at EF100 PF probe time · 6f6838aa
      Edward Cree authored
      
      
      Traffic delivered to the (MAE admin) PF could be from either the wire
       or a VF.  The INGRESS_MPORT field of the RX prefix distinguishes these;
       base_mport is the value this field will have for traffic from the wire
       (which should be delivered to the PF's netdevice, not a representor).
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6f6838aa
    • Edward Cree's avatar
      sfc: ef100 representor RX top half · 9fe00c80
      Edward Cree authored
      
      
      Representor RX uses a NAPI context driven by a 'fake interrupt': when
       the parent PF receives a packet destined for the representor, it adds
       it to an SKB list (efv->rx_list), and schedules NAPI if the 'fake
       interrupt' is primed.  The NAPI poll then pulls packets off this list
       and feeds them to the stack with netif_receive_skb_list().
      This scheme allows us to decouple representor RX from the parent PF's
       RX fast-path.
      This patch implements the 'top half', which builds an SKB, copies data
       into it from the RX buffer (which can then be released), adds it to
       the queue and fires the 'fake interrupt' if necessary.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9fe00c80
    • Edward Cree's avatar
      sfc: ef100 representor RX NAPI poll · 69bb5fa7
      Edward Cree authored
      
      
      This patch adds the 'bottom half' napi->poll routine for representor RX.
      See the next patch (with the top half) for an explanation of the 'fake
       interrupt' scheme used to drive this NAPI context.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      69bb5fa7
    • Edward Cree's avatar
      sfc: plumb ef100 representor stats · a95115c4
      Edward Cree authored
      
      
      Implement .ndo_get_stats64() method to read values out of struct
       efx_rep_sw_stats.
      
      Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a95115c4
    • Dan Carpenter's avatar
      net: marvell: prestera: uninitialized variable bug · 71930846
      Dan Carpenter authored
      The "ret" variable needs to be initialized at the start.
      
      Fixes: 52323ef7
      
       ("net: marvell: prestera: add phylink support")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YuKeBBuGtsmd7QdT@kili
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      71930846
    • Yu Zhe's avatar
      dn_route: replace "jiffies-now>0" with "jiffies!=now" · 0f14a835
      Yu Zhe authored
      
      
      Use "jiffies != now" to replace "jiffies - now > 0" to make
      code more readable. We want to put a limit on how long the
      loop can run for before rescheduling.
      
      Signed-off-by: default avatarYu Zhe <yuzhe@nfschina.com>
      Link: https://lore.kernel.org/r/20220729061712.22666-1-yuzhe@nfschina.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0f14a835
    • Jakub Kicinski's avatar
      Merge tag 'wireless-next-2022-07-29' of... · ff4970b1
      Jakub Kicinski authored
      Merge tag 'wireless-next-2022-07-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
      
      Kalle Valo says:
      
      ====================
      wireless-next patches for v5.20
      
      Fourth set of patches for v5.20, last few patches before the merge
      window. Only driver changes this time, mostly just fixes and cleanup.
      
      Major changes:
      
      brcmfmac
       - support brcm,ccode-map-trivial DT property
      
      wcn36xx
       - add debugfs file to show firmware feature strings
      
      * tag 'wireless-next-2022-07-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (36 commits)
        wifi: rtw88: check the return value of alloc_workqueue()
        wifi: rtw89: 8852a: adjust IMR for SER L1
        wifi: rtw89: 8852a: update RF radio A/B R56
        wifi: wcn36xx: Add debugfs entry to read firmware feature strings
        wifi: wcn36xx: Move capability bitmap to string translation function to firmware.c
        wifi: wcn36xx: Move firmware feature bit storage to dedicated firmware.c file
        wifi: wcn36xx: Rename clunky firmware feature bit enum
        wifi: brcmfmac: prevent double-free on hardware-reset
        wifi: brcmfmac: support brcm,ccode-map-trivial DT property
        dt-bindings: bcm4329-fmac: add optional brcm,ccode-map-trivial
        wifi: brcmfmac: Replace default (not configured) MAC with a random MAC
        wifi: brcmfmac: Add brcmf_c_set_cur_etheraddr() helper
        wifi: brcmfmac: Remove #ifdef guards for PM related functions
        wifi: brcmfmac: use strreplace() in brcmf_of_probe()
        wifi: plfxlc: Use eth_zero_addr() to assign zero address
        wifi: wilc1000: use existing iftype variable to store the interface type
        wifi: wilc1000: add 'isinit' flag for SDIO bus similar to SPI
        wifi: wilc1000: cancel the connect operation during interface down
        wifi: wilc1000: get correct length of string WID from received config packet
        wifi: wilc1000: set station_info flag only when signal value is valid
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220729192832.A5011C433D6@smtp.kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ff4970b1
    • Jakub Kicinski's avatar
      Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 5fc7c588
      Jakub Kicinski authored
      Andrii Nakryiko says:
      
      ====================
       bpf-next 2022-07-29
      
      We've added 22 non-merge commits during the last 4 day(s) which contain
      a total of 27 files changed, 763 insertions(+), 120 deletions(-).
      
      The main changes are:
      
      1) Fixes to allow setting any source IP with bpf_skb_set_tunnel_key() helper,
         from Paul Chaignon.
      
      2) Fix for bpf_xdp_pointer() helper when doing sanity checking, from Joanne Koong.
      
      3) Fix for XDP frame length calculation, from Lorenzo Bianconi.
      
      4) Libbpf BPF_KSYSCALL docs improvements and fixes to selftests to accommodate
         s390x quirks with socketcall(), from Ilya Leoshkevich.
      
      5) Allow/denylist and CI configs additions to selftests/bpf to improve BPF CI,
         from Daniel Müller.
      
      6) BPF trampoline + ftrace follow up fixes, from Song Liu and Xu Kuohai.
      
      7) Fix allocation warnings in netdevsim, from Jakub Kicinski.
      
      8) bpf_obj_get_opts() libbpf API allowing to provide file flags, from Joe Burton.
      
      9) vsnprintf usage fix in bpf_snprintf_btf(), from Fedor Tokarev.
      
      10) Various small fixes and clean ups, from Daniel Müller, Rongguang Wei,
          Jörn-Thorben Hinz, Yang Li.
      
      * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (22 commits)
        bpf: Remove unneeded semicolon
        libbpf: Add bpf_obj_get_opts()
        netdevsim: Avoid allocation warnings triggered from user space
        bpf: Fix NULL pointer dereference when registering bpf trampoline
        bpf: Fix test_progs -j error with fentry/fexit tests
        selftests/bpf: Bump internal send_signal/send_signal_tracepoint timeout
        bpftool: Don't try to return value from void function in skeleton
        bpftool: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
        bpf: btf: Fix vsnprintf return value check
        libbpf: Support PPC in arch_specific_syscall_pfx
        selftests/bpf: Adjust vmtest.sh to use local kernel configuration
        selftests/bpf: Copy over libbpf configs
        selftests/bpf: Sort configuration
        selftests/bpf: Attach to socketcall() in test_probe_user
        libbpf: Extend BPF_KSYSCALL documentation
        bpf, devmap: Compute proper xdp_frame len redirecting frames
        bpf: Fix bpf_xdp_pointer return pointer
        selftests/bpf: Don't assign outer source IP to host
        bpf: Set flow flag to allow any source IP in bpf_tunnel_key
        geneve: Use ip_tunnel_key flow flags in route lookups
        ...
      ====================
      
      Link: https://lore.kernel.org/r/20220729230948.1313527-1-andrii@kernel.org
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5fc7c588
    • Yang Li's avatar
      bpf: Remove unneeded semicolon · 14250fa4
      Yang Li authored
      
      
      Eliminate the following coccicheck warning:
      /kernel/bpf/trampoline.c:101:2-3: Unneeded semicolon
      
      Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220725222733.55613-1-yang.lee@linux.alibaba.com
      14250fa4
    • Joe Burton's avatar
      libbpf: Add bpf_obj_get_opts() · 395fc4fa
      Joe Burton authored
      
      
      Add an extensible variant of bpf_obj_get() capable of setting the
      `file_flags` parameter.
      
      This parameter is needed to enable unprivileged access to BPF maps.
      Without a method like this, users must manually make the syscall.
      
      Signed-off-by: default avatarJoe Burton <jevburton@google.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220729202727.3311806-1-jevburton.kernel@gmail.com
      395fc4fa
    • Jakub Kicinski's avatar
      netdevsim: Avoid allocation warnings triggered from user space · d0b80a9e
      Jakub Kicinski authored
      We need to suppress warnings from sily map sizes. Also switch
      from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood
      the flags when writing this code.
      
      Fixes: 395cacb5
      
       ("netdevsim: bpf: support fake map offload")
      Reported-by: default avatar <syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220726213605.154204-1-kuba@kernel.org
      d0b80a9e
    • Xu Kuohai's avatar
      bpf: Fix NULL pointer dereference when registering bpf trampoline · 3b317abc
      Xu Kuohai authored
      A panic was reported on arm64:
      
      [   44.517109] audit: type=1334 audit(1658859870.268:59): prog-id=19 op=LOAD
      [   44.622031] Unable to handle kernel NULL pointer dereference at
      virtual address 0000000000000010
      [   44.624321] Mem abort info:
      [   44.625049]   ESR = 0x0000000096000004
      [   44.625935]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   44.627182]   SET = 0, FnV = 0
      [   44.627930]   EA = 0, S1PTW = 0
      [   44.628684]   FSC = 0x04: level 0 translation fault
      [   44.629788] Data abort info:
      [   44.630474]   ISV = 0, ISS = 0x00000004
      [   44.631362]   CM = 0, WnR = 0
      [   44.632041] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000100ab5000
      [   44.633494] [0000000000000010] pgd=0000000000000000, p4d=0000000000000000
      [   44.635202] Internal error: Oops: 96000004 [#1] SMP
      [   44.636452] Modules linked in: xfs crct10dif_ce ghash_ce virtio_blk
      virtio_console virtio_mmio qemu_fw_cfg
      [   44.638713] CPU: 2 PID: 1 Comm: systemd Not tainted 5.19.0-rc7 #1
      [   44.640164] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      [   44.641799] pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      [   44.643404] pc : ftrace_set_filter_ip+0x24/0xa0
      [   44.644659] lr : bpf_trampoline_update.constprop.0+0x428/0x4a0
      [   44.646118] sp : ffff80000803b9f0
      [   44.646950] x29: ffff80000803b9f0 x28: ffff0b5d80364400 x27: ffff80000803bb48
      [   44.648721] x26: ffff8000085ad000 x25: ffff0b5d809d2400 x24: 0000000000000000
      [   44.650493] x23: 00000000ffffffed x22: ffff0b5dd7ea0900 x21: 0000000000000000
      [   44.652279] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
      [   44.654067] x17: 0000000000000000 x16: 0000000000000000 x15: ffffffffffffffff
      [   44.655787] x14: ffff0b5d809d2498 x13: ffff0b5d809d2432 x12: 0000000005f5e100
      [   44.657535] x11: abcc77118461cefd x10: 000000000000005f x9 : ffffa7219cb5b190
      [   44.659254] x8 : ffffa7219c8e0000 x7 : 0000000000000000 x6 : ffffa7219db075e0
      [   44.661066] x5 : ffffa7219d3130e0 x4 : ffffa7219cab9da0 x3 : 0000000000000000
      [   44.662837] x2 : 0000000000000000 x1 : ffffa7219cb7a5c0 x0 : 0000000000000000
      [   44.664675] Call trace:
      [   44.665274]  ftrace_set_filter_ip+0x24/0xa0
      [   44.666327]  bpf_trampoline_update.constprop.0+0x428/0x4a0
      [   44.667696]  __bpf_trampoline_link_prog+0xcc/0x1c0
      [   44.668834]  bpf_trampoline_link_prog+0x40/0x64
      [   44.669919]  bpf_tracing_prog_attach+0x120/0x490
      [   44.671011]  link_create+0xe0/0x2b0
      [   44.671869]  __sys_bpf+0x484/0xd30
      [   44.672706]  __arm64_sys_bpf+0x30/0x40
      [   44.673678]  invoke_syscall+0x78/0x100
      [   44.674623]  el0_svc_common.constprop.0+0x4c/0xf4
      [   44.675783]  do_el0_svc+0x38/0x4c
      [   44.676624]  el0_svc+0x34/0x100
      [   44.677429]  el0t_64_sync_handler+0x11c/0x150
      [   44.678532]  el0t_64_sync+0x190/0x194
      [   44.679439] Code: 2a0203f4 f90013f5 2a0303f5 f9001fe1 (f9400800)
      [   44.680959] ---[ end trace 0000000000000000 ]---
      [   44.682111] Kernel panic - not syncing: Oops: Fatal exception
      [   44.683488] SMP: stopping secondary CPUs
      [   44.684551] Kernel Offset: 0x2721948e0000 from 0xffff800008000000
      [   44.686095] PHYS_OFFSET: 0xfffff4a380000000
      [   44.687144] CPU features: 0x010,00022811,19001080
      [   44.688308] Memory Limit: none
      [   44.689082] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---
      
      It's caused by a NULL tr->fops passed to ftrace_set_filter_ip(). tr->fops
      is initialized to NULL and is assigned to an allocated memory address if
      CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is enabled. Since there is no
      direct call on arm64 yet, the config can't be enabled.
      
      To fix it, call ftrace_set_filter_ip() only if tr->fops is not NULL.
      
      Fixes: 00963a2e
      
       ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
      Reported-by: default avatarBruno Goncalves <bgoncalv@redhat.com>
      Signed-off-by: default avatarXu Kuohai <xukuohai@huawei.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Tested-by: default avatarBruno Goncalves <bgoncalv@redhat.com>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: https://lore.kernel.org/bpf/20220728114048.3540461-1-xukuohai@huaweicloud.com
      3b317abc
    • Song Liu's avatar
      bpf: Fix test_progs -j error with fentry/fexit tests · dc81f8d1
      Song Liu authored
      When multiple threads are attaching/detaching fentry/fexit programs to
      the same trampoline, we may call register_fentry on the same trampoline
      twice: register_fentry(), unregister_fentry(), then register_fentry again.
      This causes ftrace_set_filter_ip() for the same ip on tr->fops twice,
      which leaves duplicated ip in tr->fops. The extra ip is not cleaned up
      properly on unregister and thus causes failures with further register in
      register_ftrace_direct_multi():
      
      register_ftrace_direct_multi()
      {
              ...
              for (i = 0; i < size; i++) {
                      hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
                              if (ftrace_find_rec_direct(entry->ip))
                                      goto out_unlock;
                      }
              }
              ...
      }
      
      This can be triggered with parallel fentry/fexit tests with test_progs:
      
        ./test_progs -t fentry,fexit -j
      
      Fix this by resetting tr->fops in ftrace_set_filter_ip(), so that there
      will never be duplicated entries in tr->fops.
      
      Fixes: 00963a2e
      
       ("bpf: Support bpf_trampoline on functions with IPMODIFY (e.g. livepatch)")
      Reported-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220729194106.1207472-1-song@kernel.org
      dc81f8d1
    • Daniel Müller's avatar
      selftests/bpf: Bump internal send_signal/send_signal_tracepoint timeout · 639de43e
      Daniel Müller authored
      
      
      The send_signal/send_signal_tracepoint is pretty flaky, with at least
      one failure in every ten runs on a few attempts I've tried it:
        > test_send_signal_common:PASS:pipe_c2p 0 nsec
        > test_send_signal_common:PASS:pipe_p2c 0 nsec
        > test_send_signal_common:PASS:fork 0 nsec
        > test_send_signal_common:PASS:skel_open_and_load 0 nsec
        > test_send_signal_common:PASS:skel_attach 0 nsec
        > test_send_signal_common:PASS:pipe_read 0 nsec
        > test_send_signal_common:PASS:pipe_write 0 nsec
        > test_send_signal_common:PASS:reading pipe 0 nsec
        > test_send_signal_common:PASS:reading pipe error: size 0 0 nsec
        > test_send_signal_common:FAIL:incorrect result unexpected incorrect result: actual 48 != expected 50
        > test_send_signal_common:PASS:pipe_write 0 nsec
        > #139/1   send_signal/send_signal_tracepoint:FAIL
      
      The reason does not appear to be a correctness issue in the strict
      sense. Rather, we merely do not receive the signal we are waiting for
      within the provided timeout.
      Let's bump the timeout by a factor of ten. With that change I have not
      been able to reproduce the failure in 150+ iterations. I am also sneaking
      in a small simplification to the test_progs test selection logic.
      
      Signed-off-by: default avatarDaniel Müller <deso@posteo.net>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/20220727182955.4044988-1-deso@posteo.net
      639de43e