1. 08 Dec, 2023 3 commits
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 17894c2a
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Snapshot buffer issues:
      
         1. When instances started allowing latency tracers, it uses a
            snapshot buffer (another buffer that is not written to but swapped
            with the main buffer that is). The snapshot buffer needs to be the
            same size as the main buffer. But when the snapshot buffers were
            added to instances, the code to make the snapshot equal to the
            main buffer still was only doing it for the main buffer and not
            the instances.
      
         2. Need to stop the current tracer when resizing the buffers.
            Otherwise there can be a race if the tracer decides to make a
            snapshot between resizing the main buffer and the snapshot buffer.
      
         3. When a tracer is "stopped" in disables both the main buffer and
            the snapshot buffer. This needs to be done for instances and not
            only the main buffer, now that instances also have a snapshot
            buffer.
      
       - Buffered event for filtering issues:
      
         When filtering is enabled, because events can be dropped often, it is
         quicker to copy the event into a temp buffer and write that into the
         main buffer if it is not filtered or just drop the event if it is,
         than to write the event into the ring buffer and then try to discard
         it. This temp buffer is allocated and needs special synchronization
         to do so. But there were some issues with that:
      
         1. When disabling the filter and freeing the buffer, a call to all
            CPUs is required to stop each per_cpu usage. But the code called
            smp_call_function_many() which does not include the current CPU.
            If the task is migrated to another CPU when it enables the CPUs
            via smp_call_function_many(), it will not enable the one it is
            currently on and this causes issues later on. Use
            on_each_cpu_mask() instead, which includes the current CPU.
      
          2.When the allocation of the buffered event fails, it can give a
            warning. But the buffered event is just an optimization (it's
            still OK to write to the ring buffer and free it). Do not WARN in
            this case.
      
          3.The freeing of the buffer event requires synchronization. First a
            counter is decremented to zero so that no new uses of it will
            happen. Then it sets the buffered event to NULL, and finally it
            frees the buffered event. There's a synchronize_rcu() between the
            counter decrement and the setting the variable to NULL, but only a
            smp_wmb() between that and the freeing of the buffer. It is
            theoretically possible that a user missed seeing the decrement,
            but will use the buffer after it is free. Another
            synchronize_rcu() is needed in place of that smp_wmb().
      
       - ring buffer timestamps on 32 bit machines
      
         The ring buffer timestamp on 32 bit machines has to break the 64 bit
         number into multiple values as cmpxchg is required on it, and a 64
         bit cmpxchg on 32 bit architectures is very slow. The code use to
         just use two 32 bit values and make it a 60 bit timestamp where the
         other 4 bits were used as counters for synchronization. It later came
         known that the timestamp on 32 bit still need all 64 bits in some
         cases. So 3 words were created to handle the 64 bits. But issues
         arised with this:
      
          1. The synchronization logic still only compared the counter with
             the first two, but not with the third number, so the
             synchronization could fail unknowingly.
      
          2. A check on discard of an event could race if an event happened
             between the discard and updating one of the counters. The counter
             needs to be updated (forcing an absolute timestamp and not to use
             a delta) before the actual discard happens.
      
      * tag 'trace-v6.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        ring-buffer: Test last update in 32bit version of __rb_time_read()
        ring-buffer: Force absolute timestamp on discard of event
        tracing: Fix a possible race when disabling buffered events
        tracing: Fix a warning when allocating buffered events fails
        tracing: Fix incomplete locking when disabling buffered events
        tracing: Disable snapshot buffer when stopping instance tracers
        tracing: Stop current tracer when resizing buffer
        tracing: Always update snapshot buffer size
      17894c2a
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-12-07-18-47' of... · 8e819a76
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-12-07-18-47' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "31 hotfixes. Ten of these address pre-6.6 issues and are marked
        cc:stable. The remainder address post-6.6 issues or aren't considered
        serious enough to justify backporting"
      
      * tag 'mm-hotfixes-stable-2023-12-07-18-47' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (31 commits)
        mm/madvise: add cond_resched() in madvise_cold_or_pageout_pte_range()
        nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
        mm/hugetlb: have CONFIG_HUGETLB_PAGE select CONFIG_XARRAY_MULTI
        scripts/gdb: fix lx-device-list-bus and lx-device-list-class
        MAINTAINERS: drop Antti Palosaari
        highmem: fix a memory copy problem in memcpy_from_folio
        nilfs2: fix missing error check for sb_set_blocksize call
        kernel/Kconfig.kexec: drop select of KEXEC for CRASH_DUMP
        units: add missing header
        drivers/base/cpu: crash data showing should depends on KEXEC_CORE
        mm/damon/sysfs-schemes: add timeout for update_schemes_tried_regions
        scripts/gdb/tasks: fix lx-ps command error
        mm/Kconfig: make userfaultfd a menuconfig
        selftests/mm: prevent duplicate runs caused by TEST_GEN_PROGS
        mm/damon/core: copy nr_accesses when splitting region
        lib/group_cpus.c: avoid acquiring cpu hotplug lock in group_cpus_evenly
        checkstack: fix printed address
        mm/memory_hotplug: fix error handling in add_memory_resource()
        mm/memory_hotplug: add missing mem_hotplug_lock
        .mailmap: add a new address mapping for Chester Lin
        ...
      8e819a76
    • Linus Torvalds's avatar
      Merge tag 'net-6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 5e3f5b81
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bpf and netfilter.
      
        Current release - regressions:
      
         - veth: fix packet segmentation in veth_convert_skb_to_xdp_buff
      
        Current release - new code bugs:
      
         - tcp: assorted fixes to the new Auth Option support
      
        Older releases - regressions:
      
         - tcp: fix mid stream window clamp
      
         - tls: fix incorrect splice handling
      
         - ipv4: ip_gre: handle skb_pull() failure in ipgre_xmit()
      
         - dsa: mv88e6xxx: restore USXGMII support for 6393X
      
         - arcnet: restore support for multiple Sohard Arcnet cards
      
        Older releases - always broken:
      
         - tcp: do not accept ACK of bytes we never sent
      
         - require admin privileges to receive packet traces via netlink
      
         - packet: move reference count in packet_sock to atomic_long_t
      
         - bpf:
            - fix incorrect branch offset comparison with cpu=v4
            - fix prog_array_map_poke_run map poke update
      
         - netfilter:
            - three fixes for crashes on bad admin commands
            - xt_owner: fix race accessing sk->sk_socket, TOCTOU null-deref
            - nf_tables: fix 'exist' matching on bigendian arches
      
         - leds: netdev: fix RTNL handling to prevent potential deadlock
      
         - eth: tg3: prevent races in error/reset handling
      
         - eth: r8169: fix rtl8125b PAUSE storm when suspended
      
         - eth: r8152: improve reset and surprise removal handling
      
         - eth: hns: fix race between changing features and sending
      
         - eth: nfp: fix sleep in atomic for bonding offload"
      
      * tag 'net-6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (62 commits)
        vsock/virtio: fix "comparison of distinct pointer types lacks a cast" warning
        net/smc: fix missing byte order conversion in CLC handshake
        net: dsa: microchip: provide a list of valid protocols for xmit handler
        drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
        psample: Require 'CAP_NET_ADMIN' when joining "packets" group
        bpf: sockmap, updating the sg structure should also update curr
        net: tls, update curr on splice as well
        nfp: flower: fix for take a mutex lock in soft irq context and rcu lock
        net: dsa: mv88e6xxx: Restore USXGMII support for 6393X
        tcp: do not accept ACK of bytes we never sent
        selftests/bpf: Add test for early update in prog_array_map_poke_run
        bpf: Fix prog_array_map_poke_run map poke update
        netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
        netfilter: nf_tables: validate family when identifying table via handle
        netfilter: nf_tables: bail out on mismatching dynset and set expressions
        netfilter: nf_tables: fix 'exist' matching on bigendian arches
        netfilter: nft_set_pipapo: skip inactive elements during set walk
        netfilter: bpf: fix bad registration on nf_defrag
        leds: trigger: netdev: fix RTNL handling to prevent potential deadlock
        octeontx2-af: Update Tx link register range
        ...
      5e3f5b81
  2. 07 Dec, 2023 37 commits