1. 20 Jan, 2023 13 commits
    • Linus Torvalds's avatar
      Merge tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 5deaa985
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from wireless, bluetooth, bpf and netfilter.
      
        Current release - regressions:
      
         - Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6
           addrconf", fix nsna_ping mode of team
      
         - wifi: mt76: fix bugs in Rx queue handling and DMA mapping
      
         - eth: mlx5:
            - add missing mutex_unlock in error reporter
            - protect global IPsec ASO with a lock
      
        Current release - new code bugs:
      
         - rxrpc: fix wrong error return in rxrpc_connect_call()
      
        Previous releases - regressions:
      
         - bluetooth: hci_sync: fix use of HCI_OP_LE_READ_BUFFER_SIZE_V2
      
         - wifi:
            - mac80211: fix crashes on Rx due to incorrect initialization of
              rx->link and rx->link_sta
            - mac80211: fix bugs in iTXQ conversion - Tx stalls, incorrect
              aggregation handling, crashes
            - brcmfmac: fix regression for Broadcom PCIe wifi devices
            - rndis_wlan: prevent buffer overflow in rndis_query_oid
      
         - netfilter: conntrack: handle tcp challenge acks during connection
           reuse
      
         - sched: avoid grafting on htb_destroy_class_offload when destroying
      
         - virtio-net: correctly enable callback during start_xmit, fix stalls
      
         - tcp: avoid the lookup process failing to get sk in ehash table
      
         - ipa: disable ipa interrupt during suspend
      
         - eth: stmmac: enable all safety features by default
      
        Previous releases - always broken:
      
         - bpf:
            - fix pointer-leak due to insufficient speculative store bypass
              mitigation (Spectre v4)
            - skip task with pid=1 in send_signal_common() to avoid a splat
            - fix BPF program ID information in BPF_AUDIT_UNLOAD as well as
              PERF_BPF_EVENT_PROG_UNLOAD events
            - fix potential deadlock in htab_lock_bucket from same bucket
              index but different map_locked index
      
         - bluetooth:
            - fix a buffer overflow in mgmt_mesh_add()
            - hci_qca: fix driver shutdown on closed serdev
            - ISO: fix possible circular locking dependency
            - CIS: hci_event: fix invalid wait context
      
         - wifi: brcmfmac: fixes for survey dump handling
      
         - mptcp: explicitly specify sock family at subflow creation time
      
         - netfilter: nft_payload: incorrect arithmetics when fetching VLAN
           header bits
      
         - tcp: fix rate_app_limited to default to 1
      
         - l2tp: close all race conditions in l2tp_tunnel_register()
      
         - eth: mlx5: fixes for QoS config and eswitch configuration
      
         - eth: enetc: avoid deadlock in enetc_tx_onestep_tstamp()
      
         - eth: stmmac: fix invalid call to mdiobus_get_phy()
      
        Misc:
      
         - ethtool: add netlink attr in rss get reply only if the value is not
           empty"
      
      * tag 'net-6.2-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (88 commits)
        Revert "Merge branch 'octeontx2-af-CPT'"
        tcp: fix rate_app_limited to default to 1
        bnxt: Do not read past the end of test names
        net: stmmac: enable all safety features by default
        octeontx2-af: add mbox to return CPT_AF_FLT_INT info
        octeontx2-af: update cpt lf alloc mailbox
        octeontx2-af: restore rxc conf after teardown sequence
        octeontx2-af: optimize cpt pf identification
        octeontx2-af: modify FLR sequence for CPT
        octeontx2-af: add mbox for CPT LF reset
        octeontx2-af: recover CPT engine when it gets fault
        net: dsa: microchip: ksz9477: port map correction in ALU table entry register
        selftests/net: toeplitz: fix race on tpacket_v3 block close
        net/ulp: use consistent error code when blocking ULP
        octeontx2-pf: Fix the use of GFP_KERNEL in atomic context on rt
        tcp: avoid the lookup process failing to get sk in ehash table
        Revert "net: team: use IFF_NO_ADDRCONF flag to prevent ipv6 addrconf"
        MAINTAINERS: add networking entries for Willem
        net: sched: gred: prevent races when adding offloads to stats
        l2tp: prevent lockdep issue in l2tp_tunnel_register()
        ...
      5deaa985
    • Jakub Kicinski's avatar
      Revert "Merge branch 'octeontx2-af-CPT'" · 45a919bb
      Jakub Kicinski authored
      This reverts commit b4fbf0b2, reversing
      changes made to 6c977c5c.
      
      This seems like net-next material.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      45a919bb
    • David Morley's avatar
      tcp: fix rate_app_limited to default to 1 · 300b655d
      David Morley authored
      The initial default value of 0 for tp->rate_app_limited was incorrect,
      since a flow is indeed application-limited until it first sends
      data. Fixing the default to be 1 is generally correct but also
      specifically will help user-space applications avoid using the initial
      tcpi_delivery_rate value of 0 that persists until the connection has
      some non-zero bandwidth sample.
      
      Fixes: eb8329e0 ("tcp: export data delivery rate")
      Suggested-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarDavid Morley <morleyd@google.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Tested-by: default avatarDavid Morley <morleyd@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      300b655d
    • Kees Cook's avatar
      bnxt: Do not read past the end of test names · d3e599c0
      Kees Cook authored
      Test names were being concatenated based on a offset beyond the end of
      the first name, which tripped the buffer overflow detection logic:
      
       detected buffer overflow in strnlen
       [...]
       Call Trace:
       bnxt_ethtool_init.cold+0x18/0x18
      
      Refactor struct hwrm_selftest_qlist_output to use an actual array,
      and adjust the concatenation to use snprintf() rather than a series of
      strncat() calls.
      Reported-by: default avatarNiklas Cassel <Niklas.Cassel@wdc.com>
      Link: https://lore.kernel.org/lkml/Y8F%2F1w1AZTvLglFX@x1-carbon/Tested-by: default avatarNiklas Cassel <Niklas.Cassel@wdc.com>
      Fixes: eb513658 ("bnxt_en: Add basic ethtool -t selftest support.")
      Cc: Michael Chan <michael.chan@broadcom.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: netdev@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d3e599c0
    • Andrew Halaney's avatar
      net: stmmac: enable all safety features by default · fdfc76a1
      Andrew Halaney authored
      In the original implementation of dwmac5
      commit 8bf993a5 ("net: stmmac: Add support for DWMAC5 and implement Safety Features")
      all safety features were enabled by default.
      
      Later it seems some implementations didn't have support for all the
      features, so in
      commit 5ac712dc ("net: stmmac: enable platform specific safety features")
      the safety_feat_cfg structure was added to the callback and defined for
      some platforms to selectively enable these safety features.
      
      The problem is that only certain platforms were given that software
      support. If the automotive safety package bit is set in the hardware
      features register the safety feature callback is called for the platform,
      and for platforms that didn't get a safety_feat_cfg defined this results
      in the following NULL pointer dereference:
      
      [    7.933303] Call trace:
      [    7.935812]  dwmac5_safety_feat_config+0x20/0x170 [stmmac]
      [    7.941455]  __stmmac_open+0x16c/0x474 [stmmac]
      [    7.946117]  stmmac_open+0x38/0x70 [stmmac]
      [    7.950414]  __dev_open+0x100/0x1dc
      [    7.954006]  __dev_change_flags+0x18c/0x204
      [    7.958297]  dev_change_flags+0x24/0x6c
      [    7.962237]  do_setlink+0x2b8/0xfa4
      [    7.965827]  __rtnl_newlink+0x4ec/0x840
      [    7.969766]  rtnl_newlink+0x50/0x80
      [    7.973353]  rtnetlink_rcv_msg+0x12c/0x374
      [    7.977557]  netlink_rcv_skb+0x5c/0x130
      [    7.981500]  rtnetlink_rcv+0x18/0x2c
      [    7.985172]  netlink_unicast+0x2e8/0x340
      [    7.989197]  netlink_sendmsg+0x1a8/0x420
      [    7.993222]  ____sys_sendmsg+0x218/0x280
      [    7.997249]  ___sys_sendmsg+0xac/0x100
      [    8.001103]  __sys_sendmsg+0x84/0xe0
      [    8.004776]  __arm64_sys_sendmsg+0x24/0x30
      [    8.008983]  invoke_syscall+0x48/0x114
      [    8.012840]  el0_svc_common.constprop.0+0xcc/0xec
      [    8.017665]  do_el0_svc+0x38/0xb0
      [    8.021071]  el0_svc+0x2c/0x84
      [    8.024212]  el0t_64_sync_handler+0xf4/0x120
      [    8.028598]  el0t_64_sync+0x190/0x194
      
      Go back to the original behavior, if the automotive safety package
      is found to be supported in hardware enable all the features unless
      safety_feat_cfg is passed in saying this particular platform only
      supports a subset of the features.
      
      Fixes: 5ac712dc ("net: stmmac: enable platform specific safety features")
      Reported-by: default avatarNing Cai <ncai@quicinc.com>
      Signed-off-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fdfc76a1
    • David S. Miller's avatar
      Merge branch 'octeontx2-af-CPT' · b4fbf0b2
      David S. Miller authored
      Srujana Challa says:
      
      ====================
      octeontx2-af: Miscellaneous changes for CPT
      
      This patchset consists of miscellaneous changes for CPT.
      - Adds a new mailbox to reset the requested CPT LF.
      - Modify FLR sequence as per HW team suggested.
      - Adds support to recover CPT engines when they gets fault.
      - Updates CPT inbound inline IPsec configuration mailbox,
        as per new generation of the OcteonTX2 chips.
      - Adds a new mailbox to return CPT FLT Interrupt info.
      
      ---
      v2:
      - Addressed a review comment.
      v1:
      - Dropped patch "octeontx2-af: Fix interrupt name strings completely"
        to submit to net.
      ---
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b4fbf0b2
    • Srujana Challa's avatar
      octeontx2-af: add mbox to return CPT_AF_FLT_INT info · 8299ffe3
      Srujana Challa authored
      CPT HW would trigger the CPT AF FLT interrupt when CPT engines
      hits some uncorrectable errors and AF is the one which receives
      the interrupt and recovers the engines.
      This patch adds a mailbox for CPT VFs to request for CPT faulted
      and recovered engines info.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8299ffe3
    • Srujana Challa's avatar
      octeontx2-af: update cpt lf alloc mailbox · c0688ec0
      Srujana Challa authored
      The CN10K CPT coprocessor contains a context processor
      to accelerate updates to the IPsec security association
      contexts. The context processor contains a context cache.
      This patch updates CPT LF ALLOC mailbox to config ctx_ilen
      requested by VFs. CPT_LF_ALLOC:ctx_ilen is the size of
      initial context fetch.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c0688ec0
    • Nithin Dabilpuram's avatar
      octeontx2-af: restore rxc conf after teardown sequence · d5b2e0a2
      Nithin Dabilpuram authored
      CN10K CPT coprocessor includes a component named RXC which
      is responsible for reassembly of inner IP packets. RXC has
      the feature to evict oldest entries based on age/threshold.
      The age/threshold is being set to minimum values to evict
      all entries at the time of teardown.
      This patch adds code to restore timeout and threshold config
      after teardown sequence is complete as it is global config.
      Signed-off-by: default avatarNithin Dabilpuram <ndabilpuram@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5b2e0a2
    • Srujana Challa's avatar
      octeontx2-af: optimize cpt pf identification · 9adb04ff
      Srujana Challa authored
      Optimize CPT PF identification in mbox handling for faster
      mbox response by doing it at AF driver probe instead of
      every mbox message.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9adb04ff
    • Srujana Challa's avatar
      octeontx2-af: modify FLR sequence for CPT · 1286c50a
      Srujana Challa authored
      On OcteonTX2 platform CPT instruction enqueue is only
      possible via LMTST operations.
      The existing FLR sequence mentioned in HRM requires
      a dummy LMTST to CPT but LMTST can't be submitted from
      AF driver. So, HW team provided a new sequence to avoid
      dummy LMTST. This patch adds code for the same.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1286c50a
    • Srujana Challa's avatar
      octeontx2-af: add mbox for CPT LF reset · f58cf765
      Srujana Challa authored
      On OcteonTX2 SoC, the admin function (AF) is the only one with all
      priviliges to configure HW and alloc resources, PFs and it's VFs
      have to request AF via mailbox for all their needs.
      This patch adds a new mailbox for CPT VFs to request for CPT LF
      reset.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f58cf765
    • Srujana Challa's avatar
      octeontx2-af: recover CPT engine when it gets fault · 07ea567d
      Srujana Challa authored
      When CPT engine has uncorrectable errors, it will get halted and
      must be disabled and re-enabled. This patch adds code for the same.
      Signed-off-by: default avatarSrujana Challa <schalla@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      07ea567d
  2. 19 Jan, 2023 16 commits
  3. 18 Jan, 2023 11 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-2023011801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 7287904c
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fixes for potential empty list handling in HID core (Pietro Borrello)
      
       - fix for NULL pointer dereference in betop driver that could be
         triggered by malicious device (Pietro Borrello)
      
       - fixes for handling calibration data preventing division by zero in
         Playstation driver (Roderick Colenbrander)
      
       - fix for memory leak on error path in amd-sfh driver (Basavaraj
         Natikar)
      
       - other few assorted small fixes and device ID-specific handling
      
      * tag 'for-linus-2023011801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: betop: check shape of output reports
        HID: playstation: sanity check DualSense calibration data.
        HID: playstation: sanity check DualShock4 calibration data.
        HID: uclogic: Add support for XP-PEN Deco 01 V2
        HID: revert CHERRY_MOUSE_000C quirk
        HID: check empty report_list in bigben_probe()
        HID: check empty report_list in hid_validate_values()
        HID: amd_sfh: Fix warning unwind goto
        HID: intel_ish-hid: Add check for ishtp_dma_tx_map
      7287904c
    • Linus Torvalds's avatar
      Merge tag 'affs-for-6.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 7026172b
      Linus Torvalds authored
      Pull affs fix from David Sterba:
       "One minor fix for a KCSAN report"
      
      * tag 'affs-for-6.2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        affs: initialize fsdata in affs_truncate()
      7026172b
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 5fbad44d
      Linus Torvalds authored
      Pull erofs fixes from Gao Xiang:
       "Two patches fixes issues reported by syzbot, one fixes a missing
        `domain_id` mount option in documentation and a minor cleanup:
      
         - Fix wrong iomap->length calculation post EOF, which could cause a
           WARN_ON in iomap_iter_done() (Siddh)
      
         - Fix improper kvcalloc() use with __GFP_NOFAIL (me)
      
         - Add missing `domain_id` mount option in documentation (Jingbo)
      
         - Clean up fscache option parsing (Jingbo)"
      
      * tag 'erofs-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: clean up parsing of fscache related options
        erofs: add documentation for 'domain_id' mount option
        erofs: fix kvcalloc() misuse with __GFP_NOFAIL
        erofs/zmap.c: Fix incorrect offset calculation
      5fbad44d
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.2-1' of... · 84bd7e08
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Fix a missing elf_hwcap, fix some stack unwinder bugs and two trivial
        cleanups"
      
      * tag 'loongarch-fixes-6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        LoongArch: Add generic ex-handler unwind in prologue unwinder
        LoongArch: Strip guess unwinder out from prologue unwinder
        LoongArch: Use correct sp value to get graph addr in stack unwinders
        LoongArch: Get frame info in unwind_start() when regs is not available
        LoongArch: Adjust PC value when unwind next frame in unwinder
        LoongArch: Simplify larch_insn_gen_xxx implementation
        LoongArch: Use common function sign_extend64()
        LoongArch: Add HWCAP_LOONGARCH_CPUCFG to elf_hwcap
      84bd7e08
    • Pietro Borrello's avatar
      HID: betop: check shape of output reports · 3782c0d6
      Pietro Borrello authored
      betopff_init() only checks the total sum of the report counts for each
      report field to be at least 4, but hid_betopff_play() expects 4 report
      fields.
      A device advertising an output report with one field and 4 report counts
      would pass the check but crash the kernel with a NULL pointer dereference
      in hid_betopff_play().
      
      Fixes: 52cd7785 ("HID: betop: add drivers/hid/hid-betopff.c")
      Signed-off-by: default avatarPietro Borrello <borrello@diag.uniroma1.it>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      3782c0d6
    • Eric Dumazet's avatar
      l2tp: prevent lockdep issue in l2tp_tunnel_register() · b9fb10d1
      Eric Dumazet authored
      lockdep complains with the following lock/unlock sequence:
      
           lock_sock(sk);
           write_lock_bh(&sk->sk_callback_lock);
      [1]  release_sock(sk);
      [2]  write_unlock_bh(&sk->sk_callback_lock);
      
      We need to swap [1] and [2] to fix this issue.
      
      Fixes: 0b2c5972 ("l2tp: close all race conditions in l2tp_tunnel_register()")
      Reported-by: syzbot+bbd35b345c7cab0d9a08@syzkaller.appspotmail.com
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/netdev/20230114030137.672706-1-xiyou.wangcong@gmail.com/T/#m1164ff20628671b0f326a24cb106ab3239c70ce3
      Cc: Cong Wang <cong.wang@bytedance.com>
      Cc: Guillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9fb10d1
    • Jason Wang's avatar
      virtio-net: correctly enable callback during start_xmit · d71ebe81
      Jason Wang authored
      Commit a7766ef1("virtio_net: disable cb aggressively") enables
      virtqueue callback via the following statement:
      
              do {
      		if (use_napi)
      			virtqueue_disable_cb(sq->vq);
      
      		free_old_xmit_skbs(sq, false);
      
      	} while (use_napi && kick &&
                     unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
      
      When NAPI is used and kick is false, the callback won't be enabled
      here. And when the virtqueue is about to be full, the tx will be
      disabled, but we still don't enable tx interrupt which will cause a TX
      hang. This could be observed when using pktgen with burst enabled.
      
      TO be consistent with the logic that tries to disable cb only for
      NAPI, fixing this by trying to enable delayed callback only when NAPI
      is enabled when the queue is about to be full.
      
      Fixes: a7766ef1 ("virtio_net: disable cb aggressively")
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Tested-by: default avatarLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d71ebe81
    • Robert Hancock's avatar
      net: macb: fix PTP TX timestamp failure due to packet padding · 7b90f5a6
      Robert Hancock authored
      PTP TX timestamp handling was observed to be broken with this driver
      when using the raw Layer 2 PTP encapsulation. ptp4l was not receiving
      the expected TX timestamp after transmitting a packet, causing it to
      enter a failure state.
      
      The problem appears to be due to the way that the driver pads packets
      which are smaller than the Ethernet minimum of 60 bytes. If headroom
      space was available in the SKB, this caused the driver to move the data
      back to utilize it. However, this appears to cause other data references
      in the SKB to become inconsistent. In particular, this caused the
      ptp_one_step_sync function to later (in the TX completion path) falsely
      detect the packet as a one-step SYNC packet, even when it was not, which
      caused the TX timestamp to not be processed when it should be.
      
      Using the headroom for this purpose seems like an unnecessary complexity
      as this is not a hot path in the driver, and in most cases it appears
      that there is sufficient tailroom to not require using the headroom
      anyway. Remove this usage of headroom to prevent this inconsistency from
      occurring and causing other problems.
      
      Fixes: 653e92a9 ("net: macb: add support for padding and fcs computation")
      Signed-off-by: default avatarRobert Hancock <robert.hancock@calian.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com> # on SAMA7G5
      Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7b90f5a6
    • Athira Rajeev's avatar
      perf test build-id: Fix test check for PE file · 3d9c07c4
      Athira Rajeev authored
      Perf test "build id cache operations" fails for PE executable.  Logs
      below from powerpc system.  Same is observed on x86 as well.
      
        <<>>
        Adding 5a0fd882b53084224ba47b624c55a469 ./tests/shell/../pe-file.exe: Ok
        build id: 5a0fd882b53084224ba47b624c55a469
        link: /tmp/perf.debug.w0V/.build-id/5a/0fd882b53084224ba47b624c55a469
        file: /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf
        failed: file /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf does not exist
        test child finished with -1
        ---- end ----
        build id cache operations: FAILED!
        <<>>
      
      The test tries to do:
      
        <<>>
        mkdir /tmp/perf.debug.TeY1
        perf --buildid-dir /tmp/perf.debug.TeY1 buildid-cache -v -a ./tests/shell/../pe-file.exe
        <<>>
      
      The option "--buildid-dir" sets the build id cache directory as
      /tmp/perf.debug.TeY1. The option given to buildid-cahe, ie "-a
      ./tests/shell/../pe-file.exe", is to add the pe-file.exe to the cache.
      
      The testcase, sets buildid-dir and adds the file: pe-file.exe to build
      id cache. To check if the command is run successfully, "check" function
      looks for presence of the file in buildid cache directory. But the check
      here expects the added file to be executable. Snippet below:
      
        <<>>
        if [ ! -x $file ]; then
        	echo "failed: file ${file} does not exist"
        	exit 1
        fi
        <<>>
      
      The buildid test is done for sha1 binary, md5 binary and also for PE
      file. The first two binaries are created at runtime by compiling with
      "--build-id" option and hence the check for sha1/md5 test should use [ !
      -x ]. But in case of PE file, the permission for this input file is
      rw-r--r-- Hence the file added to build id cache has same permissoin
      
      Original file:
      
        ls tests/pe-file.exe | xargs stat --printf "%n %A \n"
        tests/pe-file.exe -rw-r--r--
      
      buildid cache file:
      
        ls /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf | xargs stat --printf "%n %A \n"
        /tmp/perf.debug.w0V/.build-id/5a/../../root/<user>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf -rw-r--r--
      
      Fix the test to match with the permission of original file in case of FE
      file. ie if the "tests/pe-file.exe" file is not having exec permission,
      just check for existence of the buildid file using [ ! -e <file> ]
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20230116050131.17221-2-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d9c07c4
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 3e134696
      David S. Miller authored
      Pablo Niera Ayuso says:
      
      ====================
      
      The following patchset contains Netfilter fixes for net:
      
      1) Fix syn-retransmits until initiator gives up when connection is re-used
         due to rst marked as invalid, from Florian Westphal.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e134696
    • Athira Rajeev's avatar
      perf buildid-cache: Fix the file mode with copyfile() while adding file to build-id cache · 4b21b3e7
      Athira Rajeev authored
      The test "build id cache operations" fails on powerpc as below:
      
      	Adding 5a0fd882b53084224ba47b624c55a469 ./tests/shell/../pe-file.exe: Ok
      	build id: 5a0fd882b53084224ba47b624c55a469
      	link: /tmp/perf.debug.ZTu/.build-id/5a/0fd882b53084224ba47b624c55a469
      	file: /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf
      	failed: file /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf does not exist
      	test child finished with -1
      	---- end ----
      	build id cache operations: FAILED!
      
      The failing test is when trying to add pe-file.exe to build id cache.
      
      'perf buildid-cache' can be used to add/remove/manage files from the
      build-id cache. "-a" option is used to add a file to the build-id cache.
      
      Simple command to do so for a PE exe file:
      
        # ls -ltr tests/pe-file.exe
        -rw-r--r--. 1 root root 75595 Jan 10 23:35 tests/pe-file.exe
      
        The file is in home directory.
      
        # mkdir  /tmp/perf.debug.TeY1
        # perf --buildid-dir /tmp/perf.debug.TeY1 buildid-cache -v -a tests/pe-file.exe
      
      The above will create ".build-id" folder in build id directory, which is
      /tmp/perf.debug.TeY1. Also adds file to this folder under build id.
      Example:
      
        # ls -ltr /tmp/perf.debug.TeY1/.build-id/5a/0fd882b53084224ba47b624c55a469/
        total 76
        -rw-r--r--. 1 root root     0 Jan 11 00:38 probes
        -rwxr-xr-x. 1 root root 75595 Jan 11 00:38 elf
      
      We can see in the results that file mode for original file and file in
      build id directory is different. ie, build id file has executable
      permission whereas original file doesn’t have.
      
      The code path and function (build_id_cache__add  to add a file to the
      cache is in "util/build-id.c". In build_id_cache__add() function, it
      first attempts to link the original file to destination cache folder.
      
      If linking the file fails (which can happen if the destination and
      source is on a different mount points), it will copy the file to
      destination.  Here copyfile() routine explicitly uses mode as "755" and
      hence file in the destination will have executable permission.
      
      Code snippet:
      
       if (link(realname, filename) && errno != EEXIST && copyfile(name, filename))
      
      strace logs:
      
      	172285 link("/home/<user_name>/linux/tools/perf/tests/pe-file.exe", "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf") = -1 EXDEV (Invalid cross-device link)
      	172285 newfstatat(AT_FDCWD, "tests/pe-file.exe", {st_mode=S_IFREG|0644, st_size=75595, ...}, 0) = 0
      	172285 openat(AT_FDCWD, "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/.elf.KbAnsl", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
      	172285 fchmod(3, 0755)                  = 0
      	172285 openat(AT_FDCWD, "tests/pe-file.exe", O_RDONLY) = 4
      	172285 mmap(NULL, 75595, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7fffa5cd0000
      	172285 pwrite64(3, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 75595, 0) = 75595
      
      Whereas if the link succeeds, it succeeds in the first attempt itself
      and the file in the build-id dir will have same permission as original
      file.
      
      Example, above uses /tmp. Instead if we use "--buildid-dir /home/build",
      linking will work here since mount points are same. Hence the
      destination file will not have executable permission.
      
      Since the testcase "tests/shell/buildid.sh" always looks for executable
      file, test fails in powerpc environment when test is run from /root.
      
      The patch adds a change in build_id_cache__add() to use copyfile_mode()
      which also passes the file’s original mode as argument. This way the
      destination file mode also will be same as original file.
      Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Disha Goel <disgoel@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20230116050131.17221-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4b21b3e7