* remotes/origin/tmp-7453ecf:
UPSTREAM: usb: gadget: configfs: Prevent OOB read/write in usb_string_copy()
ANDROID: 16K: Don't set padding vm_flags on 32-bit archs
ANDROID: GKI: refresh ABI to include kimage_vaddr
BACKPORT: arm64: move kimage_vaddr to .rodata
BACKPORT: arm64: kernel: Convert to modern annotations for assembly data
ANDROID: fix kernelci build breaks due to hid/uhid cyclic dependency
UPSTREAM: af_unix: Fix garbage collector racing against connect()
Revert "drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector"
Linux 5.4.278
nfs: fix undefined behavior in nfs_block_bits()
s390/ap: Fix crash in AP internal function modify_bitmap()
ext4: fix mb_cache_entry's e_refcnt leak in ext4_xattr_block_cache_find()
sparc: move struct termio to asm/termios.h
xsk: validate user input for XDP_{UMEM|COMPLETION}_FILL_RING
net: fix __dst_negative_advice() race
kdb: Use format-specifiers rather than memset() for padding in kdb_read()
kdb: Merge identical case statements in kdb_read()
kdb: Fix console handling when editing and tab-completing commands
kdb: Use format-strings rather than '\0' injection in kdb_read()
kdb: Fix buffer overflow during tab-complete
sparc64: Fix number of online CPUs
intel_th: pci: Add Meteor Lake-S CPU support
net/9p: fix uninit-value in p9_client_rpc()
net/ipv6: Fix route deleting failure when metric equals 0
crypto: qat - Fix ADF_DEV_RESET_SYNC memory leak
crypto: ecrdsa - Fix module auto-load on add_key
KVM: arm64: Allow AArch32 PSTATE.M to be restored as System mode
fbdev: savage: Handle err return when savagefb_check_var failed
media: v4l2-core: hold videodev_lock until dev reg, finishes
media: mxl5xx: Move xpt structures off stack
media: mc: mark the media devnode as registered from the, start
arm64: dts: hi3798cv200: fix the size of GICR
wifi: rtl8xxxu: Fix the TX power of RTL8192CU, RTL8723AU
md/raid5: fix deadlock that raid5d() wait for itself to clear MD_SB_CHANGE_PENDING
arm64: tegra: Correct Tegra132 I2C alias
ACPI: resource: Do IRQ override on TongFang GXxHRXx and GMxHGxx
ata: pata_legacy: make legacy_exit() work again
drm/amdgpu: add error handle to avoid out-of-bounds
media: lgdt3306a: Add a check against null-pointer-def
f2fs: fix to do sanity check on i_xattr_nid in sanity_check_inode()
x86/mm: Remove broken vsyscall emulation code from the page fault code
vxlan: Fix regression when dropping packets due to invalid src addresses
nilfs2: fix use-after-free of timer for log writer thread
afs: Don't cross .backup mountpoint from backup volume
io_uring: fail NOP if non-zero op flags is passed in
mmc: core: Do not force a retune before RPMB switch
binder: fix max_thread type inconsistency
SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline
ALSA: timer: Set lower bound of start tick time
ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound
spi: stm32: Don't warn about spurious interrupts
kconfig: fix comparison to constant symbols, 'm', 'n'
netfilter: tproxy: bail out if IP has been disabled on the device
net:fec: Add fec_enet_deinit()
net: usb: smsc95xx: fix changing LED_SEL bit value updated from EEPROM
smsc95xx: use usbnet->driver_priv
smsc95xx: remove redundant function arguments
enic: Validate length of nl attributes in enic_set_vf_port
dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
nvmet: fix ns enable/disable possible hang
spi: Don't mark message DMA mapped when no transfer in it is
netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
nfc: nci: Fix kcov check in nci_rx_work()
net: fec: avoid lock evasion when reading pps_enable
virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
openvswitch: Set the skbuff pkt_type for proper pmtud support.
tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
params: lift param_set_uint_minmax to common code
ipv6: sr: fix memleak in seg6_hmac_init_algo
sunrpc: fix NFSACL RPC retry on soft mount
nfc: nci: Fix uninit-value in nci_rx_work
x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
media: cec: cec-api: add locking in cec_release()
media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
um: Fix the -Wmissing-prototypes warning for __switch_mm
powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
scsi: qla2xxx: Replace all non-returning strlcpy() with strscpy()
media: stk1160: fix bounds checking in stk1160_copy_video()
um: Add winch to winch_handlers before registering winch IRQ
um: Fix return value in ubd_init()
drm/msm/dpu: Always flush the slave INTF on the CTL
Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
Input: ims-pcu - fix printf string overflow
libsubcmd: Fix parse-options memory leak
serial: sh-sci: protect invalidating RXDMA on shutdown
f2fs: fix to release node block count in error path of f2fs_new_node_page()
extcon: max8997: select IRQ_DOMAIN instead of depending on it
ppdev: Add an error check in register_device
ppdev: Remove usage of the deprecated ida_simple_xx() API
stm class: Fix a double free in stm_register_device()
usb: gadget: u_audio: Clear uac pointer when freed.
microblaze: Remove early printk call from cpuinfo-static.c
microblaze: Remove gcc flag for non existing early_printk.c file
iio: pressure: dps310: support negative temperature values
greybus: arche-ctrl: move device table to its right location
serial: max3100: Fix bitwise types
serial: max3100: Update uart_driver_registered on driver removal
serial: max3100: Lock port->lock when calling uart_handle_cts_change()
firmware: dmi-id: add a release callback function
dmaengine: idma64: Add check for dma_set_max_seg_size
soundwire: cadence: fix invalid PDI offset
soundwire: cadence_master: improve PDI allocation
soundwire: intel: don't filter out PDI0/1
soundwire: cadence/intel: simplify PDI/port mapping
greybus: lights: check return of get_channel_from_mode
sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level
sched/topology: Don't set SD_BALANCE_WAKE on cpuset domain relax
af_packet: do not call packet_read_pending() from tpacket_destruct_skb()
netrom: fix possible dead-lock in nr_rt_ioctl()
RDMA/IPoIB: Fix format truncation compilation errors
selftests/kcmp: remove unused open mode
selftests/kcmp: Make the test output consistent and clear
SUNRPC: Fix gss_free_in_token_pages()
sunrpc: removed redundant procp check
ext4: avoid excessive credit estimate in ext4_tmpfile()
x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map
RDMA/hns: Use complete parentheses in macros
drm/panel: simple: Add missing Innolux G121X1-L03 format, flags, connector
ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
drm/arm/malidp: fix a possible null pointer dereference
fbdev: sh7760fb: allow modular build
platform/x86: wmi: Make two functions static
media: radio-shark2: Avoid led_names truncations
media: ngene: Add dvb_ca_en50221_init return value check
fbdev: sisfb: hide unused variables
powerpc/fsl-soc: hide unused const variable
drm/mediatek: Add 0 size check to mtk_drm_gem_obj
fbdev: shmobile: fix snprintf truncation
mtd: rawnand: hynix: fixed typo
drm/amd/display: Fix potential index out of bounds in color transformation function
ipv6: sr: fix invalid unregister error path
ipv6: sr: fix incorrect unregister order
ipv6: sr: add missing seg6_local_exit
net: openvswitch: fix overwriting ct original tuple for ICMPv6
net: usb: smsc95xx: stop lying about skb->truesize
af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
net: ethernet: cortina: Locking fixes
m68k: mac: Fix reboot hang on Mac IIci
m68k: Fix spinlock race in kernel thread creation
net: usb: sr9700: stop lying about skb->truesize
usb: aqc111: stop lying about skb->truesize
wifi: mwl8k: initialize cmd->addr[] properly
scsi: qedf: Ensure the copied buf is NUL terminated
scsi: bfa: Ensure the copied buf is NUL terminated
HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors
Revert "sh: Handle calling csum_partial with misaligned data"
sh: kprobes: Merge arch_copy_kprobe() into arch_prepare_kprobe()
wifi: ar5523: enable proper endpoint verification
wifi: carl9170: add a proper sanity check for endpoints
macintosh/via-macii: Fix "BUG: sleeping function called from invalid context"
tcp: avoid premature drops in tcp_add_backlog()
tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
tcp: minor optimization in tcp_add_backlog()
wifi: ath10k: populate board data for WCN3990
wifi: ath10k: Fix an error code problem in ath10k_dbg_sta_write_peer_debug_trigger()
x86/purgatory: Switch to the position-independent small code model
scsi: hpsa: Fix allocation size for Scsi_Host private data
scsi: libsas: Fix the failure of adding phy with zero-address to port
cpufreq: exit() callback is optional
cpufreq: Rearrange locking in cpufreq_remove_dev()
cpufreq: Split cpufreq_offline()
cpufreq: Reorganize checks in cpufreq_offline()
ACPI: disable -Wstringop-truncation
irqchip/alpine-msi: Fix off-by-one in allocation error path
scsi: ufs: core: Perform read back after disabling UIC_COMMAND_COMPL
scsi: ufs: core: Perform read back after disabling interrupts
scsi: ufs: cdns-pltfrm: Perform read back after writing HCLKDIV
scsi: ufs: qcom: Perform read back after writing reset bit
qed: avoid truncating work queue length
x86/boot: Ignore relocations in .notes sections in walk_relocs() too
wifi: ath10k: poll service ready message before failing
md: fix resync softlockup when bitmap size is less than array size
null_blk: Fix missing mutex_destroy() at module removal
jffs2: prevent xattr node from overflowing the eraseblock
s390/cio: fix tracepoint subchannel type field
crypto: ccp - drop platform ifdef checks
parisc: add missing export of __cmpxchg_u8()
nilfs2: fix out-of-range warning
ecryptfs: Fix buffer size for tag 66 packet
firmware: raspberrypi: Use correct device for DMA mappings
crypto: bcm - Fix pointer arithmetic
openpromfs: finish conversion to the new mount API
nvme: find numa distance only if controller has valid numa id
drm/amdkfd: Flush the process wq before creating a kfd_process
ASoC: da7219-aad: fix usage of device_get_named_child_node()
ASoC: dt-bindings: rt5645: add cbj sleeve gpio property
ASoC: rt5645: Fix the electric noise due to the CBJ contacts floating
drm/amd/display: Set color_mgmt_changed to true on unsuspend
net: usb: qmi_wwan: add Telit FN920C04 compositions
wifi: cfg80211: fix the order of arguments for trace events of the tx_rx_evt class
nilfs2: fix potential hang in nilfs_detach_log_writer()
nilfs2: fix unexpected freezing of nilfs_segctor_sync()
net: smc91x: Fix m68k kernel compilation for ColdFire CPU
ring-buffer: Fix a race between readers and resize checks
speakup: Fix sizeof() vs ARRAY_SIZE() bug
tty: n_gsm: fix possible out-of-bounds in gsm0_receive()
x86/tsc: Trust initial offset in architectural TSC-adjust MSRs
Linux 5.4.277
docs: kernel_include.py: Cope with docutils 0.21
serial: kgdboc: Fix NMI-safety problems from keyboard reset code
usb: typec: ucsi: displayport: Fix potential deadlock
drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper()
btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks()
arm64: dts: qcom: Fix 'interrupt-map' parent address cells
firmware: arm_scmi: Harden accesses to the reset domains
smb: client: fix potential OOBs in smb2_parse_contexts()
net: bcmgenet: synchronize UMAC_CMD access
net: bcmgenet: synchronize use of bcmgenet_set_rx_mode()
net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access
net: bcmgenet: keep MAC in reset until PHY is up
Revert "net: bcmgenet: use RGMII loopback for MAC reset"
Revert "selftests: mm: fix map_hugetlb failure on 64K page size systems"
ext4: fix bug_on in __es_tree_search
pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin()
Linux 5.4.276
pinctrl: mediatek: paris: Fix PIN_CONFIG_INPUT_SCHMITT_ENABLE readback
pinctrl: mediatek: remove set but not used variable 'e'
pinctrl: mediatek: Fix some off by one bugs
pinctrl: mediatek: Fix fallback behavior for bias_set_combo
regulator: core: fix debugfs creation regression
net: fix out-of-bounds access in ops_init
drm/vmwgfx: Fix invalid reads in fence signaled events
dyndbg: fix old BUG_ON in >control parser
tipc: fix UAF in error path
usb: gadget: f_fs: Fix a race condition when processing setup packets.
usb: gadget: composite: fix OS descriptors w_value logic
firewire: nosy: ensure user_length is taken into account when fetching packet contents
net: qede: use return from qede_parse_flow_attr() for flower
net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
ipv6: fib6_rules: avoid possible NULL dereference in fib6_rule_action()
net: bridge: fix corrupted ethernet header on multicast-to-unicast
phonet: fix rtm_phonet_notify() skb allocation
rtnetlink: Correct nested IFLA_VF_VLAN_LIST attribute validation
Bluetooth: l2cap: fix null-ptr-deref in l2cap_chan_timeout
Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout
tcp: Use refcount_inc_not_zero() in tcp_twsk_unique().
tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets
xfrm: Preserve vlan tags for transport mode software GRO
pinctrl: mediatek: Fix fallback call path
net:usb:qmi_wwan: support Rolling modules
fs/9p: drop inodes immediately on non-.L too
clk: Don't hold prepare_lock when calling kref_put()
gpio: crystalcove: Use -ENOTSUPP consistently
gpio: wcove: Use -ENOTSUPP consistently
9p: explicitly deny setlease attempts
fs/9p: translate O_TRUNC into OTRUNC
fs/9p: only translate RWX permissions for plain 9P2000
selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
MIPS: scall: Save thread_info.syscall unconditionally on entry
gpu: host1x: Do not setup DMA for virtual devices
scsi: target: Fix SELinux error when systemd-modules loads the target module
btrfs: always clear PERTRANS metadata during commit
btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve
tools/power turbostat: Fix Bzy_MHz documentation typo
tools/power turbostat: Fix added raw MSR output
firewire: ohci: mask bus reset interrupts between ISR and bottom half
ata: sata_gemini: Check clk_enable() result
net: bcmgenet: Reset RBUF on first open
ALSA: line6: Zero-initialize message buffers
scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload
net: mark racy access on sk->sk_rcvbuf
wifi: cfg80211: fix rdev_dump_mpp() arguments order
wifi: mac80211: fix ieee80211_bss_*_flags kernel-doc
gfs2: Fix invalid metadata access in punch_hole
scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic
clk: sunxi-ng: h6: Reparent CPUX during PLL CPUX rate change
tipc: fix a possible memleak in tipc_buf_append
net: bridge: fix multicast-to-unicast with fraglist GSO
net: dsa: mv88e6xxx: Fix number of databases for 88E6141 / 88E6341
net: dsa: mv88e6xxx: Add number of MACs in the ATU
net: qede: use return from qede_parse_flow_attr() for flow_spec
net l2tp: drop flow hash on forward
nsh: Restore skb->{protocol,data,mac_header} for outer header in nsh_gso_segment().
bna: ensure the copied buf is NUL terminated
s390/mm: Fix clearing storage keys for huge pages
s390/mm: Fix storage key clearing for guest huge pages
pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()
power: rt9455: hide unused rt9455_boost_voltage_values
nfs: Handle error of rpc_proc_register() in nfs_net_init().
nfs: make the rpc_stat per net namespace
nfs: expose /proc/net/sunrpc/nfs in net namespaces
sunrpc: add a struct rpc_stats arg to rpc_create_args
pinctrl: mediatek: paris: Rework support for PIN_CONFIG_{INPUT,OUTPUT}_ENABLE
pinctrl: mediatek: paris: Rework mtk_pinconf_{get,set} switch/case logic
pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback
pinctrl: mediatek: remove shadow variable declaration
pinctrl: mediatek: Backward compatible to previous Mediatek's bias-pull usage
pinctrl: mediatek: Refine mtk_pinconf_get()
pinctrl: mediatek: Refine mtk_pinconf_get() and mtk_pinconf_set()
pinctrl: mediatek: Supporting driving setting without mapping current to register value
pinctrl: mediatek: Check gpio pin number and use binary search in mtk_hw_pin_field_lookup()
pinctrl: core: delete incorrect free in pinctrl_enable()
wifi: nl80211: don't free NULL coalescing rule
dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state"
dmaengine: pl330: issue_pending waits until WFP state
Revert "clk: Get runtime PM before walking tree during disable_unused"
Linux 5.4.275
serial: core: fix kernel-doc for uart_port_unlock_irqrestore()
udp: preserve the connected status if only UDP cmsg
dm: limit the number of targets and parameter size area
bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS
HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up
i2c: smbus: fix NULL function pointer dereference
idma64: Don't try to serve interrupts when device is powered off
dmaengine: owl: fix register access functions
tcp: Fix NEW_SYN_RECV handling in inet_twsk_purge()
tcp: Clean up kernel listener's reqsk in inet_twsk_purge()
mtd: diskonchip: work around ubsan link failure
stackdepot: respect __GFP_NOLOCKDEP allocation flag
net: b44: set pause params only when interface is up
ethernet: Add helper for assigning packet type when dest address does not match device address
irqchip/gic-v3-its: Prevent double free on error
drm/amdgpu: Fix leak when GPU memory allocation fails
arm64: dts: rockchip: enable internal pull-up for Q7_THRM# on RK3399 Puma
btrfs: fix information leak in btrfs_ioctl_logical_to_ino()
Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0bda:0x4853
Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old()
tracing: Increase PERF_MAX_TRACE_SIZE to handle Sentinel1 and docker together
tracing: Show size of requested perf buffer
net/mlx5e: Fix a race in command alloc flow
Revert "crypto: api - Disallow identical driver names"
drm/amdgpu: validate the parameters of bo mapping operations more clearly
amdgpu: validate offset_in_bo of drm_amdgpu_gem_va
drm/amdgpu: restrict bo mapping within gpu address limits
serial: mxs-auart: add spinlock around changing cts state
serial: core: Provide port lock wrappers
af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc().
iavf: Fix TC config comparison with existing adapter TC config
i40e: Do not use WQ_MEM_RECLAIM flag for workqueue
mlxsw: spectrum_acl_tcam: Fix memory leak when canceling rehash work
mlxsw: spectrum_acl_tcam: Fix incorrect list API usage
mlxsw: spectrum_acl_tcam: Fix warning during rehash
mlxsw: spectrum_acl_tcam: Fix memory leak during rehash
mlxsw: spectrum_acl_tcam: Rate limit error message
mlxsw: spectrum_acl_tcam: Fix possible use-after-free during rehash
mlxsw: spectrum_acl_tcam: Fix possible use-after-free during activity update
mlxsw: spectrum_acl_tcam: Fix race during rehash delayed work
net: openvswitch: Fix Use-After-Free in ovs_ct_exit
ipvs: Fix checksumming on GSO of SCTP packets
net: gtp: Fix Use-After-Free in gtp_dellink
net: usb: ax88179_178a: stop lying about skb->truesize
NFC: trf7970a: disable all regulators on removal
mlxsw: core: Unregister EMAD trap using FORWARD action
vxlan: drop packets from invalid src-address
ARC: [plat-hsdk]: Remove misplaced interrupt-cells property
arm64: dts: mediatek: mt2712: fix validation errors
arm64: dts: mt2712: add ethernet device node
arm64: dts: mediatek: mt7622: drop "reset-names" from thermal block
arm64: dts: mediatek: mt7622: fix ethernet controller "compatible"
arm64: dts: mediatek: mt7622: fix IR nodename
arm64: dts: rockchip: enable internal pull-up on PCIE_WAKE# for RK3399 Puma
arm64: dts: rockchip: fix alphabetical ordering RK3399 puma
KVM: async_pf: Cleanup kvm_setup_async_pf()
nilfs2: fix OOB in nilfs_set_de_type
nouveau: fix instmem race condition around ptr stores
fs: sysfs: Fix reference leak in sysfs_break_active_protection()
speakup: Avoid crash on very long word
usb: Disable USB3 LPM at shutdown
usb: dwc2: host: Fix dereference issue in DDMA completion flow.
Revert "usb: cdc-wdm: close race between read and workqueue"
USB: serial: option: add Telit FN920C04 rmnet compositions
USB: serial: option: add Rolling RW101-GL and RW135-GL support
USB: serial: option: support Quectel EM060K sub-models
USB: serial: option: add Lonsung U8300/U9300 product
USB: serial: option: add support for Fibocom FM650/FG650
USB: serial: option: add Fibocom FM135-GL variants
serial/pmac_zilog: Remove flawed mitigation for rx irq flood
comedi: vmk80xx: fix incomplete endpoint checking
binder: check offset alignment in binder_get_object()
x86/cpufeatures: Fix dependencies for GFNI, VAES, and VPCLMULQDQ
clk: Get runtime PM before walking tree during disable_unused
clk: Initialize struct clk_core kref earlier
clk: Print an info line before disabling unused clocks
clk: remove extra empty line
clk: Mark 'all_lists' as const
clk: Remove prepare_lock hold assertion in __clk_release()
drm: nv04: Fix out of bounds access
RDMA/mlx5: Fix port number for counter query in multi-port configuration
RDMA/rxe: Fix the problem "mutex_destroy missing"
tun: limit printing rate when illegal packet received by tun dev
netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()
Revert "tracing/trigger: Fix to return error if failed to alloc snapshot"
kprobes: Fix possible use-after-free issue on kprobe registration
selftests/ftrace: Limit length in subsystem-enable tests
btrfs: record delayed inode root in transaction
x86/apic: Force native_apic_mem_read() to use the MOV instruction
selftests: timers: Fix abs() warning in posix_timers test
vhost: Add smp_rmb() in vhost_vq_avail_empty()
drm/client: Fully protect modes[] with dev->mode_config.mutex
btrfs: qgroup: correctly model root qgroup rsv in convert
net: ena: Fix potential sign extension issue
af_unix: Fix garbage collector racing against connect()
af_unix: Do not use atomic ops for unix_sk(sk)->inflight.
net/mlx5: Properly link new fs rules into the tree
ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr
ipv4/route: avoid unused-but-set-variable warning
ipv6: fib: hide unused 'pn' variable
geneve: fix header validation in geneve[6]_xmit_skb
u64_stats: fix u64_stats_init() for lockdep when used repeatedly in one file
net: openvswitch: fix unwanted error log on timeout policy probing
nouveau: fix function cast warning
Bluetooth: Fix memory leak in hci_req_sync_complete()
batman-adv: Avoid infinite loop trying to resize local TT
Change-Id: I36df890fc0cf15277cf5d6be8f56774233fb4431
Signed-off-by: kamasali Satyanarayan <quic_kamasali@quicinc.com>
307 lines
8.7 KiB
C
307 lines
8.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Generic stack depot for storing stack traces.
|
|
*
|
|
* Some debugging tools need to save stack traces of certain events which can
|
|
* be later presented to the user. For example, KASAN needs to safe alloc and
|
|
* free stacks for each object, but storing two stack traces per object
|
|
* requires too much memory (e.g. SLUB_DEBUG needs 256 bytes per object for
|
|
* that).
|
|
*
|
|
* Instead, stack depot maintains a hashtable of unique stacktraces. Since alloc
|
|
* and free stacks repeat a lot, we save about 100x space.
|
|
* Stacks are never removed from depot, so we store them contiguously one after
|
|
* another in a contiguos memory allocation.
|
|
*
|
|
* Author: Alexander Potapenko <glider@google.com>
|
|
* Copyright (C) 2016 Google, Inc.
|
|
*
|
|
* Based on code by Dmitry Chernenkov.
|
|
*/
|
|
|
|
#include <linux/gfp.h>
|
|
#include <linux/jhash.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/printk.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/stacktrace.h>
|
|
#include <linux/stackdepot.h>
|
|
#include <linux/string.h>
|
|
#include <linux/types.h>
|
|
|
|
#define DEPOT_STACK_BITS (sizeof(depot_stack_handle_t) * 8)
|
|
|
|
#define STACK_ALLOC_NULL_PROTECTION_BITS 1
|
|
#define STACK_ALLOC_ORDER 2 /* 'Slab' size order for stack depot, 4 pages */
|
|
#define STACK_ALLOC_SIZE (1LL << (PAGE_SHIFT + STACK_ALLOC_ORDER))
|
|
#define STACK_ALLOC_ALIGN 4
|
|
#define STACK_ALLOC_OFFSET_BITS (STACK_ALLOC_ORDER + PAGE_SHIFT - \
|
|
STACK_ALLOC_ALIGN)
|
|
#define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \
|
|
STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS)
|
|
#define STACK_ALLOC_SLABS_CAP 8192
|
|
#define STACK_ALLOC_MAX_SLABS \
|
|
(((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \
|
|
(1LL << (STACK_ALLOC_INDEX_BITS)) : STACK_ALLOC_SLABS_CAP)
|
|
|
|
/* The compact structure to store the reference to stacks. */
|
|
union handle_parts {
|
|
depot_stack_handle_t handle;
|
|
struct {
|
|
u32 slabindex : STACK_ALLOC_INDEX_BITS;
|
|
u32 offset : STACK_ALLOC_OFFSET_BITS;
|
|
u32 valid : STACK_ALLOC_NULL_PROTECTION_BITS;
|
|
};
|
|
};
|
|
|
|
struct stack_record {
|
|
struct stack_record *next; /* Link in the hashtable */
|
|
u32 hash; /* Hash in the hastable */
|
|
u32 size; /* Number of frames in the stack */
|
|
union handle_parts handle;
|
|
unsigned long entries[1]; /* Variable-sized array of entries. */
|
|
};
|
|
|
|
static void *stack_slabs[STACK_ALLOC_MAX_SLABS];
|
|
|
|
static int depot_index;
|
|
static int next_slab_inited;
|
|
static size_t depot_offset;
|
|
static DEFINE_RAW_SPINLOCK(depot_lock);
|
|
|
|
static bool init_stack_slab(void **prealloc)
|
|
{
|
|
if (!*prealloc)
|
|
return false;
|
|
/*
|
|
* This smp_load_acquire() pairs with smp_store_release() to
|
|
* |next_slab_inited| below and in depot_alloc_stack().
|
|
*/
|
|
if (smp_load_acquire(&next_slab_inited))
|
|
return true;
|
|
if (stack_slabs[depot_index] == NULL) {
|
|
stack_slabs[depot_index] = *prealloc;
|
|
*prealloc = NULL;
|
|
} else {
|
|
/* If this is the last depot slab, do not touch the next one. */
|
|
if (depot_index + 1 < STACK_ALLOC_MAX_SLABS) {
|
|
stack_slabs[depot_index + 1] = *prealloc;
|
|
*prealloc = NULL;
|
|
}
|
|
/*
|
|
* This smp_store_release pairs with smp_load_acquire() from
|
|
* |next_slab_inited| above and in stack_depot_save().
|
|
*/
|
|
smp_store_release(&next_slab_inited, 1);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* Allocation of a new stack in raw storage */
|
|
static struct stack_record *depot_alloc_stack(unsigned long *entries, int size,
|
|
u32 hash, void **prealloc, gfp_t alloc_flags)
|
|
{
|
|
int required_size = offsetof(struct stack_record, entries) +
|
|
sizeof(unsigned long) * size;
|
|
struct stack_record *stack;
|
|
|
|
required_size = ALIGN(required_size, 1 << STACK_ALLOC_ALIGN);
|
|
|
|
if (unlikely(depot_offset + required_size > STACK_ALLOC_SIZE)) {
|
|
if (unlikely(depot_index + 1 >= STACK_ALLOC_MAX_SLABS)) {
|
|
WARN_ONCE(1, "Stack depot reached limit capacity");
|
|
return NULL;
|
|
}
|
|
depot_index++;
|
|
depot_offset = 0;
|
|
/*
|
|
* smp_store_release() here pairs with smp_load_acquire() from
|
|
* |next_slab_inited| in stack_depot_save() and
|
|
* init_stack_slab().
|
|
*/
|
|
if (depot_index + 1 < STACK_ALLOC_MAX_SLABS)
|
|
smp_store_release(&next_slab_inited, 0);
|
|
}
|
|
init_stack_slab(prealloc);
|
|
if (stack_slabs[depot_index] == NULL)
|
|
return NULL;
|
|
|
|
stack = stack_slabs[depot_index] + depot_offset;
|
|
|
|
stack->hash = hash;
|
|
stack->size = size;
|
|
stack->handle.slabindex = depot_index;
|
|
stack->handle.offset = depot_offset >> STACK_ALLOC_ALIGN;
|
|
stack->handle.valid = 1;
|
|
memcpy(stack->entries, entries, size * sizeof(unsigned long));
|
|
depot_offset += required_size;
|
|
|
|
return stack;
|
|
}
|
|
|
|
#define STACK_HASH_SIZE (1L << CONFIG_STACK_HASH_ORDER_SHIFT)
|
|
#define STACK_HASH_MASK (STACK_HASH_SIZE - 1)
|
|
#define STACK_HASH_SEED 0x9747b28c
|
|
|
|
static struct stack_record *stack_table[STACK_HASH_SIZE] = {
|
|
[0 ... STACK_HASH_SIZE - 1] = NULL
|
|
};
|
|
|
|
/* Calculate hash for a stack */
|
|
static inline u32 hash_stack(unsigned long *entries, unsigned int size)
|
|
{
|
|
return jhash2((u32 *)entries,
|
|
size * sizeof(unsigned long) / sizeof(u32),
|
|
STACK_HASH_SEED);
|
|
}
|
|
|
|
/* Use our own, non-instrumented version of memcmp().
|
|
*
|
|
* We actually don't care about the order, just the equality.
|
|
*/
|
|
static inline
|
|
int stackdepot_memcmp(const unsigned long *u1, const unsigned long *u2,
|
|
unsigned int n)
|
|
{
|
|
for ( ; n-- ; u1++, u2++) {
|
|
if (*u1 != *u2)
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* Find a stack that is equal to the one stored in entries in the hash */
|
|
static inline struct stack_record *find_stack(struct stack_record *bucket,
|
|
unsigned long *entries, int size,
|
|
u32 hash)
|
|
{
|
|
struct stack_record *found;
|
|
|
|
for (found = bucket; found; found = found->next) {
|
|
if (found->hash == hash &&
|
|
found->size == size &&
|
|
!stackdepot_memcmp(entries, found->entries, size))
|
|
return found;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
/**
|
|
* stack_depot_fetch - Fetch stack entries from a depot
|
|
*
|
|
* @handle: Stack depot handle which was returned from
|
|
* stack_depot_save().
|
|
* @entries: Pointer to store the entries address
|
|
*
|
|
* Return: The number of trace entries for this depot.
|
|
*/
|
|
unsigned int stack_depot_fetch(depot_stack_handle_t handle,
|
|
unsigned long **entries)
|
|
{
|
|
union handle_parts parts = { .handle = handle };
|
|
void *slab = stack_slabs[parts.slabindex];
|
|
size_t offset = parts.offset << STACK_ALLOC_ALIGN;
|
|
struct stack_record *stack = slab + offset;
|
|
|
|
*entries = stack->entries;
|
|
return stack->size;
|
|
}
|
|
EXPORT_SYMBOL_GPL(stack_depot_fetch);
|
|
|
|
/**
|
|
* stack_depot_save - Save a stack trace from an array
|
|
*
|
|
* @entries: Pointer to storage array
|
|
* @nr_entries: Size of the storage array
|
|
* @alloc_flags: Allocation gfp flags
|
|
*
|
|
* Return: The handle of the stack struct stored in depot
|
|
*/
|
|
depot_stack_handle_t stack_depot_save(unsigned long *entries,
|
|
unsigned int nr_entries,
|
|
gfp_t alloc_flags)
|
|
{
|
|
struct stack_record *found = NULL, **bucket;
|
|
depot_stack_handle_t retval = 0;
|
|
struct page *page = NULL;
|
|
void *prealloc = NULL;
|
|
unsigned long flags;
|
|
u32 hash;
|
|
|
|
if (unlikely(nr_entries == 0))
|
|
goto fast_exit;
|
|
|
|
hash = hash_stack(entries, nr_entries);
|
|
bucket = &stack_table[hash & STACK_HASH_MASK];
|
|
|
|
/*
|
|
* Fast path: look the stack trace up without locking.
|
|
* The smp_load_acquire() here pairs with smp_store_release() to
|
|
* |bucket| below.
|
|
*/
|
|
found = find_stack(smp_load_acquire(bucket), entries,
|
|
nr_entries, hash);
|
|
if (found)
|
|
goto exit;
|
|
|
|
/*
|
|
* Check if the current or the next stack slab need to be initialized.
|
|
* If so, allocate the memory - we won't be able to do that under the
|
|
* lock.
|
|
*
|
|
* The smp_load_acquire() here pairs with smp_store_release() to
|
|
* |next_slab_inited| in depot_alloc_stack() and init_stack_slab().
|
|
*/
|
|
if (unlikely(!smp_load_acquire(&next_slab_inited))) {
|
|
/*
|
|
* Zero out zone modifiers, as we don't have specific zone
|
|
* requirements. Keep the flags related to allocation in atomic
|
|
* contexts, I/O, nolockdep.
|
|
*/
|
|
alloc_flags &= ~GFP_ZONEMASK;
|
|
alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | __GFP_NOLOCKDEP);
|
|
alloc_flags |= __GFP_NOWARN;
|
|
page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER);
|
|
if (page)
|
|
prealloc = page_address(page);
|
|
}
|
|
|
|
raw_spin_lock_irqsave(&depot_lock, flags);
|
|
|
|
found = find_stack(*bucket, entries, nr_entries, hash);
|
|
if (!found) {
|
|
struct stack_record *new =
|
|
depot_alloc_stack(entries, nr_entries,
|
|
hash, &prealloc, alloc_flags);
|
|
if (new) {
|
|
new->next = *bucket;
|
|
/*
|
|
* This smp_store_release() pairs with
|
|
* smp_load_acquire() from |bucket| above.
|
|
*/
|
|
smp_store_release(bucket, new);
|
|
found = new;
|
|
}
|
|
} else if (prealloc) {
|
|
/*
|
|
* We didn't need to store this stack trace, but let's keep
|
|
* the preallocated memory for the future.
|
|
*/
|
|
WARN_ON(!init_stack_slab(&prealloc));
|
|
}
|
|
|
|
raw_spin_unlock_irqrestore(&depot_lock, flags);
|
|
exit:
|
|
if (prealloc) {
|
|
/* Nobody used this memory, ok to free it. */
|
|
free_pages((unsigned long)prealloc, STACK_ALLOC_ORDER);
|
|
}
|
|
if (found)
|
|
retval = found->handle.handle;
|
|
fast_exit:
|
|
return retval;
|
|
}
|
|
EXPORT_SYMBOL_GPL(stack_depot_save);
|