6.10.7-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainercover 6.10.7-rc1 review
This is the start of the stable review cycle for the 6.10.7 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 29 Aug 2024 14:37:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.10.7-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 6.10.7-rc1
Tetsuo Handa <[email protected]>
Input: MT - limit max slots
Namjae Jeon <[email protected]>
ksmbd: fix race condition between destroy_previous_session() and smb2 operations()
Yonghong Song <[email protected]>
selftests/bpf: Add a test to verify previous stacksafe() fix
Boyuan Zhang <[email protected]>
drm/amdgpu/vcn: not pause dpg for unified queue
Boyuan Zhang <[email protected]>
drm/amdgpu/vcn: identify unified queue in sw init
Christian Brauner <[email protected]>
Revert "pidfd: prevent creation of pidfds for kthreads"
Matthew Brost <[email protected]>
drm/xe: Do not dereference NULL job->fence in trace points
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: join: check re-using ID of closed subflow
Matthieu Baerts (NGI0) <[email protected]>
selftests: mptcp: join: validate fullmesh endp on 1st sf
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: avoid possible UaF when selecting endp
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: fullmesh: select the right ID later
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: only in-kernel cannot have entries with ID 0
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: check add_addr_accept_max before accepting new ADD_ADDR
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: only decrement add_addr_accepted for MPJ req
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: only mark 'subflow' endp as available
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: remove mptcp_pm_remove_subflow()
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: re-using ID of unused flushed subflows
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: re-using ID of unused removed subflows
Matthieu Baerts (NGI0) <[email protected]>
mptcp: pm: re-using ID of unused removed ADD_ADDR
Krzysztof Kozlowski <[email protected]>
thermal: of: Fix OF node leak in of_thermal_zone_find() error paths
Krzysztof Kozlowski <[email protected]>
thermal: of: Fix OF node leak in thermal_of_zone_register()
Krzysztof Kozlowski <[email protected]>
thermal: of: Fix OF node leak in thermal_of_trips_init() error path
Dave Airlie <[email protected]>
nouveau/firmware: use dma non-coherent allocator
Peng Fan <[email protected]>
pmdomain: imx: wait SSAR when i.MX93 power domain on
Alexander Stein <[email protected]>
pmdomain: imx: scu-pd: Remove duplicated clocks
Steve French <[email protected]>
smb3: fix broken cached reads when posix locks
Ben Whitten <[email protected]>
mmc: dw_mmc: allow biu and ciu clocks to defer
Mengqi Zhang <[email protected]>
mmc: mtk-sd: receive cmd8 data when hs400 tuning fail
Waiman Long <[email protected]>
cgroup/cpuset: Clear effective_xcpus on cpus_allowed clearing only if cpus.exclusive not set
Chen Ridong <[email protected]>
cgroup/cpuset: fix panic caused by partcmd_update
Marc Zyngier <[email protected]>
KVM: arm64: Make ICC_*SGI*_EL1 undef in the absence of a vGICv3
Zenghui Yu <[email protected]>
KVM: arm64: vgic-debug: Don't put unmarked LPIs
Nikolay Kuratov <[email protected]>
cxgb4: add forgotten u64 ivlan cast before shift
Michael Ellerman <[email protected]>
ata: pata_macio: Fix DMA table overflow
Werner Sembach <[email protected]>
Input: i8042 - use new forcenorestore quirk to replace old buggy quirk combination
Werner Sembach <[email protected]>
Input: i8042 - add forcenorestore quirk to leave controller untouched even on s3
Nicolin Chen <[email protected]>
iommufd/device: Fix hwpt at err_unresv in iommufd_device_do_replace()
Jason Gerecke <[email protected]>
HID: wacom: Defer calculation of resolution until resolution_code is known
Jiaxun Yang <[email protected]>
MIPS: Loongson64: Set timer mode in cpu-probe
Martin Whitaker <[email protected]>
net: dsa: microchip: fix PTP config failure when using multiple ports
Mengyuan Lou <[email protected]>
net: ngbe: Fix phy mode set to external phy
Harald Freudenberger <[email protected]>
s390/ap: Refine AP bus bindings complete processing
Srinivas Pandruvada <[email protected]>
platform/x86: ISST: Fix return value on last invalid resource
Hans de Goede <[email protected]>
platform/x86: dell-uart-backlight: Use acpi_video_get_backlight_type()
Hans de Goede <[email protected]>
ACPI: video: Add backlight=native quirk for Dell OptiPlex 7760 AIO
Hans de Goede <[email protected]>
ACPI: video: Add Dell UART backlight controller detection
Alex Deucher <[email protected]>
drm/amdgpu/sdma5.2: limit wptr workaround to sdma 5.2.1
Candice Li <[email protected]>
drm/amdgpu: Validate TA binary size
Namjae Jeon <[email protected]>
ksmbd: the buffer of smb2 query dir response has at least 1 byte
Chaotian Jing <[email protected]>
scsi: core: Fix the return value of scsi_logical_block_count()
Griffin Kroah-Hartman <[email protected]>
Bluetooth: MGMT: Add error handling to pair_device()
Ming Lei <[email protected]>
nvme: move stopping keep-alive into nvme_uninit_ctrl()
Paulo Alcantara <[email protected]>
smb: client: ignore unhandled reparse tags
Alexander Gordeev <[email protected]>
s390/boot: Fix KASLR base offset off by __START_KERNEL bytes
Alexander Gordeev <[email protected]>
s390/boot: Avoid possible physmem_info segment corruption
Yang Ruibin <[email protected]>
thermal/debugfs: Fix the NULL vs IS_ERR() confusion in debugfs_create_dir()
Matthew Brost <[email protected]>
drm/xe: Free job before xe_exec_queue_put
Thomas Hellström <[email protected]>
drm/xe: Don't initialize fences at xe_sched_job_create()
Thomas Hellström <[email protected]>
drm/xe: Split lrc seqno fence creation up
Matthew Brost <[email protected]>
drm/xe: Decouple job seqno and lrc seqno
Rodrigo Vivi <[email protected]>
drm/xe: Relax runtime pm protection during execution
Stuart Summers <[email protected]>
drm/xe: Fix missing workqueue destroy in xe_gt_pagefault
Jens Axboe <[email protected]>
io_uring/kbuf: sanitize peek buffer setup
Dan Carpenter <[email protected]>
mmc: mmc_test: Fix NULL dereference on allocation failure
Matthew Brost <[email protected]>
drm/xe: Fix tile fini sequence
Matthew Auld <[email protected]>
drm/xe: reset mmio mappings with devm
Matthew Auld <[email protected]>
drm/xe/mmio: move mmio_fini over to devm
Lucas De Marchi <[email protected]>
drm/xe: Fix opregion leak
Matthew Auld <[email protected]>
drm/xe/display: stop calling domains_driver_remove twice
Suraj Kandpal <[email protected]>
drm/i915/hdcp: Use correct cp_irq_count
Vignesh Raghavendra <[email protected]>
spi: spi-cadence-quadspi: Fix OSPI NOR failures during system resume
Abhinav Kumar <[email protected]>
drm/msm: fix the highest_bank_bit for sc7180
Tejun Heo <[email protected]>
workqueue: Fix spruious data race in __flush_work()
Will Deacon <[email protected]>
workqueue: Fix UBSAN 'subtraction overflow' error in shift_and_mask()
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: take plane rotation into account for wide planes
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: relax YUV requirements
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: limit QCM2290 to RGB formats only
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: cleanup FB if dpu_format_populate_layout fails
Abhinav Kumar <[email protected]>
drm/msm/dp: reset the link phy params before link training
Abhinav Kumar <[email protected]>
drm/msm/dpu: move dpu_encoder's connector assignment to atomic_enable()
Abhinav Kumar <[email protected]>
drm/msm/dp: fix the max supported bpp logic
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: don't play tricks with debug macros
Alexandra Winter <[email protected]>
s390/iucv: Fix vargs handling in iucv_alloc_device()
Menglong Dong <[email protected]>
net: ovs: fix ovs_drop_reasons error
Sean Anderson <[email protected]>
net: xilinx: axienet: Fix dangling multicast addresses
Sean Anderson <[email protected]>
net: xilinx: axienet: Always disable promiscuous mode
Bharat Bhushan <[email protected]>
octeontx2-af: Fix CPT AF register offset calculation
Pablo Neira Ayuso <[email protected]>
netfilter: flowtable: validate vlan header
Somnath Kotur <[email protected]>
bnxt_en: Fix double DMA unmapping for XDP_REDIRECT
Eric Dumazet <[email protected]>
ipv6: prevent possible UAF in ip6_xmit()
Eric Dumazet <[email protected]>
ipv6: fix possible UAF in ip6_finish_output2()
Eric Dumazet <[email protected]>
ipv6: prevent UAF in ip6_send_skb()
Ido Schimmel <[email protected]>
selftests: mlxsw: ethtool_lanes: Source ethtool lib from correct path
Felix Fietkau <[email protected]>
udp: fix receiving fraglist GSO packets
Stephen Hemminger <[email protected]>
netem: fix return value if duplicate enqueue fails
Joseph Huang <[email protected]>
net: dsa: mv88e6xxx: Fix out-of-bound access
Paolo Abeni <[email protected]>
igb: cope with large MAX_SKB_FRAGS
Dan Carpenter <[email protected]>
dpaa2-switch: Fix error checking in dpaa2_switch_seed_bp()
Michal Swiatkowski <[email protected]>
ice: use internal pf id instead of function number
Maciej Fijalkowski <[email protected]>
ice: fix truesize operations for PAGE_SIZE >= 8192
Maciej Fijalkowski <[email protected]>
ice: fix ICE_LAST_OFFSET formula
Maciej Fijalkowski <[email protected]>
ice: fix page reuse when PAGE_SIZE is over 8k
Nikolay Aleksandrov <[email protected]>
bonding: fix xfrm state handling when clearing active slave
Nikolay Aleksandrov <[email protected]>
bonding: fix xfrm real_dev null pointer dereference
Nikolay Aleksandrov <[email protected]>
bonding: fix null pointer deref in bond_ipsec_offload_ok
Nikolay Aleksandrov <[email protected]>
bonding: fix bond_ipsec_offload_ok return type
Thomas Bogendoerfer <[email protected]>
ip6_tunnel: Fix broken GRO
Sebastian Andrzej Siewior <[email protected]>
netfilter: nft_counter: Synchronize nft_counter_reset() against reader.
Sebastian Andrzej Siewior <[email protected]>
netfilter: nft_counter: Disable BH in nft_counter_offload_stats().
Kuniyuki Iwashima <[email protected]>
kcm: Serialise kcm_sendmsg() for the same socket.
Jeremy Kerr <[email protected]>
net: mctp: test: Use correct skb for route input check
Florian Westphal <[email protected]>
tcp: prevent concurrent execution of tcp_sk_exit_batch
Hangbin Liu <[email protected]>
selftests: udpgro: no need to load xdp for gro
Hangbin Liu <[email protected]>
selftests: udpgro: report error when receive failed
Simon Horman <[email protected]>
tc-testing: don't access non-existent variable on exception
Patrisious Haddad <[email protected]>
net/mlx5: Fix IPsec RoCE MPV trace call
Carolina Jubran <[email protected]>
net/mlx5e: XPS, Fix oversight of Multi-PF Netdev changes
Vladimir Oltean <[email protected]>
net: mscc: ocelot: serialize access to the injection/extraction groups
Vladimir Oltean <[email protected]>
net: mscc: ocelot: fix QoS class for injected packets with "ocelot-8021q"
Vladimir Oltean <[email protected]>
net: mscc: ocelot: use ocelot_xmit_get_vlan_info() also for FDMA and register injection
Luiz Augusto von Dentz <[email protected]>
Bluetooth: SMP: Fix assumption of Central always being Initiator
Luiz Augusto von Dentz <[email protected]>
Bluetooth: hci_core: Fix LE quote calculation
Luiz Augusto von Dentz <[email protected]>
Bluetooth: HCI: Invert LE State quirk to be opt-out rather then opt-in
Masahiro Yamada <[email protected]>
kbuild: avoid scripts/kallsyms parsing /dev/null
Masahiro Yamada <[email protected]>
kbuild: merge temporary vmlinux for BTF and kallsyms
Alexandre Courbot <[email protected]>
Makefile: add $(srctree) to dependency of compile_commands.json target
Takashi Iwai <[email protected]>
ALSA: hda/tas2781: Use correct endian conversion
Maximilian Luz <[email protected]>
platform/surface: aggregator: Fix warning when controller is destroyed in probe
Baochen Qiang <[email protected]>
wifi: ath12k: use 128 bytes aligned iova in transmit path for WCN7850
Mikulas Patocka <[email protected]>
dm suspend: return -ERESTARTSYS instead of -EINTR
Su Hui <[email protected]>
smb/client: avoid possible NULL dereference in cifs_free_subrequest()
David Howells <[email protected]>
cifs: Add a tracepoint to track credits involved in R/W requests
Rafael J. Wysocki <[email protected]>
thermal: gov_bang_bang: Use governor_data to reduce overhead
Rafael J. Wysocki <[email protected]>
thermal: gov_bang_bang: Add .manage() callback
Rafael J. Wysocki <[email protected]>
thermal: gov_bang_bang: Split bang_bang_control()
Rafael J. Wysocki <[email protected]>
thermal: gov_bang_bang: Drop unnecessary cooling device target state checks
Mario Limonciello <[email protected]>
drm/amd/display: Don't register panel_power_savings on OLED panels
Li Lingfeng <[email protected]>
block: Fix lockdep warning in blk_mq_mark_tag_wait
Samuel Holland <[email protected]>
arm64: Fix KASAN random tag seed initialization
Ryo Takakura <[email protected]>
printk/panic: Allow cpu backtraces to be written into ringbuffer during panic
Nysal Jan K.A <[email protected]>
powerpc/topology: Check if a core is online
Nysal Jan K.A <[email protected]>
cpu/SMT: Enable SMT only if a core is online
Olivier Langlois <[email protected]>
io_uring/napi: check napi_enabled in io_napi_add() before proceeding
Pavel Begunkov <[email protected]>
io_uring/napi: use ktime in busy polling
Thorsten Blum <[email protected]>
io_uring/napi: Remove unnecessary s64 cast
Eric Farman <[email protected]>
s390/dasd: Remove DMA alignment
Masahiro Yamada <[email protected]>
rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
Masahiro Yamada <[email protected]>
rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
Miguel Ojeda <[email protected]>
rust: work around bindgen 0.69.0 issue
Maíra Canal <[email protected]>
drm/v3d: Fix out-of-bounds read in v3d_csd_job_run()
Parsa Poorshikhian <[email protected]>
ALSA: hda/realtek: Fix noise from speakers on Lenovo IdeaPad 3 15IAU7
Asmaa Mnebhi <[email protected]>
gpio: mlxbf3: Support shutdown() function
Barak Biber <[email protected]>
iommu: Restore lost return in iommu_report_device_fault()
Song Liu <[email protected]>
kallsyms: Match symbols exactly with CONFIG_LTO_CLANG
Song Liu <[email protected]>
kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols
Jann Horn <[email protected]>
kallsyms: get rid of code for absolute kallsyms
Masahiro Yamada <[email protected]>
kbuild: remove PROVIDE() for kallsyms symbols
Masahiro Yamada <[email protected]>
kbuild: refactor variables in scripts/link-vmlinux.sh
Jie Wang <[email protected]>
net: hns3: fix a deadlock problem when config TC during resetting
Peiyang Wang <[email protected]>
net: hns3: use the user's cfg after reset
Jie Wang <[email protected]>
net: hns3: fix wrong use of semaphore up
Matthieu Baerts (NGI0) <[email protected]>
selftests: net: lib: kill PIDs before del netns
Matthieu Baerts (NGI0) <[email protected]>
selftests: net: lib: ignore possible errors
Cong Wang <[email protected]>
vsock: fix recursive ->recvmsg calls
Abhinav Jain <[email protected]>
selftest: af_unix: Fix kselftest compilation warnings
Phil Sutter <[email protected]>
netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests
Phil Sutter <[email protected]>
netfilter: nf_tables: Introduce nf_tables_getobj_single
Phil Sutter <[email protected]>
netfilter: nf_tables: Audit log dump reset after the fact
Florian Westphal <[email protected]>
netfilter: nf_queue: drop packets with cloned unconfirmed conntracks
Donald Hunter <[email protected]>
netfilter: flowtable: initialise extack before use
Donald Hunter <[email protected]>
netfilter: nfnetlink: Initialise extack before use in ACKs
Tom Hughes <[email protected]>
netfilter: allow ipv6 fragments to arrive on different devices
Subash Abhinov Kasiviswanathan <[email protected]>
tcp: Update window clamping condition
Eugene Syromiatnikov <[email protected]>
mptcp: correct MPTCP_SUBFLOW_ATTR_SSN_OFFSET reserved size
David Thompson <[email protected]>
mlxbf_gige: disable RX filters until RX path initialized
Zheng Zhang <[email protected]>
net: ethernet: mtk_wed: fix use-after-free panic in mtk_wed_setup_tc_block_cb()
Pawel Dembicki <[email protected]>
net: dsa: vsc73xx: check busy flag in MDIO operations
Pawel Dembicki <[email protected]>
net: dsa: vsc73xx: pass value in phy_write operation
Pawel Dembicki <[email protected]>
net: dsa: vsc73xx: fix port MAC configuration in full duplex mode
Radhey Shyam Pandey <[email protected]>
net: axienet: Fix register defines comment description
Dan Carpenter <[email protected]>
atm: idt77252: prevent use after free in dequeue_rx()
Cosmin Ratiu <[email protected]>
net/mlx5e: Correctly report errors for ethtool rx flows
Dragos Tatulea <[email protected]>
net/mlx5e: Take state lock during tx timeout reporter
Tariq Toukan <[email protected]>
net/mlx5: SD, Do not query MPIR register if no sd_group
Eric Dumazet <[email protected]>
gtp: pull network headers in gtp_dev_xmit()
Faizal Rahim <[email protected]>
igc: Fix qbv tx latency by setting gtxoffset
Faizal Rahim <[email protected]>
igc: Fix reset adapter logics when tx mode change
Faizal Rahim <[email protected]>
igc: Fix qbv_config_change_errors logics
Faizal Rahim <[email protected]>
igc: Fix packet still tx after gate close by reducing i226 MAC retry buffer
Naohiro Aota <[email protected]>
btrfs: fix invalid mapping of extent xarray state
Dominique Martinet <[email protected]>
9p: Fix DIO read through netfs
Yonghong Song <[email protected]>
bpf: Fix a kernel verifier crash in stacksafe()
Leon Hwang <[email protected]>
bpf: Fix updating attached freplace prog in prog_array map
yangerkun <[email protected]>
libfs: fix infinite directory reads for offset dir
Omar Sandoval <[email protected]>
filelock: fix name of file_lease slab cache
Matthew Wilcox (Oracle) <[email protected]>
netfs: Fault in smaller chunks for non-large folio mappings
Claudio Imbrenda <[email protected]>
s390/uv: Panic for set and remove shared access UVC errors
Christian Brauner <[email protected]>
pidfd: prevent creation of pidfds for kthreads
David (Ming Qiang) Wu <[email protected]>
drm/amd/amdgpu: command submission parser for JPEG
Alex Deucher <[email protected]>
drm/amdgpu/jpeg4: properly set atomics vmid field
Alex Deucher <[email protected]>
drm/amdgpu/jpeg2: properly set atomics vmid field
Melissa Wen <[email protected]>
drm/amd/display: fix cursor offset on rotation 180
Loan Chen <[email protected]>
drm/amd/display: Enable otg synchronization logic for DCN321
Hamza Mahfooz <[email protected]>
drm/amd/display: fix s2idle entry for DCN3.5+
Rodrigo Siqueira <[email protected]>
drm/amd/display: Adjust cursor position
Al Viro <[email protected]>
memcg_write_event_control(): fix a user-triggerable oops
Bas Nieuwenhuizen <[email protected]>
drm/amdgpu: Actually check flags for all context ops.
Qu Wenruo <[email protected]>
btrfs: only enable extent map shrinker for DEBUG builds
Qu Wenruo <[email protected]>
btrfs: tree-checker: add dev extent item checks
Naohiro Aota <[email protected]>
btrfs: zoned: properly take lock to read/update block group's zoned variables
Filipe Manana <[email protected]>
btrfs: only run the extent map shrinker from kswapd tasks
Josef Bacik <[email protected]>
btrfs: check delayed refs when we're checking if a ref exists
Filipe Manana <[email protected]>
btrfs: send: allow cloning non-aligned extent if it ends at i_size
Qu Wenruo <[email protected]>
btrfs: tree-checker: reject BTRFS_FT_UNKNOWN dir type
Zi Yan <[email protected]>
mm/numa: no task_numa_fault() call if PTE is changed
Hailong Liu <[email protected]>
mm/vmalloc: fix page mapping if vm_area_alloc_pages() with high order fallback to order 0
Zi Yan <[email protected]>
mm/numa: no task_numa_fault() call if PMD is changed
Suren Baghdasaryan <[email protected]>
alloc_tag: introduce clear_page_tag_ref() helper function
Muhammad Usama Anjum <[email protected]>
selftests: memfd_secret: don't build memfd_secret test on unsupported arches
Waiman Long <[email protected]>
mm/memory-failure: use raw_spinlock_t in struct memory_failure_cpu
Suren Baghdasaryan <[email protected]>
alloc_tag: mark pages reserved during CMA activation as not tagged
Zhen Lei <[email protected]>
selinux: add the processing of the failure of avc_add_xperms_decision()
Zhen Lei <[email protected]>
selinux: fix potential counting error in avc_add_xperms_decision()
Max Kellermann <[email protected]>
fs/netfs/fscache_cookie: add missing "n_accesses" check
Janne Grunau <[email protected]>
wifi: brcmfmac: cfg80211: Handle SSID based pmksa deletion
Long Li <[email protected]>
net: mana: Fix doorbell out of order violation and avoid unnecessary doorbell rings
Hans de Goede <[email protected]>
media: atomisp: Fix streaming no longer working on BYT / ISP2400 devices
Haiyang Zhang <[email protected]>
net: mana: Fix RX buf alloc_size alignment and atomic op panic
Yu Kuai <[email protected]>
md/raid1: Fix data corruption for degraded array with slow disk
David Hildenbrand <[email protected]>
mm/hugetlb: fix hugetlb vs. core-mm PT locking
Kirill A. Shutemov <[email protected]>
mm: fix endless reclaim on machines with unaccepted memory
Dan Carpenter <[email protected]>
rtla/osnoise: Prevent NULL dereference in error handling
Pedro Falcato <[email protected]>
mseal: fix is_madv_discard()
Kyle Huey <[email protected]>
perf/bpf: Don't call bpf_overflow_handler() for tracing events
Steven Rostedt <[email protected]>
tracing: Return from tracing_buffers_read() if the file has been closed
Andi Shyti <[email protected]>
i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
Al Viro <[email protected]>
fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
Zhihao Cheng <[email protected]>
vfs: Don't evict inode under the inode lru traversing context
Mikulas Patocka <[email protected]>
dm persistent data: fix memory allocation failure
Khazhismel Kumykov <[email protected]>
dm resume: don't return EINVAL when signalled
Haibo Xu <[email protected]>
arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
Rafael J. Wysocki <[email protected]>
ACPI: EC: Evaluate _REG outside the EC scope more carefully
Rafael J. Wysocki <[email protected]>
ACPICA: Add a depth argument to acpi_execute_reg_methods()
Breno Leitao <[email protected]>
i2c: tegra: Do not mark ACPI devices as irq safe
Steve French <[email protected]>
smb3: fix lock breakage for cached writes
Celeste Liu <[email protected]>
riscv: entry: always initialize regs->a0 to -ENOSYS
Nam Cao <[email protected]>
riscv: change XIP's kernel_map.size to be size of the entire kernel
David Gstir <[email protected]>
KEYS: trusted: dcp: fix leak of blob encryption key
David Gstir <[email protected]>
KEYS: trusted: fix DCP blob payload length assignment
Rafael J. Wysocki <[email protected]>
thermal: gov_bang_bang: Call __thermal_cdev_update() directly
Michael Mueller <[email protected]>
KVM: s390: fix validity interception issue when gisa is switched off
Stefan Haberland <[email protected]>
s390/dasd: fix error recovery leading to data corruption on ESE devices
Takashi Iwai <[email protected]>
ALSA: timer: Relax start tick time check for slave timer elements
Baojun Xu <[email protected]>
ALSA: hda/tas2781: fix wrong calibrated data order
Mika Westerberg <[email protected]>
thunderbolt: Mark XDomain as unplugged when router is removed
Mathias Nyman <[email protected]>
xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
Marc Zyngier <[email protected]>
usb: xhci: Check for xhci->interrupters being allocated in xhci_mem_clearup()
Hans de Goede <[email protected]>
usb: misc: ljca: Add Lunar Lake ljca GPIO HID to ljca_gpio_hids[]
Juan José Arboleda <[email protected]>
ALSA: usb-audio: Support Yamaha P-125 quirk entry
Lianqin Hu <[email protected]>
ALSA: usb-audio: Add delay quirk for VIVO USB-C-XE710 HEADSET
Eli Billauer <[email protected]>
char: xillybus: Check USB endpoints when probing device
Eli Billauer <[email protected]>
char: xillybus: Refine workqueue handling
Eli Billauer <[email protected]>
char: xillybus: Don't destroy workqueue from work item running on it
Jann Horn <[email protected]>
fuse: Initialize beyond-EOF page contents before setting uptodate
David Howells <[email protected]>
netfs, ceph: Revert "netfs: Remove deprecated use of PG_private_2 as a second writeback flag"
Paul Moore <[email protected]>
selinux: revert our use of vma_is_initial_heap()
Xu Yang <[email protected]>
Revert "usb: typec: tcpm: clear pd_event queue in PORT_RESET"
Griffin Kroah-Hartman <[email protected]>
Revert "serial: 8250_omap: Set the console genpd always on if no console suspend"
Griffin Kroah-Hartman <[email protected]>
Revert "misc: fastrpc: Restrict untrusted app to attach to privileged PD"
Rafael J. Wysocki <[email protected]>
Revert "ACPI: EC: Evaluate orphan _REG under EC device"
Mathieu Othacehe <[email protected]>
tty: atmel_serial: use the correct RTS flag.
Peng Fan <[email protected]>
tty: serial: fsl_lpuart: mark last busy before uart_add_one_port
Masahiro Yamada <[email protected]>
tty: vt: conmakehash: remove non-portable code printing comment header
-------------
Diffstat:
Documentation/ABI/testing/sysfs-devices-system-cpu | 3 +- Makefile | 6 +- arch/arm64/kernel/acpi_numa.c | 2 +- arch/arm64/kernel/setup.c | 3 - arch/arm64/kernel/smp.c | 2 + arch/arm64/kvm/sys_regs.c | 6 + arch/arm64/kvm/vgic/vgic-debug.c | 2 +- arch/arm64/kvm/vgic/vgic.h | 7 + arch/mips/kernel/cpu-probe.c | 4 + arch/powerpc/include/asm/topology.h | 13 ++ arch/riscv/kernel/traps.c | 4 +- arch/riscv/mm/init.c | 4 +- arch/s390/boot/startup.c | 55 ++++--- arch/s390/boot/vmem.c | 14 +- arch/s390/boot/vmlinux.lds.S | 7 +- arch/s390/include/asm/page.h | 3 +- arch/s390/include/asm/uv.h | 5 +- arch/s390/kernel/vmlinux.lds.S | 2 +- arch/s390/kvm/kvm-s390.h | 7 +- arch/s390/tools/relocs.c | 2 +- block/blk-mq-tag.c | 5 +- drivers/acpi/acpica/acevents.h | 6 +- drivers/acpi/acpica/evregion.c | 12 +- drivers/acpi/acpica/evxfregn.c | 64 +------- drivers/acpi/ec.c | 14 +- drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 2 + drivers/acpi/video_detect.c | 22 +++ drivers/ata/pata_macio.c | 23 ++- drivers/atm/idt77252.c | 9 +- drivers/bluetooth/btintel.c | 10 -- drivers/bluetooth/btintel_pcie.c | 3 - drivers/bluetooth/btmtksdio.c | 3 - drivers/bluetooth/btrtl.c | 1 - drivers/bluetooth/btusb.c | 4 +- drivers/bluetooth/hci_qca.c | 4 +- drivers/bluetooth/hci_vhci.c | 2 - drivers/char/xillybus/xillyusb.c | 42 ++++- drivers/gpio/gpio-mlxbf3.c | 14 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 53 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c | 63 ++++++- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.h | 7 +- drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 1 + drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 +- drivers/gpu/drm/amd/amdgpu/soc15d.h | 6 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 +++- .../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 4 +- .../display/dc/resource/dcn321/dcn321_resource.c | 3 + drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 +- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 20 ++- drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 + drivers/gpu/drm/msm/dp/dp_panel.c | 19 ++- drivers/gpu/drm/msm/msm_mdss.c | 2 +- drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 9 +- drivers/gpu/drm/nouveau/nvkm/falcon/fw.c | 6 + drivers/gpu/drm/v3d/v3d_sched.c | 14 +- drivers/gpu/drm/xe/display/xe_display.c | 6 +- drivers/gpu/drm/xe/xe_device.c | 4 +- drivers/gpu/drm/xe/xe_exec_queue.c | 19 --- drivers/gpu/drm/xe/xe_exec_queue_types.h | 10 -- drivers/gpu/drm/xe/xe_gt_pagefault.c | 18 +- drivers/gpu/drm/xe/xe_guc_submit.c | 8 +- drivers/gpu/drm/xe/xe_hw_fence.c | 59 +++++-- drivers/gpu/drm/xe/xe_hw_fence.h | 7 +- drivers/gpu/drm/xe/xe_lrc.c | 48 +++++- drivers/gpu/drm/xe/xe_lrc.h | 3 + drivers/gpu/drm/xe/xe_mmio.c | 41 ++++- drivers/gpu/drm/xe/xe_mmio.h | 2 +- drivers/gpu/drm/xe/xe_ring_ops.c | 22 +-- drivers/gpu/drm/xe/xe_sched_job.c | 182 ++++++++++++--------- drivers/gpu/drm/xe/xe_sched_job.h | 7 +- drivers/gpu/drm/xe/xe_sched_job_types.h | 20 ++- drivers/gpu/drm/xe/xe_trace.h | 11 +- drivers/hid/wacom_wac.c | 4 +- drivers/i2c/busses/i2c-qcom-geni.c | 4 +- drivers/i2c/busses/i2c-tegra.c | 4 +- drivers/input/input-mt.c | 3 + drivers/input/serio/i8042-acpipnpio.h | 20 +-- drivers/input/serio/i8042.c | 10 +- drivers/iommu/io-pgfault.c | 1 + drivers/iommu/iommufd/device.c | 2 +- drivers/md/dm-ioctl.c | 22 ++- drivers/md/dm.c | 4 +- drivers/md/persistent-data/dm-space-map-metadata.c | 4 +- drivers/md/raid1.c | 14 +- drivers/misc/fastrpc.c | 22 +-- drivers/mmc/core/mmc_test.c | 9 +- drivers/mmc/host/dw_mmc.c | 8 + drivers/mmc/host/mtk-sd.c | 8 +- drivers/net/bonding/bond_main.c | 21 +-- drivers/net/bonding/bond_options.c | 2 +- drivers/net/dsa/microchip/ksz_ptp.c | 5 +- drivers/net/dsa/mv88e6xxx/global1_atu.c | 3 +- drivers/net/dsa/ocelot/felix.c | 11 ++ drivers/net/dsa/vitesse-vsc73xx-core.c | 45 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 5 - drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 +- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 7 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 28 +++- .../ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c | 3 + .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 +- .../net/ethernet/intel/ice/devlink/devlink_port.c | 4 +- drivers/net/ethernet/intel/ice/ice_base.c | 21 ++- drivers/net/ethernet/intel/ice/ice_txrx.c | 47 +----- drivers/net/ethernet/intel/igb/igb_main.c | 1 + drivers/net/ethernet/intel/igc/igc_defines.h | 6 + drivers/net/ethernet/intel/igc/igc_main.c | 8 +- drivers/net/ethernet/intel/igc/igc_tsn.c | 76 +++++++-- drivers/net/ethernet/intel/igc/igc_tsn.h | 1 + .../net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 23 ++- drivers/net/ethernet/mediatek/mtk_wed.c | 6 +- .../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 2 + .../ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 15 +- .../mellanox/mlx5/core/lib/ipsec_fs_roce.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c | 18 +- .../net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h | 8 + .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 10 ++ .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h | 2 + .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c | 50 +++++- drivers/net/ethernet/microsoft/mana/mana_en.c | 28 +++- drivers/net/ethernet/mscc/ocelot.c | 91 ++++++++++- drivers/net/ethernet/mscc/ocelot_fdma.c | 3 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 4 + drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c | 8 +- drivers/net/ethernet/xilinx/xilinx_axienet.h | 17 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 25 +-- drivers/net/gtp.c | 3 + drivers/net/wireless/ath/ath12k/dp_tx.c | 72 ++++++++ drivers/net/wireless/ath/ath12k/hw.c | 6 + drivers/net/wireless/ath/ath12k/hw.h | 4 + drivers/net/wireless/ath/ath12k/mac.c | 1 + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +- drivers/nvme/host/core.c | 2 +- drivers/platform/surface/aggregator/controller.c | 3 +- drivers/platform/x86/dell/Kconfig | 1 + drivers/platform/x86/dell/dell-uart-backlight.c | 8 + .../x86/intel/speed_select_if/isst_tpmi_core.c | 3 +- drivers/pmdomain/imx/imx93-pd.c | 5 +- drivers/pmdomain/imx/scu-pd.c | 5 - drivers/s390/block/dasd.c | 36 ++-- drivers/s390/block/dasd_3990_erp.c | 10 +- drivers/s390/block/dasd_eckd.c | 57 +++---- drivers/s390/block/dasd_genhd.c | 1 - drivers/s390/block/dasd_int.h | 2 +- drivers/s390/crypto/ap_bus.c | 7 +- drivers/spi/spi-cadence-quadspi.c | 14 +- .../media/atomisp/pci/ia_css_stream_public.h | 8 +- .../staging/media/atomisp/pci/sh_css_internal.h | 19 ++- drivers/thermal/gov_bang_bang.c | 91 ++++++++--- drivers/thermal/thermal_core.c | 3 +- drivers/thermal/thermal_debugfs.c | 6 +- drivers/thermal/thermal_of.c | 23 ++- drivers/thunderbolt/switch.c | 1 + drivers/tty/serial/8250/8250_omap.c | 33 +--- drivers/tty/serial/atmel_serial.c | 2 +- drivers/tty/serial/fsl_lpuart.c | 1 + drivers/tty/vt/conmakehash.c | 12 +- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/host/xhci.c | 8 +- drivers/usb/misc/usb-ljca.c | 1 + drivers/usb/typec/tcpm/tcpm.c | 1 - fs/9p/vfs_addr.c | 3 +- fs/afs/file.c | 3 +- fs/btrfs/delayed-ref.c | 67 ++++++++ fs/btrfs/delayed-ref.h | 2 + fs/btrfs/extent-tree.c | 51 +++++- fs/btrfs/extent_io.c | 14 +- fs/btrfs/extent_map.c | 22 +-- fs/btrfs/free-space-cache.c | 14 +- fs/btrfs/send.c | 52 ++++-- fs/btrfs/super.c | 18 +- fs/btrfs/tree-checker.c | 74 ++++++++- fs/ceph/addr.c | 25 ++- fs/file.c | 28 ++-- fs/fuse/dev.c | 6 +- fs/inode.c | 39 ++++- fs/libfs.c | 35 ++-- fs/locks.c | 2 +- fs/netfs/buffered_read.c | 8 +- fs/netfs/buffered_write.c | 2 +- fs/netfs/fscache_cookie.c | 4 + fs/netfs/io.c | 161 +++++++++++++++++- fs/nfs/fscache.c | 3 +- fs/smb/client/cifsglob.h | 17 +- fs/smb/client/file.c | 58 +++++-- fs/smb/client/reparse.c | 11 +- fs/smb/client/smb1ops.c | 2 +- fs/smb/client/smb2ops.c | 42 ++++- fs/smb/client/smb2pdu.c | 40 ++++- fs/smb/client/trace.h | 55 ++++++- fs/smb/client/transport.c | 8 +- fs/smb/server/connection.c | 34 +++- fs/smb/server/connection.h | 3 +- fs/smb/server/mgmt/user_session.c | 8 + fs/smb/server/smb2pdu.c | 5 +- include/acpi/acpixf.h | 5 +- include/acpi/video.h | 1 + include/asm-generic/vmlinux.lds.h | 19 --- include/linux/bitmap.h | 12 ++ include/linux/bpf_verifier.h | 4 +- include/linux/dsa/ocelot.h | 47 ++++++ include/linux/fs.h | 5 + include/linux/hugetlb.h | 33 +++- include/linux/io_uring_types.h | 2 +- include/linux/mm.h | 11 ++ include/linux/panic.h | 1 + include/linux/pgalloc_tag.h | 13 ++ include/linux/thermal.h | 1 + include/net/af_vsock.h | 4 + include/net/bluetooth/hci.h | 17 +- include/net/bluetooth/hci_core.h | 2 +- include/net/kcm.h | 1 + include/net/mana/mana.h | 1 + include/scsi/scsi_cmnd.h | 2 +- include/soc/mscc/ocelot.h | 12 +- include/trace/events/netfs.h | 1 + include/uapi/misc/fastrpc.h | 3 - init/Kconfig | 25 +-- io_uring/io_uring.h | 2 +- io_uring/kbuf.c | 9 +- io_uring/napi.c | 50 +++--- io_uring/napi.h | 2 +- kernel/bpf/verifier.c | 5 +- kernel/cgroup/cpuset.c | 5 +- kernel/cpu.c | 12 +- kernel/events/core.c | 3 +- kernel/kallsyms.c | 60 +------ kernel/kallsyms_internal.h | 6 - kernel/kallsyms_selftest.c | 22 +-- kernel/panic.c | 8 +- kernel/printk/printk.c | 2 +- kernel/trace/trace.c | 2 +- kernel/vmcore_info.c | 4 - kernel/workqueue.c | 47 +++--- mm/huge_memory.c | 29 ++-- mm/memcontrol.c | 7 +- mm/memory-failure.c | 20 ++- mm/memory.c | 33 ++-- mm/mm_init.c | 12 +- mm/mseal.c | 14 +- mm/page_alloc.c | 51 +++--- mm/vmalloc.c | 11 +- net/bluetooth/hci_core.c | 19 +-- net/bluetooth/hci_event.c | 2 +- net/bluetooth/mgmt.c | 4 + net/bluetooth/smp.c | 146 ++++++++--------- net/bridge/br_netfilter_hooks.c | 6 +- net/dsa/tag_ocelot.c | 37 +---- net/ipv4/tcp_input.c | 28 ++-- net/ipv4/tcp_ipv4.c | 14 ++ net/ipv4/udp_offload.c | 3 +- net/ipv6/ip6_output.c | 10 ++ net/ipv6/ip6_tunnel.c | 12 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 4 + net/iucv/iucv.c | 4 +- net/kcm/kcmsock.c | 4 + net/mctp/test/route-test.c | 2 +- net/mptcp/diag.c | 2 +- net/mptcp/pm.c | 13 -- net/mptcp/pm_netlink.c | 142 ++++++++++------ net/mptcp/protocol.h | 3 - net/netfilter/nf_flow_table_inet.c | 3 + net/netfilter/nf_flow_table_ip.c | 3 + net/netfilter/nf_flow_table_offload.c | 2 +- net/netfilter/nf_tables_api.c | 163 ++++++++++++------ net/netfilter/nfnetlink.c | 5 +- net/netfilter/nfnetlink_queue.c | 35 +++- net/netfilter/nft_counter.c | 9 +- net/openvswitch/datapath.c | 2 +- net/sched/sch_netem.c | 47 ++++-- net/vmw_vsock/af_vsock.c | 50 +++--- net/vmw_vsock/vsock_bpf.c | 4 +- scripts/kallsyms.c | 109 ++++-------- scripts/link-vmlinux.sh | 106 ++++++------ scripts/rust_is_available.sh | 6 +- security/keys/trusted-keys/trusted_dcp.c | 35 ++-- security/selinux/avc.c | 8 +- security/selinux/hooks.c | 12 +- sound/core/timer.c | 2 +- sound/pci/hda/patch_realtek.c | 1 - sound/pci/hda/tas2781_hda_i2c.c | 14 +- sound/usb/quirks-table.h | 1 + sound/usb/quirks.c | 2 + tools/perf/tests/vmlinux-kallsyms.c | 1 - tools/testing/selftests/bpf/progs/iters.c | 54 ++++++ tools/testing/selftests/core/close_range_test.c | 35 ++++ .../selftests/drivers/net/mlxsw/ethtool_lanes.sh | 3 +- tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/run_vmtests.sh | 3 + tools/testing/selftests/net/af_unix/msg_oob.c | 2 +- tools/testing/selftests/net/lib.sh | 11 +- tools/testing/selftests/net/mptcp/mptcp_join.sh | 28 +++- tools/testing/selftests/net/udpgro.sh | 53 +++--- tools/testing/selftests/tc-testing/tdc.py | 1 - tools/tracing/rtla/src/osnoise_top.c | 11 +- 305 files changed, 3476 insertions(+), 1744 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/273 tty: vt: conmakehash: remove non-portable code printing comment header
6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
commit 7258fdd7d7459616b3fe1a603e33900584b10c13 upstream.
Commit 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env") included <linux/limits.h>, which invoked another (wrong) patch that tried to address a build error on macOS.
According to the specification [1], the correct header to use PATH_MAX is <limits.h>.
The minimal fix would be to replace <linux/limits.h> with <limits.h>.
However, the following commits seem questionable to me:
- 3bd85c6c97b2 ("tty: vt: conmakehash: Don't mention the full path of the input in output")
- 6e20753da6bc ("tty: vt: conmakehash: cope with abs_srctree no longer in env")
These commits made too many efforts to cope with a comment header in drivers/tty/vt/consolemap_deftbl.c:
/*
* Do not edit this file; it was automatically generated by *
* conmakehash drivers/tty/vt/cp437.uni > [this file] *
*/
With this commit, the header part of the generate C file will be simplified as follows:
/*
* Automatically generated file; Do not edit.
*/
BTW, another series of excessive efforts for a comment header can be seen in the following:
- 5ef6dc08cfde ("lib/build_OID_registry: don't mention the full path of the script in output")
- 2fe29fe94563 ("lib/build_OID_registry: avoid non-destructive substitution for Perl < 5.13.2 compat")
[1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
--- drivers/tty/vt/conmakehash.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/tty/vt/conmakehash.c +2 -10
@@ -11,8 +11,6 @@* Copyright (C) 1995-1997 H. Peter Anvin */ -#include <libgen.h> -#include <linux/limits.h> #include <stdio.h> #include <stdlib.h> #include <sysexits.h>
@@ -79,7 +77,6 @@ int main(int argc, char *argv[]) {FILE *ctbl;const char *tblname; -char base_tblname[PATH_MAX ];char buffer[65536 ];int fontlen;int i, nuni, nent;
@@ -245,20 +242,15 @@ int main(int argc, char *argv[])for ( i =0 ; i < fontlen ; i++ ) nuni += unicount[i]; -strncpy (base_tblname, tblname,PATH_MAX ); - base_tblname[PATH_MAX -1 ] =0 ;printf ("\ /*\n\ -* Do not edit this file; it was automatically generated by\n\ -*\n\ -* conmakehash %s > [this file]\n\ -*\n\ +* Automatically generated file; Do not edit.\n\ */\n\ \n\ #include <linux/types.h>\n\ \n\ u8 dfont_unicount[%d] = \n\ -{\n\t" ,basename (base_tblname), fontlen); +{\n\t" , fontlen);for ( i =0 ; i < fontlen ; i++ ) {
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 2/273 tty: serial: fsl_lpuart: mark last busy before uart_add_one_port
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
commit dc98d76a15bc29a9a4e76f2f65f39f3e590fb15c upstream.
With "earlycon initcall_debug=1 loglevel=8" in bootargs, kernel sometimes boot hang. It is because normal console still is not ready, but runtime suspend is called, so early console putchar will hang in waiting TRDE set in UARTSTAT.
The lpuart driver has auto suspend delay set to 3000ms, but during uart_add_one_port, a child device serial ctrl will added and probed with its pm runtime enabled(see serial_ctrl.c).
The runtime suspend call path is:device_add
|-> bus_probe_device
|->device_initial_probe
|->__device_attach
|-> pm_runtime_get_sync(dev->parent);
|-> pm_request_idle(dev);
|-> pm_runtime_put(dev->parent);So in the end, before normal console ready, the lpuart get runtime suspended. And earlycon putchar will hang.
To address the issue, mark last busy just after pm_runtime_enable, three seconds is long enough to switch from bootconsole to normal console.
--- drivers/tty/serial/fsl_lpuart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/fsl_lpuart.c +1 -0
@@ -2923,6 +2923,7 @@ static int lpuart_probe(struct platform_pm_runtime_set_autosuspend_delay (&pdev->dev,UART_AUTOSUSPEND_TIMEOUT );pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev); +pm_runtime_mark_last_busy (&pdev->dev); ret =lpuart_global_reset (sport);if (ret)
Greg Kroah-Hartman
maintainerPATCH 3/273 tty: atmel_serial: use the correct RTS flag.
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Othacehe <[email protected]>
commit c9f6613b16123989f2c3bd04b1d9b2365d6914e7 upstream.
In RS485 mode, the RTS pin is driven high by hardware when the transmitter is operating. This behaviour cannot be changed. This means that the driver should claim that it supports SER_RS485_RTS_ON_SEND and not SER_RS485_RTS_AFTER_SEND.
Otherwise, when configuring the port with the SER_RS485_RTS_ON_SEND, one get the following warning:
kern.warning kernel: atmel_usart_serial atmel_usart_serial.2.auto:
ttyS1 (1): invalid RTS setting, using RTS_AFTER_SEND instead
which is contradictory with what's really happening.
--- drivers/tty/serial/atmel_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/atmel_serial.c +1 -1
@@ -2514,7 +2514,7 @@ static const struct uart_ops atmel_pops };static const struct serial_rs485 atmel_rs485_supported = { - .flags =SER_RS485_ENABLED |SER_RS485_RTS_AFTER_SEND |SER_RS485_RX_DURING_TX , + .flags =SER_RS485_ENABLED |SER_RS485_RTS_ON_SEND |SER_RS485_RX_DURING_TX , .delay_rts_before_send =1 , .delay_rts_after_send =1 , };
Greg Kroah-Hartman
maintainerPATCH 4/273 Revert "ACPI: EC: Evaluate orphan _REG under EC device"
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 779bac9994452f6a894524f70c00cfb0cd4b6364 upstream.
This reverts commit 0e6b6dedf168 ("Revert "ACPI: EC: Evaluate orphan _REG under EC device") because the problem addressed by it will be addressed differently in what follows.
--- drivers/acpi/acpica/acevents.h | 4 --- drivers/acpi/acpica/evregion.c | 6 +++- drivers/acpi/acpica/evxfregn.c | 54 ----------------------------------------- drivers/acpi/ec.c | 3 -- include/acpi/acpixf.h | 4 --- 5 files changed, 5 insertions(+), 66 deletions(-)
drivers/acpi/acpica/acevents.h +0 -4
@@ -191,10 +191,6 @@ void acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, acpi_adr_space_type space_id, u32 function); -void -acpi_ev_execute_orphan_reg_method (struct acpi_namespace_node *node, -acpi_adr_space_type space_id); -acpi_status acpi_ev_execute_reg_method (union acpi_operand_object *region_obj,u32 function);
drivers/acpi/acpica/evregion.c +5 -1
@@ -20,6 +20,10 @@ extern u8 acpi_gbl_default_address_space/* Local prototypes */ +static void +acpi_ev_execute_orphan_reg_method (struct acpi_namespace_node *device_node, +acpi_adr_space_type space_id); +static acpi_status acpi_ev_reg_run (acpi_handle obj_handle,u32 level,void *context,void **return_value);
@@ -814,7 +818,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,* ******************************************************************************/ -void +static void acpi_ev_execute_orphan_reg_method (struct acpi_namespace_node *device_node,acpi_adr_space_type space_id) {
drivers/acpi/acpica/evxfregn.c +0 -54
57 lines not on this page · raw message
drivers/acpi/ec.c +0 -3
@@ -1507,9 +1507,6 @@ static int ec_install_handlers(struct acif (call_reg && !test_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags)) {acpi_execute_reg_methods (scope_handle,ACPI_ADR_SPACE_EC ); -if (scope_handle != ec->handle) -acpi_execute_orphan_reg_method (ec->handle,ACPI_ADR_SPACE_EC ); -set_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags); }
include/acpi/acpixf.h +0 -4
@@ -663,10 +663,6 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_adr_space_type space_id)) ACPI_EXTERNAL_RETURN_STATUS(acpi_status - acpi_execute_orphan_reg_method(acpi_handle device, - acpi_adr_space_type - space_id)) -ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_remove_address_space_handler(acpi_handle device, acpi_adr_space_type
Greg Kroah-Hartman
maintainerPATCH 5/273 Revert "misc: fastrpc: Restrict untrusted app to attach to privileged PD"
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Griffin Kroah-Hartman <[email protected]>
commit 9bb5e74b2bf88fbb024bb15ded3b011e02c673be upstream.
This reverts commit bab2f5e8fd5d2f759db26b78d9db57412888f187.
Joel reported that this commit breaks userspace and stops sensors in SDM845 from working. Also breaks other qcom SoC devices running postmarketOS.
--- drivers/misc/fastrpc.c | 22 +++------------------- include/uapi/misc/fastrpc.h | 3 --- 2 files changed, 3 insertions(+), 22 deletions(-)
drivers/misc/fastrpc.c +3 -19
@@ -2087,16 +2087,6 @@ err_invoke:return err; } -static int is_attach_rejected (struct fastrpc_user *fl) -{ -/* Check if the device node is non-secure */ -if (!fl->is_secure_dev) { -dev_dbg (&fl->cctx->rpdev->dev,"untrusted app trying to attach to privileged DSP PD\n" ); -return -EACCES ; - } -return 0 ; -} -static long fastrpc_device_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {
@@ -2109,19 +2099,13 @@ static long fastrpc_device_ioctl(struct err =fastrpc_invoke (fl, argp);break ;case FASTRPC_IOCTL_INIT_ATTACH : - err =is_attach_rejected (fl); -if (!err) - err =fastrpc_init_attach (fl,ROOT_PD ); + err =fastrpc_init_attach (fl,ROOT_PD );break ;case FASTRPC_IOCTL_INIT_ATTACH_SNS : - err =is_attach_rejected (fl); -if (!err) - err =fastrpc_init_attach (fl,SENSORS_PD ); + err =fastrpc_init_attach (fl,SENSORS_PD );break ;case FASTRPC_IOCTL_INIT_CREATE_STATIC : - err =is_attach_rejected (fl); -if (!err) - err =fastrpc_init_create_static_process (fl, argp); + err =fastrpc_init_create_static_process (fl, argp);break ;case FASTRPC_IOCTL_INIT_CREATE : err =fastrpc_init_create_process (fl, argp);
include/uapi/misc/fastrpc.h +0 -3
@@ -8,14 +8,11 @@#define FASTRPC_IOCTL_ALLOC_DMA_BUFF _IOWR('R', 1, struct fastrpc_alloc_dma_buf)#define FASTRPC_IOCTL_FREE_DMA_BUFF _IOWR('R', 2, __u32)#define FASTRPC_IOCTL_INVOKE _IOWR('R', 3, struct fastrpc_invoke) -/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_ATTACH _IO('R', 4)#define FASTRPC_IOCTL_INIT_CREATE _IOWR('R', 5, struct fastrpc_init_create)#define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap)#define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap) -/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8) -/* This ioctl is only supported with secure device nodes */ #define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init_create_static)#define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map)#define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap)
Greg Kroah-Hartman
maintainerPATCH 6/273 Revert "serial: 8250_omap: Set the console genpd always on if no console suspend"
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Griffin Kroah-Hartman <[email protected]>
commit 0863bffda1131fd2fa9c05b653ad9ee3d8db127e upstream.
This reverts commit 68e6939ea9ec3d6579eadeab16060339cdeaf940.
Kevin reported that this causes a crash during suspend on platforms that dont use PM domains.
--- drivers/tty/serial/8250/8250_omap.c | 33 +++++------------------------ 1 file changed, 5 insertions(+), 28 deletions(-)
drivers/tty/serial/8250/8250_omap.c +5 -28
@@ -27,7 +27,6 @@#include <linux/pm_wakeirq.h> #include <linux/dma-mapping.h> #include <linux/sys_soc.h> -#include <linux/pm_domain.h> #include "8250.h"
@@ -119,12 +118,6 @@#define UART_OMAP_TO_L 0x26#define UART_OMAP_TO_H 0x27 -/* -* Copy of the genpd flags for the console. -* Only used if console suspend is disabled -*/ -static unsigned int genpd_flags_console; -struct omap8250_priv {void __iomem *membase;int line;
@@ -1655,7 +1648,6 @@ static int omap8250_suspend(struct device *dev) {struct omap8250_priv *priv =dev_get_drvdata (dev);struct uart_8250_port *up =serial8250_get_port (priv->line); -struct generic_pm_domain *genpd =pd_to_genpd (dev->pm_domain);int err =0 ;serial8250_suspend_port (priv->line);
@@ -1666,19 +1658,8 @@ static int omap8250_suspend(struct device *dev)if (!device_may_wakeup (dev)) priv->wer =0 ;serial_out (up,UART_OMAP_WER , priv->wer); -if (uart_console (&up->port)) { -if (console_suspend_enabled) - err =pm_runtime_force_suspend (dev); -else { -/* -* The pd shall not be powered-off (no console suspend). -* Make copy of genpd flags before to set it always on. -* The original value is restored during the resume. -*/ - genpd_flags_console = genpd->flags; - genpd->flags |=GENPD_FLAG_ALWAYS_ON ; - } - } +if (uart_console (&up->port) && console_suspend_enabled) + err =pm_runtime_force_suspend (dev);flush_work (&priv->qos_work);return err;
@@ -1688,16 +1669,12 @@ static int omap8250_resume(struct device *dev) {struct omap8250_priv *priv =dev_get_drvdata (dev);struct uart_8250_port *up =serial8250_get_port (priv->line); -struct generic_pm_domain *genpd =pd_to_genpd (dev->pm_domain);int err;if (uart_console (&up->port) && console_suspend_enabled) { -if (console_suspend_enabled) { - err =pm_runtime_force_resume (dev); -if (err) -return err; - }else - genpd->flags = genpd_flags_console; + err =pm_runtime_force_resume (dev); +if (err) +return err; }serial8250_resume_port (priv->line);
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 7/273 Revert "usb: typec: tcpm: clear pd_event queue in PORT_RESET"
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit 21ea1ce37fc267dc45fe27517bbde926211683df upstream.
This reverts commit bf20c69cf3cf9c6445c4925dd9a8a6ca1b78bfdf.
During tcpm_init() stage, if the VBUS is still present after tcpm_reset_port(), then we assume that VBUS will off and goto safe0v after a specific discharge time. Following a TCPM_VBUS_EVENT event if VBUS reach to off state. TCPM_VBUS_EVENT event may be set during PORT_RESET handling stage. If pd_events reset to 0 after TCPM_VBUS_EVENT set, we will lost this VBUS event. Then the port state machine may stuck at one state.
Before:
[ 2.570172] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS] [ 2.570179] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms] [ 2.570182] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS] [ 3.490213] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [delayed 920 ms] [ 3.490220] Start toggling [ 3.546050] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected] [ 3.546057] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS]
After revert this patch, we can see VBUS off event and the port will goto expected state.
[ 2.441992] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev1 NONE_AMS] [ 2.441999] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms] [ 2.442002] pending state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED @ 920 ms [rev1 NONE_AMS] [ 2.442122] VBUS off [ 2.442125] state change PORT_RESET_WAIT_OFF -> SNK_UNATTACHED [rev1 NONE_AMS] [ 2.442127] VBUS VSAFE0V [ 2.442351] CC1: 0 -> 0, CC2: 0 -> 0 [state SNK_UNATTACHED, polarity 0, disconnected] [ 2.442357] Start toggling [ 2.491850] CC1: 0 -> 0, CC2: 0 -> 2 [state TOGGLING, polarity 0, connected] [ 2.491858] state change TOGGLING -> SRC_ATTACH_WAIT [rev1 NONE_AMS] [ 2.491863] pending state change SRC_ATTACH_WAIT -> SNK_TRY @ 200 ms [rev1 NONE_AMS] [ 2.691905] state change SRC_ATTACH_WAIT -> SNK_TRY [delayed 200 ms]
--- drivers/usb/typec/tcpm/tcpm.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +0 -1
@@ -5630,7 +5630,6 @@ static void run_state_machine(struct tcpbreak ;case PORT_RESET :tcpm_reset_port (port); - port->pd_events =0 ;if (port->self_powered)tcpm_set_cc (port,TYPEC_CC_OPEN );else
Greg Kroah-Hartman
maintainerPATCH 8/273 selinux: revert our use of vma_is_initial_heap()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 05a3d6e9307250a5911d75308e4363466794ab21 upstream.
Unfortunately it appears that vma_is_initial_heap() is currently broken for applications that do not currently have any heap allocated, e.g. brk == start_brk. The breakage is such that it will cause SELinux to check for the process/execheap permission on memory regions that cross brk/start_brk even when there is no heap.
The proper fix would be to correct vma_is_initial_heap(), but as there are multiple callers I am hesitant to unilaterally modify the helper out of concern that I would end up breaking some other subsystem. The mm developers have been made aware of the situation and hopefully they will have a fix at some point in the future, but we need a fix soon so we are simply going to revert our use of vma_is_initial_heap() in favor of our old logic/code which works as expected, even in the face of a zero size heap. We can return to using vma_is_initial_heap() at some point in the future when it is fixed.
--- security/selinux/hooks.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
security/selinux/hooks.c +11 -1
@@ -3852,7 +3852,17 @@ static int selinux_file_mprotect(structif (default_noexec && (prot &PROT_EXEC ) && !(vma->vm_flags &VM_EXEC )) {int rc =0 ; -if (vma_is_initial_heap (vma)) { +/* +* We don't use the vma_is_initial_heap() helper as it has +* a history of problems and is currently broken on systems +* where there is no heap, e.g. brk == start_brk. Before +* replacing the conditional below with vma_is_initial_heap(), +* or something similar, please ensure that the logic is the +* same as what we have below or you have tested every possible +* corner case you can think to test. +*/ +if (vma->vm_start >= vma->vm_mm->start_brk && + vma->vm_end <= vma->vm_mm->brk) { rc =avc_has_perm (sid, sid,SECCLASS_PROCESS ,PROCESS__EXECHEAP ,NULL ); } else if (!vma->vm_file && (vma_is_initial_stack(vma) ||
Greg Kroah-Hartman
maintainerPATCH 9/273 netfs, ceph: Revert "netfs: Remove deprecated use of PG_private_2 as a second writeback flag"
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 8e5ced7804cb9184c4a23f8054551240562a8eda upstream.
This reverts commit ae678317b95e760607c7b20b97c9cd4ca9ed6e1a.
Revert the patch that removes the deprecated use of PG_private_2 in netfslib for the moment as Ceph is actually still using this to track data copied to the cache.
https: //lore.kernel.org/r/[email protected]
--- fs/ceph/addr.c | 19 +++++ fs/netfs/buffered_read.c | 8 ++ fs/netfs/io.c | 144 +++++++++++++++++++++++++++++++++++++++++++ include/trace/events/netfs.h | 1 4 files changed, 170 insertions(+), 2 deletions(-)
fs/ceph/addr.c +18 -1
@@ -498,6 +498,11 @@ const struct netfs_request_ops ceph_netf };#ifdef CONFIG_CEPH_FSCACHE +static void ceph_set_page_fscache (struct page *page) +{ +folio_start_private_2 (page_folio (page));/* [DEPRECATED] */ +} +static void ceph_fscache_write_terminated (void *priv,ssize_t error,bool was_async) {struct inode *inode = priv;
@@ -515,6 +520,10 @@ static void ceph_fscache_write_to_cache( ceph_fscache_write_terminated, inode, true, caching); }#else +static inline void ceph_set_page_fscache (struct page *page) +{ +} +static inline void ceph_fscache_write_to_cache (struct inode *inode,u64 off,u64 len,bool caching) { }
@@ -706,6 +715,8 @@ static int writepage_nounlock(struct pag len = wlen;set_page_writeback (page); +if (caching) +ceph_set_page_fscache (page);ceph_fscache_write_to_cache (inode, page_off, len, caching);if (IS_ENCRYPTED (inode)) {
@@ -789,6 +800,8 @@ static int ceph_writepage(struct page *preturn AOP_WRITEPAGE_ACTIVATE ; } +folio_wait_private_2 (page_folio (page));/* [DEPRECATED] */ + err =writepage_nounlock (page, wbc);if (err == -ERESTARTSYS ) {/* direct memory reclaimer was killed by SIGKILL. return 0
@@ -1062,7 +1075,8 @@ get_more_pages:unlock_page (page);break ; } -if (PageWriteback (page)) { +if (PageWriteback (page) || +PagePrivate2 (page)/* [DEPRECATED] */ ) {if (wbc->sync_mode ==WB_SYNC_NONE ) {doutc (cl,"%p under writeback\n" , page);unlock_page (page);
@@ -1070,6 +1084,7 @@ get_more_pages: }doutc (cl,"waiting on writeback %p\n" , page);wait_on_page_writeback (page); +folio_wait_private_2 (page_folio (page));/* [DEPRECATED] */ }if (!clear_page_dirty_for_io (page)) {
@@ -1254,6 +1269,8 @@ new_request: }set_page_writeback (page); +if (caching) +ceph_set_page_fscache (page); len +=thp_size (page); }ceph_fscache_write_to_cache (inode, offset, len, caching);
fs/netfs/buffered_read.c +7 -1
@@ -466,7 +466,7 @@ retry:if (!netfs_is_cache_enabled (ctx) &&netfs_skip_folio_read (folio, pos, len, false)) {netfs_stat (&netfs_n_rh_write_zskip); - goto have_folio; + goto have_folio_no_wait; } rreq = netfs_alloc_request(mapping, file,
@@ -507,6 +507,12 @@ retry:netfs_put_request (rreq, false, netfs_rreq_trace_put_return); have_folio: +if (test_bit (NETFS_ICTX_USE_PGPRIV2 , &ctx->flags)) { + ret =folio_wait_private_2_killable (folio); +if (ret <0 ) + goto error; + } +have_folio_no_wait: *_folio = folio;kleave (" = 0" );return 0 ;
fs/netfs/io.c +144 -0
156 lines not on this page · raw message
include/trace/events/netfs.h +1 -0
@@ -145,6 +145,7 @@ EM(netfs_folio_trace_clear_g, "clear-g") \ EM(netfs_folio_trace_clear_s, "clear-s") \ EM(netfs_folio_trace_copy_to_cache, "mark-copy") \ + EM(netfs_folio_trace_end_copy, "end-copy") \ EM(netfs_folio_trace_filled_gaps, "filled-gaps") \ EM(netfs_folio_trace_kill, "kill") \EM (netfs_folio_trace_kill_cc,"kill-cc" ) \
Greg Kroah-Hartman
maintainerPATCH 10/273 fuse: Initialize beyond-EOF page contents before setting uptodate
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 3c0da3d163eb32f1f91891efaade027fa9b245b9 upstream.
fuse_notify_store(), unlike fuse_do_readpage(), does not enable page zeroing (because it can be used to change partial page contents).
So fuse_notify_store() must be more careful to fully initialize page contents (including parts of the page that are beyond end-of-file) before marking the page uptodate.
The current code can leave beyond-EOF page contents uninitialized, which makes these uninitialized page contents visible to userspace via mmap().
This is an information leak, but only affects systems which do not enable init-on-alloc (via CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y or the corresponding kernel command line parameter).
--- fs/fuse/dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/fuse/dev.c +4 -2
@@ -1618,9 +1618,11 @@ static int fuse_notify_store(struct fuse this_num =min_t (unsigned, num,PAGE_SIZE - offset); err =fuse_copy_page (cs, &page, offset, this_num,0 ); -if (!err && offset ==0 && - (this_num ==PAGE_SIZE || file_size == end)) +if (!PageUptodate (page) && !err && offset ==0 && + (this_num ==PAGE_SIZE || file_size == end)) { +zero_user_segment (page, this_num,PAGE_SIZE );SetPageUptodate (page); + }unlock_page (page);put_page (page);
Greg Kroah-Hartman
maintainerPATCH 11/273 char: xillybus: Dont destroy workqueue from work item running on it
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eli Billauer <[email protected]>
commit ccbde4b128ef9c73d14d0d7817d68ef795f6d131 upstream.
Triggered by a kref decrement, destroy_workqueue() may be called from within a work item for destroying its own workqueue. This illegal situation is averted by adding a module-global workqueue for exclusive use of the offending work item. Other work items continue to be queued on per-device workqueues to ensure performance.
--- drivers/char/xillybus/xillyusb.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/char/xillybus/xillyusb.c +11 -5
@@ -50,6 +50,7 @@ MODULE_LICENSE("GPL v2");static const char xillyname[] ="xillyusb" ;static unsigned int fifo_buf_order; +static struct workqueue_struct *wakeup_wq;#define USB_VENDOR_ID_XILINX 0x03fd#define USB_VENDOR_ID_ALTERA 0x09fb
@@ -569,10 +570,6 @@ static void cleanup_dev(struct kref *kre* errors if executed. The mechanism relies on that xdev->error is assigned * a non-zero value by report_io_error() prior to queueing wakeup_all(), * which prevents bulk_in_work() from calling process_bulk_in(). -* -* The fact that wakeup_all() and bulk_in_work() are queued on the same -* workqueue makes their concurrent execution very unlikely, however the -* kernel's API doesn't seem to ensure this strictly. */ static void wakeup_all (struct work_struct *work)
@@ -627,7 +624,7 @@ static void report_io_error(struct xillyif (do_once) {kref_get (&xdev->kref);/* xdev is used by work item */ -queue_work (xdev->workq, &xdev->wakeup_workitem); +queue_work (wakeup_wq, &xdev->wakeup_workitem); } }
@@ -2258,6 +2255,10 @@ static int __init xillyusb_init(void) {int rc =0 ; + wakeup_wq =alloc_workqueue (xillyname,0 ,0 ); +if (!wakeup_wq) +return -ENOMEM ; +if (LOG2_INITIAL_FIFO_BUF_SIZE >PAGE_SHIFT ) fifo_buf_order =LOG2_INITIAL_FIFO_BUF_SIZE -PAGE_SHIFT ;else
@@ -2265,11 +2266,16 @@ static int __init xillyusb_init(void) rc =usb_register (&xillyusb_driver); +if (rc) +destroy_workqueue (wakeup_wq); +return rc; } static void __exit xillyusb_exit(void) { +destroy_workqueue (wakeup_wq); +usb_deregister (&xillyusb_driver); }
Greg Kroah-Hartman
maintainerPATCH 12/273 char: xillybus: Refine workqueue handling
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eli Billauer <[email protected]>
commit ad899c301c880766cc709aad277991b3ab671b66 upstream.
As the wakeup work item now runs on a separate workqueue, it needs to be flushed separately along with flushing the device's workqueue.
Also, move the destroy_workqueue() call to the end of the exit method, so that deinitialization is done in the opposite order of initialization.
--- drivers/char/xillybus/xillyusb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/char/xillybus/xillyusb.c +5 -3
@@ -2093,9 +2093,11 @@ static int xillyusb_discovery(struct usb* just after responding with the IDT, there is no reason for any * work item to be running now. To be sure that xdev->channels * is updated on anything that might run in parallel, flush the -* workqueue, which rarely does anything. +* device's workqueue and the wakeup work item. This rarely +* does anything. */ flush_workqueue (xdev->workq); +flush_work (&xdev->wakeup_workitem); xdev->num_channels = num_channels;
@@ -2274,9 +2276,9 @@ static int __init xillyusb_init(void) static void __exit xillyusb_exit(void) { -destroy_workqueue (wakeup_wq); -usb_deregister (&xillyusb_driver); + +destroy_workqueue (wakeup_wq); }module_init (xillyusb_init);
Greg Kroah-Hartman
maintainerPATCH 13/273 char: xillybus: Check USB endpoints when probing device
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eli Billauer <[email protected]>
commit 2374bf7558de915edc6ec8cb10ec3291dfab9594 upstream.
Ensure, as the driver probes the device, that all endpoints that the driver may attempt to access exist and are of the correct type.
All XillyUSB devices must have a Bulk IN and Bulk OUT endpoint at address 1. This is verified in xillyusb_setup_base_eps().
On top of that, a XillyUSB device may have additional Bulk OUT endpoints. The information about these endpoints' addresses is deduced from a data structure (the IDT) that the driver fetches from the device while probing it. These endpoints are checked in setup_channels().
A XillyUSB device never has more than one IN endpoint, as all data towards the host is multiplexed in this single Bulk IN endpoint. This is why setup_channels() only checks OUT endpoints.
--- drivers/char/xillybus/xillyusb.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/char/xillybus/xillyusb.c +20 -2
@@ -1903,6 +1903,13 @@ static const struct file_operations xillstatic int xillyusb_setup_base_eps (struct xillyusb_dev *xdev) { +struct usb_device *udev = xdev->udev; + +/* Verify that device has the two fundamental bulk in/out endpoints */ +if (usb_pipe_type_check (udev,usb_sndbulkpipe (udev,MSG_EP_NUM )) || +usb_pipe_type_check (udev,usb_rcvbulkpipe (udev,IN_EP_NUM ))) +return -ENODEV ; + xdev->msg_ep =endpoint_alloc (xdev,MSG_EP_NUM |USB_DIR_OUT , bulk_out_work,1 ,2 );if (!xdev->msg_ep)
@@ -1932,14 +1939,15 @@ static int setup_channels(struct xillyus __le16 *chandesc, int num_channels) { -struct xillyusb_channel *chan; +struct usb_device *udev = xdev->udev; +struct xillyusb_channel *chan, *new_channels;int i; chan =kcalloc (num_channels,sizeof (*chan),GFP_KERNEL );if (!chan)return -ENOMEM ; - xdev->channels = chan; + new_channels = chan;for (i =0 ; i < num_channels; i++, chan++) {unsigned int in_desc =le16_to_cpu (*chandesc++);
@@ -1968,6 +1976,15 @@ static int setup_channels(struct xillyus*/ if ((out_desc &0x80 ) && i <14 ) {/* Entry is valid */ +if (usb_pipe_type_check (udev, +usb_sndbulkpipe (udev, i +2 ))) { +dev_err (xdev->dev, +"Missing BULK OUT endpoint %d\n" , + i +2 ); +kfree (new_channels); +return -ENODEV ; + } + chan->writable =1 ; chan->out_synchronous = !!(out_desc &0x40 ); chan->out_seekable = !!(out_desc &0x20 );
@@ -1977,6 +1994,7 @@ static int setup_channels(struct xillyus } } + xdev->channels = new_channels;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 14/273 ALSA: usb-audio: Add delay quirk for VIVO USB-C-XE710 HEADSET
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lianqin Hu <[email protected]>
commit 004eb8ba776ccd3e296ea6f78f7ae7985b12824e upstream.
Audio control requests that sets sampling frequency sometimes fail on this card. Adding delay between control messages eliminates that problem.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2221,6 +2221,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x2b53 ,0x0031 ,/* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x2d95 ,0x8021 ,/* VIVO USB-C-XE710 HEADSET */ +QUIRK_FLAG_CTL_MSG_DELAY_1M ),DEVICE_FLG (0x30be ,0x0101 ,/* Schiit Hel */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
Greg Kroah-Hartman
maintainerPATCH 15/273 ALSA: usb-audio: Support Yamaha P-125 quirk entry
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juan José Arboleda <[email protected]>
commit c286f204ce6ba7b48e3dcba53eda7df8eaa64dd9 upstream.
This patch adds a USB quirk for the Yamaha P-125 digital piano.
--- sound/usb/quirks-table.h | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks-table.h +1 -0
@@ -273,6 +273,7 @@ YAMAHA_DEVICE(0x105a, NULL), YAMAHA_DEVICE(0x105b, NULL), YAMAHA_DEVICE(0x105c, NULL), YAMAHA_DEVICE(0x105d, NULL), +YAMAHA_DEVICE(0x1718, "P-125"), { USB_DEVICE(0x0499, 0x1503), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
Greg Kroah-Hartman
maintainerPATCH 16/273 usb: misc: ljca: Add Lunar Lake ljca GPIO HID to ljca_gpio_hids[]
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 3ed486e383ccee9b0c8d727608f12a937c6603ca upstream.
Add LJCA GPIO support for the Lunar Lake platform.
New HID taken from out of tree ivsc-driver git repo.
--- drivers/usb/misc/usb-ljca.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/usb-ljca.c +1 -0
@@ -169,6 +169,7 @@ static const struct acpi_device_id ljca_ { "INTC1096" }, { "INTC100B" }, { "INTC10D1" }, + { "INTC10B5" }, {}, };
Greg Kroah-Hartman
maintainerPATCH 17/273 usb: xhci: Check for xhci->interrupters being allocated in xhci_mem_clearup()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit dcdb52d948f3a17ccd3fce757d9bd981d7c32039 upstream.
If xhci_mem_init() fails, it calls into xhci_mem_cleanup() to mop up the damage. If it fails early enough, before xhci->interrupters is allocated but after xhci->max_interrupters has been set, which happens in most (all?) cases, things get uglier, as xhci_mem_cleanup() unconditionally derefences xhci->interrupters. With prejudice.
Gate the interrupt freeing loop with a check on xhci->interrupters being non-NULL.
Found while debugging a DMA allocation issue that led the XHCI driver on this exact path.
--- drivers/usb/host/xhci-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
@@ -1877,7 +1877,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xcancel_delayed_work_sync (&xhci->cmd_timer); -for (i =0 ; i < xhci->max_interrupters; i++) { +for (i =0 ; xhci->interrupters && i < xhci->max_interrupters; i++) {if (xhci->interrupters[i]) {xhci_remove_interrupter (xhci, xhci->interrupters[i]);xhci_free_interrupter (xhci, xhci->interrupters[i]);
Greg Kroah-Hartman
maintainerPATCH 18/273 xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit af8e119f52e9c13e556be9e03f27957554a84656 upstream.
re-enumerating full-speed devices after a failed address device command can trigger a NULL pointer dereference.
Full-speed devices may need to reconfigure the endpoint 0 Max Packet Size value during enumeration. Usb core calls usb_ep0_reinit() in this case, which ends up calling xhci_configure_endpoint().
On Panther point xHC the xhci_configure_endpoint() function will additionally check and reserve bandwidth in software. Other hosts do this in hardware
If xHC address device command fails then a new xhci_virt_device structure is allocated as part of re-enabling the slot, but the bandwidth table pointers are not set up properly here.
This triggers the NULL pointer dereference the next time usb_ep0_reinit() is called and xhci_configure_endpoint() tries to check and reserve bandwidth
[46710.713538] usb 3-1: new full-speed USB device number 5 using xhci_hcd [46710.713699] usb 3-1: Device not responding to setup address. [46710.917684] usb 3-1: Device not responding to setup address. [46711.125536] usb 3-1: device not accepting address 5, error -71 [46711.125594] BUG: kernel NULL pointer dereference, address: 0000000000000008 [46711.125600] #PF: supervisor read access in kernel mode [46711.125603] #PF: error_code(0x0000) - not-present page [46711.125606] PGD 0 P4D 0 [46711.125610] Oops: Oops: 0000 [#1] PREEMPT SMP PTI [46711.125615] CPU: 1 PID: 25760 Comm: kworker/1:2 Not tainted 6.10.3_2 #1 [46711.125620] Hardware name: Gigabyte Technology Co., Ltd. [46711.125623] Workqueue: usb_hub_wq hub_event [usbcore] [46711.125668] RIP: 0010:xhci_reserve_bandwidth (drivers/usb/host/xhci.c
Fix this by making sure bandwidth table pointers are set up correctly after a failed address device command, and additionally by avoiding checking for bandwidth in cases like this where no actual endpoints are added or removed, i.e. only context for default control endpoint 0 is evaluated.
--- drivers/usb/host/xhci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.c +5 -3
@@ -2837,7 +2837,7 @@ static int xhci_configure_endpoint(struc xhci->num_active_eps);return -ENOMEM ; } -if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && +if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && !ctx_change &&xhci_reserve_bandwidth (xhci, virt_dev, command->in_ctx)) {if ((xhci->quirks &XHCI_EP_LIMIT_QUIRK ))xhci_free_host_resources (xhci, ctrl_ctx);
@@ -4200,8 +4200,10 @@ static int xhci_setup_device(struct usb_mutex_unlock (&xhci->mutex); ret =xhci_disable_slot (xhci, udev->slot_id);xhci_free_virt_device (xhci, udev->slot_id); -if (!ret) -xhci_alloc_dev (hcd, udev); +if (!ret) { +if (xhci_alloc_dev (hcd, udev) ==1 ) +xhci_setup_addressable_virt_dev (xhci, udev); + }kfree (command->completion);kfree (command);return -EPROTO ;
Greg Kroah-Hartman
maintainerPATCH 19/273 thunderbolt: Mark XDomain as unplugged when router is removed
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit e2006140ad2e01a02ed0aff49cc2ae3ceeb11f8d upstream.
I noticed that when we do discrete host router NVM upgrade and it gets hot-removed from the PCIe side as a result of NVM firmware authentication, if there is another host connected with enabled paths we hang in tearing them down. This is due to fact that the Thunderbolt networking driver also tries to cleanup the paths and ends up blocking in tb_disconnect_xdomain_paths() waiting for the domain lock.
However, at this point we already cleaned the paths in tb_stop() so there is really no need for tb_disconnect_xdomain_paths() to do that anymore. Furthermore it already checks if the XDomain is unplugged and bails out early so take advantage of that and mark the XDomain as unplugged when we remove the parent router.
--- drivers/thunderbolt/switch.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/switch.c +1 -0
@@ -3392,6 +3392,7 @@ void tb_switch_remove(struct tb_switch *tb_switch_remove (port->remote->sw); port->remote =NULL ; }else if (port->xdomain) { + port->xdomain->is_unplugged = true;tb_xdomain_remove (port->xdomain); port->xdomain =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 20/273 ALSA: hda/tas2781: fix wrong calibrated data order
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baojun Xu <[email protected]>
commit 3beddef84d90590270465a907de1cfe2539ac70d upstream.
Wrong calibration data order cause sound too low in some device. Fix wrong calibrated data order, add calibration data converssion by get_unaligned_be32() after reading from UEFI.
--- sound/pci/hda/tas2781_hda_i2c.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
sound/pci/hda/tas2781_hda_i2c.c +9 -5
@@ -2,10 +2,12 @@// // TAS2781 HDA I2C driver // -// Copyright 2023 Texas Instruments, Inc. +// Copyright 2023 - 2024 Texas Instruments, Inc. // // Author: Shenghao Ding <[email protected]> +// Current maintainer: Baojun Xu <[email protected]> +#include <asm/unaligned.h> #include <linux/acpi.h> #include <linux/crc8.h> #include <linux/crc32.h>
@@ -519,20 +521,22 @@ static void tas2781_apply_calib(struct tstatic const unsigned char rgno_array[CALIB_MAX ] = {0x74 ,0x0c ,0x14 ,0x70 ,0x7c , }; -unsigned char *data; +int offset =0 ;int i, j, rc; +__be32 data;for (i =0 ; i < tas_priv->ndev; i++) { - data = tas_priv->cali_data.data + - i *TASDEVICE_SPEAKER_CALIBRATION_SIZE ;for (j =0 ; j <CALIB_MAX ; j++) { + data =get_unaligned_be32 ( + &tas_priv->cali_data.data[offset]); rc =tasdevice_dev_bulk_write (tas_priv, i,TASDEVICE_REG (0 , page_array[j], rgno_array[j]), - &(data[4 * j]),4 ); + (unsigned char *)&data,4 );if (rc <0 )dev_err (tas_priv->dev,"chn %d calib %d bulk_wr err = %d\n" , i, j, rc); + offset +=4 ; } } }
Greg Kroah-Hartman
maintainerPATCH 21/273 ALSA: timer: Relax start tick time check for slave timer elements
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ccbfcac05866ebe6eb3bc6d07b51d4ed4fcde436 upstream.
The recent addition of a sanity check for a too low start tick time seems breaking some applications that uses aloop with a certain slave timer setup. They may have the initial resolution 0, hence it's treated as if it were a too low value.
Relax and skip the check for the slave timer instance for addressing the regression.
--- sound/core/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/timer.c +1 -1
@@ -547,7 +547,7 @@ static int snd_timer_start1(struct snd_t/* check the actual time for the start tick; * bail out as error if it's way too low (< 100us) */ -if (start) { +if (start && !(timer->hw.flags &SNDRV_TIMER_HW_SLAVE )) {if ((u64 )snd_timer_hw_resolution (timer) * ticks <100000 )return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 22/273 s390/dasd: fix error recovery leading to data corruption on ESE devices
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 7db4042336580dfd75cb5faa82c12cd51098c90b upstream.
Extent Space Efficient (ESE) or thin provisioned volumes need to be formatted on demand during usual IO processing.
The dasd_ese_needs_format function checks for error codes that signal the non existence of a proper track format.
The check for incorrect length is to imprecise since other error cases leading to transport of insufficient data also have this flag set. This might lead to data corruption in certain error cases for example during a storage server warmstart.
Fix by removing the check for incorrect length and replacing by explicitly checking for invalid track format in transport mode.
Also remove the check for file protected since this is not a valid ESE handling case.
--- drivers/s390/block/dasd.c | 36 +++++++++++++++--------- drivers/s390/block/dasd_3990_erp.c | 10 +----- drivers/s390/block/dasd_eckd.c | 55 ++++++++++++++++--------------------- drivers/s390/block/dasd_int.h | 2 - 4 files changed, 50 insertions(+), 53 deletions(-)
drivers/s390/block/dasd.c +23 -13
@@ -1601,9 +1601,15 @@ static int dasd_ese_needs_format(structif (!sense)return 0 ; -return !!(sense[1 ] &SNS1_NO_REC_FOUND ) || - !!(sense[1 ] &SNS1_FILE_PROTECTED ) || -scsw_cstat (&irb->scsw) ==SCHN_STAT_INCORR_LEN ; +if (sense[1 ] &SNS1_NO_REC_FOUND ) +return 1 ; + +if ((sense[1 ] &SNS1_INV_TRACK_FORMAT ) && +scsw_is_tm (&irb->scsw) && + !(sense[2 ] &SNS2_ENV_DATA_PRESENT )) +return 1 ; + +return 0 ; }static int dasd_ese_oos_cond (u8 *sense)
@@ -1624,7 +1630,7 @@ void dasd_int_handler(struct ccw_devicestruct dasd_device *device;unsigned long now;int nrf_suppressed =0 ; -int fp_suppressed =0 ; +int it_suppressed =0 ;struct request *req;u8 *sense =NULL ;int expires;
@@ -1679,8 +1685,9 @@ void dasd_int_handler(struct ccw_device*/ sense =dasd_get_sense (irb);if (sense) { - fp_suppressed = (sense[1 ] &SNS1_FILE_PROTECTED ) && -test_bit (DASD_CQR_SUPPRESS_FP , &cqr->flags); + it_suppressed = (sense[1 ] &SNS1_INV_TRACK_FORMAT ) && + !(sense[2 ] &SNS2_ENV_DATA_PRESENT ) && +test_bit (DASD_CQR_SUPPRESS_IT , &cqr->flags); nrf_suppressed = (sense[1 ] &SNS1_NO_REC_FOUND ) &&test_bit (DASD_CQR_SUPPRESS_NRF , &cqr->flags);
@@ -1695,7 +1702,7 @@ void dasd_int_handler(struct ccw_devicereturn ; } } -if (!(fp_suppressed || nrf_suppressed)) +if (!(it_suppressed || nrf_suppressed)) device->discipline->dump_sense_dbf (device, irb,"int" );if (device->features &DASD_FEATURE_ERPLOG )
@@ -2459,14 +2466,17 @@ retry: rc =0 ;list_for_each_entry_safe (cqr, n, ccw_queue, blocklist) {/* -* In some cases the 'File Protected' or 'Incorrect Length' -* error might be expected and error recovery would be -* unnecessary in these cases. Check if the according suppress -* bit is set. +* In some cases certain errors might be expected and +* error recovery would be unnecessary in these cases. +* Check if the according suppress bit is set. */ sense =dasd_get_sense (&cqr->irb); -if (sense && sense[1 ] &SNS1_FILE_PROTECTED && -test_bit (DASD_CQR_SUPPRESS_FP , &cqr->flags)) +if (sense && (sense[1 ] &SNS1_INV_TRACK_FORMAT ) && + !(sense[2 ] &SNS2_ENV_DATA_PRESENT ) && +test_bit (DASD_CQR_SUPPRESS_IT , &cqr->flags)) +continue ; +if (sense && (sense[1 ] &SNS1_NO_REC_FOUND ) && +test_bit (DASD_CQR_SUPPRESS_NRF , &cqr->flags))continue ;if (scsw_cstat (&cqr->irb.scsw) ==0x40 &&test_bit (DASD_CQR_SUPPRESS_IL , &cqr->flags))
drivers/s390/block/dasd_3990_erp.c +2 -8
@@ -1386,14 +1386,8 @@ dasd_3990_erp_file_prot(struct dasd_ccw_struct dasd_device *device = erp->startdev; -/* -* In some cases the 'File Protected' error might be expected and -* log messages shouldn't be written then. -* Check if the according suppress bit is set. -*/ -if (!test_bit (DASD_CQR_SUPPRESS_FP , &erp->flags)) -dev_err (&device->cdev->dev, -"Accessing the DASD failed because of a hardware error\n" ); +dev_err (&device->cdev->dev, +"Accessing the DASD failed because of a hardware error\n" );return dasd_3990_erp_cleanup (erp,DASD_CQR_FAILED );
drivers/s390/block/dasd_eckd.c +24 -31
90 lines not on this page · raw message
drivers/s390/block/dasd_int.h +1 -1
@@ -196,7 +196,7 @@ struct dasd_ccw_req {* The following flags are used to suppress output of certain errors. */ #define DASD_CQR_SUPPRESS_NRF 4/* Suppress 'No Record Found' error */ -#define DASD_CQR_SUPPRESS_FP 5/* Suppress 'File Protected' error*/ +#define DASD_CQR_SUPPRESS_IT 5/* Suppress 'Invalid Track' error*/ #define DASD_CQR_SUPPRESS_IL 6/* Suppress 'Incorrect Length' error */ #define DASD_CQR_SUPPRESS_CR 7/* Suppress 'Command Reject' error */
Greg Kroah-Hartman
maintainerPATCH 23/273 KVM: s390: fix validity interception issue when gisa is switched off
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Mueller <[email protected]>
commit 5a44bb061d04b0306f2aa8add761d86d152b9377 upstream.
We might run into a SIE validity if gisa has been disabled either via using kernel parameter "kvm.use_gisa=0" or by setting the related sysfs attribute to N (echo N >/sys/module/kvm/parameters/use_gisa).
The validity is caused by an invalid value in the SIE control block's gisa designation. That happens because we pass the uninitialized gisa origin to virt_to_phys() before writing it to the gisa designation.
To fix this we return 0 in kvm_s390_get_gisa_desc() if the origin is 0. kvm_s390_get_gisa_desc() is used to determine which gisa designation to set in the SIE control block. A value of 0 in the gisa designation disables gisa usage.
The issue surfaces in the host kernel with the following kernel message as soon a new kvm guest start is attemted.
kvm: unhandled validity intercept 0x1011
WARNING: CPU: 0 PID: 781237 at arch/s390/kvm/intercept.c:101 kvm_handle_sie_intercept+0x42e/0x4d0 [kvm]
Modules linked in: vhost_net tap tun xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT xt_tcpudp nft_compat x_tables nf_nat_tftp nf_conntrack_tftp vfio_pci_core irqbypass vhost_vsock vmw_vsock_virtio_transport_common vsock vhost vhost_iotlb kvm nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables sunrpc mlx5_ib ib_uverbs ib_core mlx5_core uvdevice s390_trng eadm_sch vfio_ccw zcrypt_cex4 mdev vfio_iommu_type1 vfio sch_fq_codel drm i2c_core loop drm_panel_orientation_quirks configfs nfnetlink lcs ctcm fsm dm_service_time ghash_s390 prng chacha_s390 libchacha aes_s390 des_s390 libdes sha3_512_s390 sha3_256_s390 sha512_s390 sha256_s390 sha1_s390 sha_common dm_mirror dm_region_hash dm_log zfcp scsi_transport_fc scsi_dh_rdac scsi_dh_emc scsi_dh_alua pkey zcrypt dm_multipath rng_core autofs4 [last unloaded: vfio_pci]
CPU: 0 PID: 781237 Comm: CPU 0/KVM Not tainted 6.10.0-08682-gcad9f11498ea #6
Hardware name: IBM 3931 A01 701 (LPAR)
Krnl PSW : 0704c00180000000 000003d93deb0122 (kvm_handle_sie_intercept+0x432/0x4d0 [kvm])
R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
Krnl GPRS: 000003d900000027 000003d900000023 0000000000000028 000002cd00000000
000002d063a00900 00000359c6daf708 00000000000bebb5 0000000000001eff
000002cfd82e9000 000002cfd80bc000 0000000000001011 000003d93deda412
000003ff8962df98 000003d93de77ce0 000003d93deb011e 00000359c6daf960
Krnl Code: 000003d93deb0112: c020fffe7259 larl %r2,000003d93de7e5c4
000003d93deb0118: c0e53fa8beac brasl %r14,000003d9bd3c7e70
#000003d93deb011e: af000000 mc 0,0
>000003d93deb0122: a728ffea lhi %r2,-22
000003d93deb0126: a7f4fe24 brc 15,000003d93deafd6e
000003d93deb012a: 9101f0b0 tm 176(%r15),1
000003d93deb012e: a774fe48 brc 7,000003d93deafdbe
000003d93deb0132: 40a0f0ae sth %r10,174(%r15)
Call Trace:
[<000003d93deb0122>] kvm_handle_sie_intercept+0x432/0x4d0 [kvm]
([<000003d93deb011e>] kvm_handle_sie_intercept+0x42e/0x4d0 [kvm])
[<000003d93deacc10>] vcpu_post_run+0x1d0/0x3b0 [kvm]
[<000003d93deaceda>] __vcpu_run+0xea/0x2d0 [kvm]
[<000003d93dead9da>] kvm_arch_vcpu_ioctl_run+0x16a/0x430 [kvm]
[<000003d93de93ee0>] kvm_vcpu_ioctl+0x190/0x7c0 [kvm]
[<000003d9bd728b4e>] vfs_ioctl+0x2e/0x70
[<000003d9bd72a092>] __s390x_sys_ioctl+0xc2/0xd0
[<000003d9be0e9222>] __do_syscall+0x1f2/0x2e0
[<000003d9be0f9a90>] system_call+0x70/0x98Last Breaking-Event-Address:
[<000003d9bd3c7f58>] __warn_printk+0xe8/0xf0
Message-ID: <[email protected]>
--- arch/s390/kvm/kvm-s390.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.h +6 -1
@@ -267,7 +267,12 @@ static inline unsigned long kvm_s390_getstatic inline u32 kvm_s390_get_gisa_desc (struct kvm *kvm) { -u32 gd =virt_to_phys (kvm->arch.gisa_int.origin); +u32 gd; + +if (!kvm->arch.gisa_int.origin) +return 0 ; + + gd =virt_to_phys (kvm->arch.gisa_int.origin);if (gd && sclp.has_gisaf) gd |=GISA_FORMAT1 ;
Greg Kroah-Hartman
maintainerPATCH 24/273 thermal: gov_bang_bang: Call __thermal_cdev_update() directly
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit b9b6ee6fe258ce4d89592593efcd3d798c418859 upstream.
Instead of clearing the "updated" flag for each cooling device affected by the trip point crossing in bang_bang_control() and walking all thermal instances to run thermal_cdev_update() for all of the affected cooling devices, call __thermal_cdev_update() directly for each of them.
No intentional functional impact.
--- drivers/thermal/gov_bang_bang.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/thermal/gov_bang_bang.c +1 -4
@@ -79,12 +79,9 @@ static void bang_bang_control(struct thedev_dbg (&instance->cdev->device,"target=%ld\n" , instance->target);mutex_lock (&instance->cdev->lock); - instance->cdev->updated = false;/* cdev needs update */ +__thermal_cdev_update (instance->cdev);mutex_unlock (&instance->cdev->lock); } - -list_for_each_entry (instance, &tz->thermal_instances, tz_node) -thermal_cdev_update (instance->cdev); }static struct thermal_governor thermal_gov_bang_bang = {
Greg Kroah-Hartman
maintainerPATCH 25/273 KEYS: trusted: fix DCP blob payload length assignment
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gstir <[email protected]>
commit 6486cad00a8b7f8585983408c152bbe33dda529b upstream.
The DCP trusted key type uses the wrong helper function to store the blob's payload length which can lead to the wrong byte order being used in case this would ever run on big endian architectures.
Fix by using correct helper function.
--- security/keys/trusted-keys/trusted_dcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_dcp.c +1 -1
@@ -222,7 +222,7 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)return ret; } - b->payload_len =get_unaligned_le32 (&p->key_len); +put_unaligned_le32 (p->key_len, &b->payload_len); p->blob_len = blen;return 0 ; }
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 26/273 KEYS: trusted: dcp: fix leak of blob encryption key
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gstir <[email protected]>
commit 0e28bf61a5f9ab30be3f3b4eafb8d097e39446bb upstream.
Trusted keys unseal the key blob on load, but keep the sealed payload in the blob field so that every subsequent read (export) will simply convert this field to hex and send it to userspace.
With DCP-based trusted keys, we decrypt the blob encryption key (BEK) in the Kernel due hardware limitations and then decrypt the blob payload. BEK decryption is done in-place which means that the trusted key blob field is modified and it consequently holds the BEK in plain text. Every subsequent read of that key thus send the plain text BEK instead of the encrypted BEK to userspace.
This issue only occurs when importing a trusted DCP-based key and then exporting it again. This should rarely happen as the common use cases are to either create a new trusted key and export it, or import a key blob and then just use it without exporting it again.
Fix this by performing BEK decryption and encryption in a dedicated buffer. Further always wipe the plain text BEK buffer to prevent leaking the key via uninitialized memory.
--- security/keys/trusted-keys/trusted_dcp.c | 33 +++++++++++++++--------- 1 file changed, 21 insertions(+), 12 deletions(-)
security/keys/trusted-keys/trusted_dcp.c +21 -12
@@ -186,20 +186,21 @@ static int do_aead_crypto(u8 *in, u8 *out, size_t len, u8 *key, u8 *nonce,return ret; } -static int decrypt_blob_key (u8 *key) +static int decrypt_blob_key (u8 *encrypted_key,u8 *plain_key) { -return do_dcp_crypto (key, key, false); +return do_dcp_crypto (encrypted_key, plain_key, false); } -static int encrypt_blob_key (u8 *key) +static int encrypt_blob_key (u8 *plain_key,u8 *encrypted_key) { -return do_dcp_crypto (key, key, true); +return do_dcp_crypto (plain_key, encrypted_key, true); }static int trusted_dcp_seal (struct trusted_key_payload *p,char *datablob) {struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;int blen, ret; +u8 plain_blob_key[AES_KEYSIZE_128 ]; blen =calc_blob_len (p->key_len);if (blen >MAX_BLOB_SIZE )
@@ -207,30 +208,36 @@ static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob) b->fmt_version =DCP_BLOB_VERSION ;get_random_bytes (b->nonce,AES_KEYSIZE_128 ); -get_random_bytes (b->blob_key,AES_KEYSIZE_128 ); +get_random_bytes (plain_blob_key,AES_KEYSIZE_128 ); - ret =do_aead_crypto (p->key, b->payload, p->key_len, b->blob_key, + ret =do_aead_crypto (p->key, b->payload, p->key_len, plain_blob_key, b->nonce, true);if (ret) {pr_err ("Unable to encrypt blob payload: %i\n" , ret); -return ret; + goto out; } - ret =encrypt_blob_key (b->blob_key); + ret =encrypt_blob_key (plain_blob_key, b->blob_key);if (ret) {pr_err ("Unable to encrypt blob key: %i\n" , ret); -return ret; + goto out; }put_unaligned_le32 (p->key_len, &b->payload_len); p->blob_len = blen; -return 0 ; + ret =0 ; + +out: +memzero_explicit (plain_blob_key,sizeof (plain_blob_key)); + +return ret; }static int trusted_dcp_unseal (struct trusted_key_payload *p,char *datablob) {struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;int blen, ret; +u8 plain_blob_key[AES_KEYSIZE_128 ];if (b->fmt_version !=DCP_BLOB_VERSION ) { pr_err("DCP blob has bad version: %i, expected %i\n",
@@ -248,14 +255,14 @@ static int trusted_dcp_unseal(struct trusted_key_payload *p, char *datablob) goto out; } - ret =decrypt_blob_key (b->blob_key); + ret =decrypt_blob_key (b->blob_key, plain_blob_key);if (ret) {pr_err ("Unable to decrypt blob key: %i\n" , ret); goto out; } ret =do_aead_crypto (b->payload, p->key, p->key_len +DCP_BLOB_AUTHLEN , - b->blob_key, b->nonce, false); + plain_blob_key, b->nonce, false);if (ret) {pr_err ("Unwrap of DCP payload failed: %i\n" , ret); goto out;
@@ -263,6 +270,8 @@ static int trusted_dcp_unseal(struct trusted_key_payload *p, char *datablob) ret =0 ; out: +memzero_explicit (plain_blob_key,sizeof (plain_blob_key)); +return ret; }
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 27/273 riscv: change XIPs kernel_map.size to be size of the entire kernel
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit 57d76bc51fd80824bcc0c84a5b5ec944f1b51edd upstream.
With XIP kernel, kernel_map.size is set to be only the size of data part of the kernel. This is inconsistent with "normal" kernel, who sets it to be the size of the entire kernel.
More importantly, XIP kernel fails to boot if CONFIG_DEBUG_VIRTUAL is enabled, because there are checks on virtual addresses with the assumption that kernel_map.size is the size of the entire kernel (these checks are in arch/riscv/mm/physaddr.c).
Change XIP's kernel_map.size to be the size of the entire kernel.
--- arch/riscv/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/mm/init.c +2 -2
@@ -931,7 +931,7 @@ static void __init create_kernel_page_ta PMD_SIZE, PAGE_KERNEL_EXEC);/* Map the data in RAM */ - end_va = kernel_map.virt_addr +XIP_OFFSET + kernel_map.size; + end_va = kernel_map.virt_addr + kernel_map.size;for (va = kernel_map.virt_addr +XIP_OFFSET ; va < end_va; va +=PMD_SIZE ) create_pgd_mapping(pgdir, va, kernel_map.phys_addr + (va - (kernel_map.virt_addr + XIP_OFFSET)),
@@ -1100,7 +1100,7 @@ asmlinkage void __init setup_vm(uintptr_ phys_ram_base =CONFIG_PHYS_RAM_BASE ; kernel_map.phys_addr = (uintptr_t )CONFIG_PHYS_RAM_BASE ; - kernel_map.size = (uintptr_t )(&_end) - (uintptr_t )(&_sdata); + kernel_map.size = (uintptr_t )(&_end) - (uintptr_t )(&_start); kernel_map.va_kernel_xip_pa_offset = kernel_map.virt_addr - kernel_map.xiprom;#else
Greg Kroah-Hartman
maintainerPATCH 28/273 riscv: entry: always initialize regs->a0 to -ENOSYS
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Celeste Liu <[email protected]>
commit 61119394631f219e23ce98bcc3eb993a64a8ea64 upstream.
Otherwise when the tracer changes syscall number to -1, the kernel fails to initialize a0 with -ENOSYS and subsequently fails to return the error code of the failed syscall to userspace. For example, it will break strace syscall tampering.
--- arch/riscv/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/traps.c +2 -2
@@ -319,6 +319,7 @@ void do_trap_ecall_u(struct pt_regs *reg regs->epc +=4 ; regs->orig_a0 = regs->a0; + regs->a0 = -ENOSYS ;riscv_v_vstate_discard (regs);
@@ -328,8 +329,7 @@ void do_trap_ecall_u(struct pt_regs *regif (syscall >=0 && syscall < NR_syscalls)syscall_handler (regs, syscall); -else if (syscall !=-1 ) - regs->a0 = -ENOSYS ; +/* * Ultimately, this value will get limited by KSTACK_OFFSET_MAX(), * so the maximum stack offset is 1k bytes (10 bits).
Greg Kroah-Hartman
maintainerPATCH 29/273 smb3: fix lock breakage for cached writes
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 836bb3268db405cf9021496ac4dbc26d3e4758fe upstream.
Mandatory locking is enforced for cached writes, which violates default posix semantics, and also it is enforced inconsistently. This apparently breaks recent versions of libreoffice, but can also be demonstrated by opening a file twice from the same client, locking it from handle one and writing to it from handle two (which fails, returning EACCES).
Since there was already a mount option "forcemandatorylock" (which defaults to off), with this change only when the user intentionally specifies "forcemandatorylock" on mount will we break posix semantics on write to a locked range (ie we will only fail the write in this case, if the user mounts with "forcemandatorylock").
--- fs/smb/client/file.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/smb/client/file.c +9 -4
@@ -2719,6 +2719,7 @@ cifs_writev(struct kiocb *iocb, struct istruct inode *inode = file->f_mapping->host;struct cifsInodeInfo *cinode =CIFS_I (inode);struct TCP_Server_Info *server =tlink_tcon (cfile->tlink)->ses->server; +struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);ssize_t rc; rc =netfs_start_io_write (inode);
@@ -2735,12 +2736,16 @@ cifs_writev(struct kiocb *iocb, struct iif (rc <=0 ) goto out; -if (!cifs_find_lock_conflict (cfile, iocb->ki_pos,iov_iter_count (from), +if ((cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NOPOSIXBRL ) && + (cifs_find_lock_conflict (cfile, iocb->ki_pos,iov_iter_count (from), server->vals->exclusive_lock_type,0 , -NULL ,CIFS_WRITE_OP )) - rc =netfs_buffered_write_iter_locked (iocb, from,NULL ); -else +NULL ,CIFS_WRITE_OP ))) { rc = -EACCES ; + goto out; + } + + rc =netfs_buffered_write_iter_locked (iocb, from,NULL ); + out:up_read (&cinode->lock_sem);netfs_end_io_write (inode);
Greg Kroah-Hartman
maintainerPATCH 30/273 i2c: tegra: Do not mark ACPI devices as irq safe
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit 14d069d92951a3e150c0a81f2ca3b93e54da913b upstream.
On ACPI machines, the tegra i2c module encounters an issue due to a mutex being called inside a spinlock. This leads to the following bug:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585 ... Call trace: __might_sleep __mutex_lock_common mutex_lock_nested acpi_subsys_runtime_resume rpm_resume tegra_i2c_xfer
The problem arises because during __pm_runtime_resume(), the spinlock &dev->power.lock is acquired before rpm_resume() is called. Later, rpm_resume() invokes acpi_subsys_runtime_resume(), which relies on mutexes, triggering the error.
To address this issue, devices on ACPI are now marked as not IRQ-safe, considering the dependency of acpi_subsys_runtime_resume() on mutexes.
--- drivers/i2c/busses/i2c-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-tegra.c +2 -2
@@ -1802,9 +1802,9 @@ static int tegra_i2c_probe(struct platfo* domain. * * VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't -* be used for atomic transfers. +* be used for atomic transfers. ACPI device is not IRQ safe also. */ -if (!IS_VI (i2c_dev)) +if (!IS_VI (i2c_dev) && !has_acpi_companion (i2c_dev->dev))pm_runtime_irq_safe (i2c_dev->dev);pm_runtime_enable (i2c_dev->dev);
Greg Kroah-Hartman
maintainerPATCH 31/273 ACPICA: Add a depth argument to acpi_execute_reg_methods()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit cdf65d73e001fde600b18d7e45afadf559425ce5 upstream.
A subsequent change will need to pass a depth argument to acpi_execute_reg_methods(), so prepare that function for it.
No intentional functional changes.
--- drivers/acpi/acpica/acevents.h | 2 +- drivers/acpi/acpica/evregion.c | 6 ++++-- drivers/acpi/acpica/evxfregn.c | 10 +++++++--- drivers/acpi/ec.c | 2 +- include/acpi/acpixf.h | 1 + 5 files changed, 14 insertions(+), 7 deletions(-)
drivers/acpi/acpica/acevents.h +1 -1
@@ -188,7 +188,7 @@ acpi_ev_detach_region(union acpi_operand u8 acpi_ns_is_locked);void -acpi_ev_execute_reg_methods (struct acpi_namespace_node *node, +acpi_ev_execute_reg_methods (struct acpi_namespace_node *node,u32 max_depth,acpi_adr_space_type space_id,u32 function); acpi_status
drivers/acpi/acpica/evregion.c +4 -2
@@ -65,6 +65,7 @@ acpi_status acpi_ev_initialize_op_region acpi_gbl_default_address_spaces [i])) {acpi_ev_execute_reg_methods (acpi_gbl_root_node, +ACPI_UINT32_MAX , acpi_gbl_default_address_spaces [i],ACPI_REG_CONNECT ); }
@@ -672,6 +673,7 @@ cleanup1:* FUNCTION: acpi_ev_execute_reg_methods * * PARAMETERS: node - Namespace node for the device +* max_depth - Depth to which search for _REG * space_id - The address space ID * function - Passed to _REG: On (1) or Off (0) *
@@ -683,7 +685,7 @@ cleanup1:******************************************************************************/ void -acpi_ev_execute_reg_methods (struct acpi_namespace_node *node, +acpi_ev_execute_reg_methods (struct acpi_namespace_node *node,u32 max_depth,acpi_adr_space_type space_id,u32 function) {struct acpi_reg_walk_info info;
@@ -717,7 +719,7 @@ acpi_ev_execute_reg_methods(struct acpi_* regions and _REG methods. (i.e. handlers must be installed for all * regions of this Space ID before we can run any _REG methods) */ - (void )acpi_ns_walk_namespace (ACPI_TYPE_ANY , node,ACPI_UINT32_MAX , + (void )acpi_ns_walk_namespace (ACPI_TYPE_ANY , node, max_depth,ACPI_NS_WALK_UNLOCK , acpi_ev_reg_run,NULL , &info,NULL );
drivers/acpi/acpica/evxfregn.c +7 -3
@@ -85,7 +85,8 @@ acpi_install_address_space_handler_inter/* Run all _REG methods for this address space */ if (run_reg) { -acpi_ev_execute_reg_methods (node, space_id,ACPI_REG_CONNECT ); +acpi_ev_execute_reg_methods (node,ACPI_UINT32_MAX , space_id, +ACPI_REG_CONNECT ); } unlock_and_exit:
@@ -263,6 +264,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_address_s* FUNCTION: acpi_execute_reg_methods * * PARAMETERS: device - Handle for the device +* max_depth - Depth to which search for _REG * space_id - The address space ID * * RETURN: Status
@@ -271,7 +273,8 @@ ACPI_EXPORT_SYMBOL(acpi_remove_address_s* ******************************************************************************/ acpi_status -acpi_execute_reg_methods (acpi_handle device,acpi_adr_space_type space_id) +acpi_execute_reg_methods (acpi_handle device,u32 max_depth, +acpi_adr_space_type space_id) {struct acpi_namespace_node *node;acpi_status status;
@@ -296,7 +299,8 @@ acpi_execute_reg_methods(acpi_handle dev/* Run all _REG methods for this address space */ -acpi_ev_execute_reg_methods (node, space_id,ACPI_REG_CONNECT ); +acpi_ev_execute_reg_methods (node, max_depth, space_id, +ACPI_REG_CONNECT ); }else { status =AE_BAD_PARAMETER ; }
drivers/acpi/ec.c +1 -1
@@ -1506,7 +1506,7 @@ static int ec_install_handlers(struct ac }if (call_reg && !test_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags)) { -acpi_execute_reg_methods (scope_handle,ACPI_ADR_SPACE_EC ); +acpi_execute_reg_methods (scope_handle,ACPI_UINT32_MAX ,ACPI_ADR_SPACE_EC );set_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags); }
include/acpi/acpixf.h +1 -0
@@ -660,6 +660,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status void *context)) ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_execute_reg_methods(acpi_handle device, + u32 nax_depth, acpi_adr_space_type space_id)) ACPI_EXTERNAL_RETURN_STATUS(acpi_status
Greg Kroah-Hartman
maintainerPATCH 32/273 ACPI: EC: Evaluate _REG outside the EC scope more carefully
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 71bf41b8e913ec9fc91f0d39ab8fb320229ec604 upstream.
Commit 60fa6ae6e6d0 ("ACPI: EC: Install address space handler at the namespace root") caused _REG methods for EC operation regions outside the EC device scope to be evaluated which on some systems leads to the evaluation of _REG methods in the scopes of device objects representing devices that are not present and not functional according to the _STA return values. Some of those device objects represent EC "alternatives" and if _REG is evaluated for their operation regions, the platform firmware may be confused and the platform may start to behave incorrectly.
To avoid this problem, only evaluate _REG for EC operation regions located in the scopes of device objects representing known-to-be-present devices.
For this purpose, partially revert commit 60fa6ae6e6d0 and trigger the evaluation of _REG for EC operation regions from acpi_bus_attach() for the known-valid devices.
--- drivers/acpi/ec.c | 11 +++++++++-- drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-)
drivers/acpi/ec.c +9 -2
@@ -1487,12 +1487,13 @@ static bool install_gpio_irq_event_handlstatic int ec_install_handlers (struct acpi_ec *ec,struct acpi_device *device,bool call_reg) { -acpi_handle scope_handle = ec == first_ec ?ACPI_ROOT_OBJECT : ec->handle;acpi_status status;acpi_ec_start (ec, false);if (!test_bit (EC_FLAGS_EC_HANDLER_INSTALLED , &ec->flags)) { +acpi_handle scope_handle = ec == first_ec ?ACPI_ROOT_OBJECT : ec->handle; +acpi_ec_enter_noirq (ec); status = acpi_install_address_space_handler_no_reg(scope_handle, ACPI_ADR_SPACE_EC,
@@ -1506,7 +1507,7 @@ static int ec_install_handlers(struct ac }if (call_reg && !test_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags)) { -acpi_execute_reg_methods (scope_handle,ACPI_UINT32_MAX ,ACPI_ADR_SPACE_EC ); +acpi_execute_reg_methods (ec->handle,ACPI_UINT32_MAX ,ACPI_ADR_SPACE_EC );set_bit (EC_FLAGS_EC_REG_CALLED , &ec->flags); }
@@ -1721,6 +1722,12 @@ static void acpi_ec_remove(struct acpi_d } } +void acpi_ec_register_opregions (struct acpi_device *adev) +{ +if (first_ec && first_ec->handle != adev->handle) +acpi_execute_reg_methods (adev->handle,1 ,ACPI_ADR_SPACE_EC ); +} +static acpi_status ec_parse_io_ports (struct acpi_resource *resource,void *context) {
drivers/acpi/internal.h +1 -0
@@ -223,6 +223,7 @@ int acpi_ec_add_query_handler(struct acp acpi_handle handle, acpi_ec_query_func func, void *data);void acpi_ec_remove_query_handler (struct acpi_ec *ec,u8 query_bit); +void acpi_ec_register_opregions (struct acpi_device *adev);#ifdef CONFIG_PM_SLEEP void acpi_ec_flush_work (void );
drivers/acpi/scan.c +2 -0
@@ -2264,6 +2264,8 @@ static int acpi_bus_attach(struct acpi_dif (device->handler) goto ok; +acpi_ec_register_opregions (device); +if (!device->flags.initialized) { device->flags.power_manageable = device->power.states[ACPI_STATE_D0 ].flags.valid;
Greg Kroah-Hartman
maintainerPATCH 33/273 arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Xu <[email protected]>
commit a21dcf0ea8566ebbe011c79d6ed08cdfea771de3 upstream.
Currently, only acpi_early_node_map[0] was initialized to NUMA_NO_NODE. To ensure all the values were properly initialized, switch to initialize all of them to NUMA_NO_NODE.
--- arch/arm64/kernel/acpi_numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/acpi_numa.c +1 -1
@@ -27,7 +27,7 @@#include <asm/numa.h> -static int acpi_early_node_map[NR_CPUS ]__initdata = {NUMA_NO_NODE }; +static int acpi_early_node_map[NR_CPUS ]__initdata = { [0 ...NR_CPUS -1 ] =NUMA_NO_NODE };int __init acpi_numa_get_nid (unsigned int cpu) {
Greg Kroah-Hartman
maintainerPATCH 34/273 dm resume: dont return EINVAL when signalled
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khazhismel Kumykov <[email protected]>
commit 7a636b4f03af9d541205f69e373672e7b2b60a8a upstream.
If the dm_resume method is called on a device that is not suspended, the method will suspend the device briefly, before resuming it (so that the table will be swapped).
However, there was a bug that the return value of dm_suspended_md was not checked. dm_suspended_md may return an error when it is interrupted by a signal. In this case, do_resume would call dm_swap_table, which would return -EINVAL.
This commit fixes the logic, so that error returned by dm_suspend is checked and the resume operation is undone.
--- drivers/md/dm-ioctl.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/md/dm-ioctl.c +20 -2
@@ -1181,8 +1181,26 @@ static int do_resume(struct dm_ioctl *pa suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG ;if (param->flags &DM_NOFLUSH_FLAG ) suspend_flags |=DM_SUSPEND_NOFLUSH_FLAG ; -if (!dm_suspended_md (md)) -dm_suspend (md, suspend_flags); +if (!dm_suspended_md (md)) { + r =dm_suspend (md, suspend_flags); +if (r) { +down_write (&_hash_lock); + hc =dm_get_mdptr (md); +if (hc && !hc->new_map) { + hc->new_map = new_map; + new_map =NULL ; + }else { + r = -ENXIO ; + } +up_write (&_hash_lock); +if (new_map) { +dm_sync_table (md); +dm_table_destroy (new_map); + } +dm_put (md); +return r; + } + } old_size =dm_get_size (md); old_map =dm_swap_table (md, new_map);
Greg Kroah-Hartman
maintainerPATCH 35/273 dm persistent data: fix memory allocation failure
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit faada2174c08662ae98b439c69efe3e79382c538 upstream.
kmalloc is unreliable when allocating more than 8 pages of memory. It may fail when there is plenty of free memory but the memory is fragmented. Zdenek Kabelac observed such failure in his tests.
This commit changes kmalloc to kvmalloc - kvmalloc will fall back to vmalloc if the large allocation fails.
--- drivers/md/persistent-data/dm-space-map-metadata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +2 -2
@@ -277,7 +277,7 @@ static void sm_metadata_destroy(struct d { struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); -kfree (smm); +kvfree (smm); }static int sm_metadata_get_nr_blocks (struct dm_space_map *sm,dm_block_t *count)
@@ -772,7 +772,7 @@ struct dm_space_map *dm_sm_metadata_init {struct sm_metadata *smm; - smm =kmalloc (sizeof (*smm),GFP_KERNEL ); + smm =kvmalloc (sizeof (*smm),GFP_KERNEL );if (!smm)return ERR_PTR (-ENOMEM );
Greg Kroah-Hartman
maintainerPATCH 36/273 vfs: Dont evict inode under the inode lru traversing context
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhihao Cheng <[email protected]>
commit 2a0629834cd82f05d424bbc193374f9a43d1f87d upstream.
The inode reclaiming process(See function prune_icache_sb) collects all reclaimable inodes and mark them with I_FREEING flag at first, at that time, other processes will be stuck if they try getting these inodes (See function find_inode_fast), then the reclaiming process destroy the inodes by function dispose_list(). Some filesystems(eg. ext4 with ea_inode feature, ubifs with xattr) may do inode lookup in the inode evicting callback function, if the inode lookup is operated under the inode lru traversing context, deadlock problems may happen.
Case 1: In function ext4_evict_inode(), the ea inode lookup could happen
if ea_inode feature is enabled, the lookup process will be stuck under the evicting context like this:
1. File A has inode i_reg and an ea inode i_ea
2. getfattr(A, xattr_buf) // i_ea is added into lru // lru->i_ea
3. Then, following three processes running like this:
PA PB
echo 2 > /proc/sys/vm/drop_caches
shrink_slab
prune_dcache_sb
// i_reg is added into lru, lru->i_ea->i_reg
prune_icache_sb
list_lru_walk_one
inode_lru_isolate
i_ea->i_state |= I_FREEING // set inode state
inode_lru_isolate
__iget(i_reg)
spin_unlock(&i_reg->i_lock)
spin_unlock(lru_lock)
rm file A
i_reg->nlink = 0
iput(i_reg) // i_reg->nlink is 0, do evict
ext4_evict_inode
ext4_xattr_delete_inode
ext4_xattr_inode_dec_ref_all
ext4_xattr_inode_iget
ext4_iget(i_ea->i_ino)
iget_locked
find_inode_fast
__wait_on_freeing_inode(i_ea) ----→ AA deadlock
dispose_list // cannot be executed by prune_icache_sb
wake_up_bit(&i_ea->i_state)Case 2: In deleted inode writing function ubifs_jnl_write_inode(), file
deleting process holds BASEHD's wbuf->io_mutex while getting the xattr inode, which could race with inode reclaiming process(The reclaiming process could try locking BASEHD's wbuf->io_mutex in inode evicting function), then an ABBA deadlock problem would happen as following:
1. File A has inode ia and a xattr(with inode ixa), regular file B has inode ib and a xattr.
2. getfattr(A, xattr_buf) // ixa is added into lru // lru->ixa
3. Then, following three processes running like this:
PA PB PC
echo 2 > /proc/sys/vm/drop_caches
shrink_slab
prune_dcache_sb
// ib and ia are added into lru, lru->ixa->ib->ia
prune_icache_sb
list_lru_walk_one
inode_lru_isolate
ixa->i_state |= I_FREEING // set inode state
inode_lru_isolate
__iget(ib)
spin_unlock(&ib->i_lock)
spin_unlock(lru_lock)
rm file B
ib->nlink = 0
rm file A
iput(ia)
ubifs_evict_inode(ia)
ubifs_jnl_delete_inode(ia)
ubifs_jnl_write_inode(ia)
make_reservation(BASEHD) // Lock wbuf->io_mutex
ubifs_iget(ixa->i_ino)
iget_locked
find_inode_fast
__wait_on_freeing_inode(ixa)
| iput(ib) // ib->nlink is 0, do evict
| ubifs_evict_inode
| ubifs_jnl_delete_inode(ib)
↓ ubifs_jnl_write_inode
ABBA deadlock ←-----make_reservation(BASEHD)
dispose_list // cannot be executed by prune_icache_sb
wake_up_bit(&ixa->i_state)Fix the possible deadlock by using new inode state flag I_LRU_ISOLATING to pin the inode in memory while inode_lru_isolate() reclaims its pages instead of using ordinary inode reference. This way inode deletion cannot be triggered from inode_lru_isolate() thus avoiding the deadlock. evict() is made to wait for I_LRU_ISOLATING to be cleared before proceeding with inode cleanup.
--- fs/inode.c | 39 +++++++++++++++++++++++++++++++++++++-- include/linux/fs.h | 5 +++++ 2 files changed, 42 insertions(+), 2 deletions(-)
fs/inode.c +37 -2
@@ -486,6 +486,39 @@ static void inode_lru_list_del(struct inthis_cpu_dec (nr_unused); } +static void inode_pin_lru_isolating (struct inode *inode) +{ +lockdep_assert_held (&inode->i_lock); +WARN_ON (inode->i_state & (I_LRU_ISOLATING |I_FREEING |I_WILL_FREE )); + inode->i_state |=I_LRU_ISOLATING ; +} + +static void inode_unpin_lru_isolating (struct inode *inode) +{ +spin_lock (&inode->i_lock); +WARN_ON (!(inode->i_state &I_LRU_ISOLATING )); + inode->i_state &= ~I_LRU_ISOLATING ; +smp_mb (); +wake_up_bit (&inode->i_state, __I_LRU_ISOLATING); +spin_unlock (&inode->i_lock); +} + +static void inode_wait_for_lru_isolating (struct inode *inode) +{ +spin_lock (&inode->i_lock); +if (inode->i_state &I_LRU_ISOLATING ) { +DEFINE_WAIT_BIT (wq, &inode->i_state, __I_LRU_ISOLATING); +wait_queue_head_t *wqh; + + wqh =bit_waitqueue (&inode->i_state, __I_LRU_ISOLATING); +spin_unlock (&inode->i_lock); +__wait_on_bit (wqh, &wq, bit_wait,TASK_UNINTERRUPTIBLE ); +spin_lock (&inode->i_lock); +WARN_ON (inode->i_state &I_LRU_ISOLATING ); + } +spin_unlock (&inode->i_lock); +} +/** * inode_sb_list_add - add inode to the superblock list of inodes * @inode: inode to add
@@ -655,6 +688,8 @@ static void evict(struct inode *inode)inode_sb_list_del (inode); +inode_wait_for_lru_isolating (inode); +/* * Wait for flusher thread to be done with the inode so that filesystem * does not start destroying it while writeback is still running. Since
@@ -843,7 +878,7 @@ static enum lru_status inode_lru_isolate* be under pressure before the cache inside the highmem zone. */ if (inode_has_buffers (inode) || !mapping_empty (&inode->i_data)) { -__iget (inode); +inode_pin_lru_isolating (inode);spin_unlock (&inode->i_lock);spin_unlock (lru_lock);if (remove_inode_buffers (inode)) {
@@ -855,7 +890,7 @@ static enum lru_status inode_lru_isolate__count_vm_events (PGINODESTEAL , reap);mm_account_reclaimed_pages (reap); } -iput (inode); +inode_unpin_lru_isolating (inode);spin_lock (lru_lock);return LRU_RETRY ; }
include/linux/fs.h +5 -0
@@ -2370,6 +2370,9 @@ static inline void kiocb_clone(struct ki* * I_PINNING_FSCACHE_WB Inode is pinning an fscache object for writeback. * +* I_LRU_ISOLATING Inode is pinned being isolated from LRU without holding +* i_count. +* * Q: What is the difference between I_WILL_FREE and I_FREEING? */ #define I_DIRTY_SYNC (1 << 0)
@@ -2393,6 +2396,8 @@ static inline void kiocb_clone(struct ki#define I_DONTCACHE (1 << 16)#define I_SYNC_QUEUED (1 << 17)#define I_PINNING_NETFS_WB (1 << 18) +#define __I_LRU_ISOLATING 19 +#define I_LRU_ISOLATING (1 << __I_LRU_ISOLATING)#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
Greg Kroah-Hartman
maintainerPATCH 37/273 fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 9a2fa1472083580b6c66bdaf291f591e1170123a upstream.
copy_fd_bitmaps(new, old, count) is expected to copy the first count/BITS_PER_LONG bits from old->full_fds_bits[] and fill the rest with zeroes. What it does is copying enough words (BITS_TO_LONGS(count/BITS_PER_LONG)), then memsets the rest. That works fine, *if* all bits past the cutoff point are clear. Otherwise we are risking garbage from the last word we'd copied.
For most of the callers that is true - expand_fdtable() has count equal to old->max_fds, so there's no open descriptors past count, let alone fully occupied words in ->open_fds[], which is what bits in ->full_fds_bits[] correspond to.
The other caller (dup_fd()) passes sane_fdtable_size(old_fdt, max_fds), which is the smallest multiple of BITS_PER_LONG that covers all opened descriptors below max_fds. In the common case (copying on fork()) max_fds is ~0U, so all opened descriptors will be below it and we are fine, by the same reasons why the call in expand_fdtable() is safe.
Unfortunately, there is a case where max_fds is less than that and where we might, indeed, end up with junk in ->full_fds_bits[] - close_range(from, to, CLOSE_RANGE_UNSHARE) with
* descriptor table being currently shared
* 'to' being above the current capacity of descriptor table
* 'from' being just under some chunk of opened descriptors.
In that case we end up with observably wrong behaviour - e.g. spawn a child with CLONE_FILES, get all descriptors in range 0..127 open, then close_range(64, ~0U, CLOSE_RANGE_UNSHARE) and watch dup(0) ending up with descriptor #128, despite #64 being observably not open.
The minimally invasive fix would be to deal with that in dup_fd(). If this proves to add measurable overhead, we can go that way, but let's try to fix copy_fd_bitmaps() first.
* new helper: bitmap_copy_and_expand(to, from, bits_to_copy, size).
* make copy_fd_bitmaps() take the bitmap size in words, rather than bits; it's 'count' argument is always a multiple of BITS_PER_LONG, so we are not losing any information, and that way we can use the same helper for all three bitmaps - compiler will see that count is a multiple of BITS_PER_LONG for the large ones, so it'll generate plain memcpy()+memset().
Reproducer added to tools/testing/selftests/core/close_range_test.c
--- fs/file.c | 28 ++++++++----------- include/linux/bitmap.h | 12 ++++++++ tools/testing/selftests/core/close_range_test.c | 35 ++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 16 deletions(-)
fs/file.c +12 -16
@@ -46,27 +46,23 @@ static void free_fdtable_rcu(struct rcu_#define BITBIT_NR (nr) BITS_TO_LONGS(BITS_TO_LONGS(nr))#define BITBIT_SIZE (nr) (BITBIT_NR(nr) * sizeof(long)) +#define fdt_words (fdt) ((fdt)->max_fds / BITS_PER_LONG) // words in ->open_fds/* * Copy 'count' fd bits from the old table to the new table and clear the extra * space if any. This does not copy the file pointers. Called with the files * spinlock held for write. */ -static void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, -unsigned int count) +static inline void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, +unsigned int copy_words) { -unsigned int cpy, set; +unsigned int nwords =fdt_words (nfdt); - cpy = count /BITS_PER_BYTE ; - set = (nfdt->max_fds - count) /BITS_PER_BYTE ; -memcpy (nfdt->open_fds, ofdt->open_fds, cpy); -memset ((char *)nfdt->open_fds + cpy,0 , set); -memcpy (nfdt->close_on_exec, ofdt->close_on_exec, cpy); -memset ((char *)nfdt->close_on_exec + cpy,0 , set); - - cpy =BITBIT_SIZE (count); - set =BITBIT_SIZE (nfdt->max_fds) - cpy; -memcpy (nfdt->full_fds_bits, ofdt->full_fds_bits, cpy); -memset ((char *)nfdt->full_fds_bits + cpy,0 , set); +bitmap_copy_and_extend (nfdt->open_fds, ofdt->open_fds, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->close_on_exec, ofdt->close_on_exec, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->full_fds_bits, ofdt->full_fds_bits, + copy_words, nwords); }/*
@@ -84,7 +80,7 @@ static void copy_fdtable(struct fdtablememcpy (nfdt->fd, ofdt->fd, cpy);memset ((char *)nfdt->fd + cpy,0 , set); -copy_fd_bitmaps (nfdt, ofdt, ofdt->max_fds); +copy_fd_bitmaps (nfdt, ofdt,fdt_words (ofdt)); }/*
@@ -379,7 +375,7 @@ struct files_struct *dup_fd(struct files open_files =sane_fdtable_size (old_fdt, max_fds); } -copy_fd_bitmaps (new_fdt, old_fdt, open_files); +copy_fd_bitmaps (new_fdt, old_fdt, open_files /BITS_PER_LONG ); old_fds = old_fdt->fd; new_fds = new_fdt->fd;
include/linux/bitmap.h +12 -0
@@ -270,6 +270,18 @@ static inline void bitmap_copy_clear_tai dst[nbits /BITS_PER_LONG ] &=BITMAP_LAST_WORD_MASK (nbits); } +static inline void bitmap_copy_and_extend (unsigned long *to, +const unsigned long *from, +unsigned int count,unsigned int size) +{ +unsigned int copy =BITS_TO_LONGS (count); + +memcpy (to, from, copy *sizeof (long )); +if (count %BITS_PER_LONG ) + to[copy -1 ] &=BITMAP_LAST_WORD_MASK (count); +memset (to + copy,0 ,bitmap_size (size) - copy *sizeof (long )); +} +/* * On 32-bit systems bitmaps are represented as u32 arrays internally. On LE64 * machines the order of hi and lo parts of numbers match the bitmap structure.
tools/testing/selftests/core/close_range_test.c +35 -0
@@ -589,4 +589,39 @@ TEST(close_range_cloexec_unshare_syzbot)EXPECT_EQ (close (fd3),0 ); } +TEST (close_range_bitmap_corruption) +{ +pid_t pid; +int status; +struct __clone_args args = { + .flags =CLONE_FILES , + .exit_signal =SIGCHLD , + }; + +/* get the first 128 descriptors open */ +for (int i =2 ; i <128 ; i++) +EXPECT_GE (dup2 (0 , i),0 ); + +/* get descriptor table shared */ + pid =sys_clone3 (&args,sizeof (args)); +ASSERT_GE (pid,0 ); + +if (pid ==0 ) { +/* unshare and truncate descriptor table down to 64 */ +if (sys_close_range (64 , ~0U ,CLOSE_RANGE_UNSHARE )) +exit (EXIT_FAILURE ); + +ASSERT_EQ (fcntl (64 ,F_GETFD ),-1 ); +/* ... and verify that the range 64..127 is not +stuck "fully used" according to secondary bitmap */ + EXPECT_EQ(dup(0), 64) +exit (EXIT_FAILURE ); +exit (EXIT_SUCCESS ); + } + +EXPECT_EQ (waitpid (pid, &status,0 ), pid); +EXPECT_EQ (true,WIFEXITED (status)); +EXPECT_EQ (0 ,WEXITSTATUS (status)); +} +TEST_HARNESS_MAIN
Greg Kroah-Hartman
maintainerPATCH 38/273 i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Shyti <[email protected]>
commit 4e91fa1ef3ce6290b4c598e54b5eb6cf134fbec8 upstream.
Add the missing geni_icc_disable() call before returning in the geni_i2c_runtime_resume() function.
Commit 9ba48db9f77c ("i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume") by Gaosheng missed disabling the interconnect in one case.
--- drivers/i2c/busses/i2c-qcom-geni.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +3 -1
@@ -986,8 +986,10 @@ static int __maybe_unused geni_i2c_runtireturn ret; ret =clk_prepare_enable (gi2c->core_clk); -if (ret) +if (ret) { +geni_icc_disable (&gi2c->se);return ret; + } ret =geni_se_resources_on (&gi2c->se);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 39/273 tracing: Return from tracing_buffers_read() if the file has been closed
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit d0949cd44a62c4c41b30ea7ae94d8c887f586882 upstream.
When running the following:
# cd /sys/kernel/tracing/ # echo 1 > events/sched/sched_waking/enable # echo 1 > events/sched/sched_switch/enable # echo 0 > tracing_on # dd if=per_cpu/cpu0/trace_pipe_raw of=/tmp/raw0.dat
The dd task would get stuck in an infinite loop in the kernel. What would happen is the following:
When ring_buffer_read_page() returns -1 (no data) then a check is made to see if the buffer is empty (as happens when the page is not full), it will call wait_on_pipe() to wait until the ring buffer has data. When it is it will try again to read data (unless O_NONBLOCK is set).
The issue happens when there's a reader and the file descriptor is closed. The wait_on_pipe() will return when that is the case. But this loop will continue to try again and wait_on_pipe() will again return immediately and the loop will continue and never stop.
Simply check if the file was closed before looping and exit out if it is.
--- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
@@ -7956,7 +7956,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,trace_access_unlock (iter->cpu_file);if (ret <0 ) { -if (trace_empty (iter)) { +if (trace_empty (iter) && !iter->closed) {if ((filp->f_flags &O_NONBLOCK ))return -EAGAIN ;
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 40/273 perf/bpf: Dont call bpf_overflow_handler() for tracing events
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Huey <[email protected]>
commit 100bff23818eb61751ed05d64a7df36ce9728a4d upstream.
The regressing commit is new in 6.10. It assumed that anytime event->prog is set bpf_overflow_handler() should be invoked to execute the attached bpf program. This assumption is false for tracing events, and as a result the regressing commit broke bpftrace by invoking the bpf handler with garbage inputs on overflow.
Prior to the regression the overflow handlers formed a chain (of length 0, 1, or 2) and perf_event_set_bpf_handler() (the !tracing case) added bpf_overflow_handler() to that chain, while perf_event_attach_bpf_prog() (the tracing case) did not. Both set event->prog. The chain of overflow handlers was replaced by a single overflow handler slot and a fixed call to bpf_overflow_handler() when appropriate. This modifies the condition there to check event->prog->type == BPF_PROG_TYPE_PERF_EVENT, restoring the previous behavior and fixing bpftrace.
--- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
@@ -9708,7 +9708,8 @@ static int __perf_event_overflow(struct ret =__perf_event_account_interrupt (event, throttle); -if (event->prog && !bpf_overflow_handler (event, data, regs)) +if (event->prog && event->prog->type ==BPF_PROG_TYPE_PERF_EVENT && + !bpf_overflow_handler (event, data, regs))return ret;/*
Greg Kroah-Hartman
maintainerPATCH 41/273 mseal: fix is_madv_discard()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pedro Falcato <[email protected]>
commit e46bc2e7eb90a370bc27fa2fd98cb8251e7da1ec upstream.
is_madv_discard did its check wrong. MADV_ flags are not bitwise, they're normal sequential numbers. So, for instance:
behavior & (/* ... */ | MADV_REMOVE)
tagged both MADV_REMOVE and MADV_RANDOM (bit 0 set) as discard operations.
As a result the kernel could erroneously block certain madvises (e.g MADV_RANDOM or MADV_HUGEPAGE) on sealed VMAs due to them sharing bits with blocked MADV operations (e.g REMOVE or WIPEONFORK).
This is obviously incorrect, so use a switch statement instead.
--- mm/mseal.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
mm/mseal.c +11 -3
@@ -40,9 +40,17 @@ static bool can_modify_vma(struct vm_area_struct *vma)static bool is_madv_discard (int behavior) { -return behavior & - (MADV_FREE |MADV_DONTNEED |MADV_DONTNEED_LOCKED | -MADV_REMOVE |MADV_DONTFORK |MADV_WIPEONFORK ); +switch (behavior) { +case MADV_FREE : +case MADV_DONTNEED : +case MADV_DONTNEED_LOCKED : +case MADV_REMOVE : +case MADV_DONTFORK : +case MADV_WIPEONFORK : +return true; + } + +return false; }static bool is_ro_anon (struct vm_area_struct *vma)
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 42/273 rtla/osnoise: Prevent NULL dereference in error handling
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 90574d2a675947858b47008df8d07f75ea50d0d0 upstream.
If the "tool->data" allocation fails then there is no need to call osnoise_free_top() and, in fact, doing so will lead to a NULL dereference.
--- tools/tracing/rtla/src/osnoise_top.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
tools/tracing/rtla/src/osnoise_top.c +4 -7
@@ -640,8 +640,10 @@ struct osnoise_tool *osnoise_init_top(streturn NULL ; tool->data =osnoise_alloc_top (nr_cpus); -if (!tool->data) - goto out_err; +if (!tool->data) { +osnoise_destroy_tool (tool); +return NULL ; + } tool->params = params;
@@ -649,11 +651,6 @@ struct osnoise_tool *osnoise_init_top(st osnoise_top_handler, NULL);return tool; - -out_err: -osnoise_free_top (tool->data); -osnoise_destroy_tool (tool); -return NULL ; }static int stop_tracing;
Greg Kroah-Hartman
maintainerPATCH 43/273 mm: fix endless reclaim on machines with unaccepted memory
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kirill A. Shutemov <[email protected]>
commit 807174a93d24c456503692dc3f5af322ee0b640a upstream.
Unaccepted memory is considered unusable free memory, which is not counted as free on the zone watermark check. This causes get_page_from_freelist() to accept more memory to hit the high watermark, but it creates problems in the reclaim path.
The reclaim path encounters a failed zone watermark check and attempts to reclaim memory. This is usually successful, but if there is little or no reclaimable memory, it can result in endless reclaim with little to no progress. This can occur early in the boot process, just after start of the init process when the only reclaimable memory is the page cache of the init executable and its libraries.
Make unaccepted memory free from watermark check point of view. This way unaccepted memory will never be the trigger of memory reclaim. Accept more memory in the get_page_from_freelist() if needed.
--- mm/page_alloc.c | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-)
mm/page_alloc.c +20 -22
@@ -287,7 +287,7 @@ EXPORT_SYMBOL(nr_online_nodes);static bool page_contains_unaccepted (struct page *page,unsigned int order);static void accept_page (struct page *page,unsigned int order); -static bool try_to_accept_memory (struct zone *zone,unsigned int order); +static bool cond_accept_memory (struct zone *zone,unsigned int order);static inline bool has_unaccepted_memory (void );static bool __free_unaccepted (struct page *page);
@@ -3059,9 +3059,6 @@ static inline long __zone_watermark_unusif (!(alloc_flags &ALLOC_CMA )) unusable_free +=zone_page_state (z,NR_FREE_CMA_PAGES );#endif -#ifdef CONFIG_UNACCEPTED_MEMORY - unusable_free +=zone_page_state (z,NR_UNACCEPTED ); -#endif return unusable_free; }
@@ -3355,6 +3352,8 @@ retry: } } +cond_accept_memory (zone, order); +/* * Detect whether the number of free pages is below high * watermark. If so, we will decrease pcp->high and free
@@ -3380,10 +3379,8 @@ check_alloc_wmark: gfp_mask)) {int ret; -if (has_unaccepted_memory ()) { -if (try_to_accept_memory (zone, order)) - goto try_this_zone; - } +if (cond_accept_memory (zone, order)) + goto try_this_zone;#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT /*
@@ -3437,10 +3434,8 @@ try_this_zone:return page; }else { -if (has_unaccepted_memory ()) { -if (try_to_accept_memory (zone, order)) - goto try_this_zone; - } +if (cond_accept_memory (zone, order)) + goto try_this_zone;#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT /* Try again if zone has deferred pages */
@@ -6933,9 +6928,6 @@ static bool try_to_accept_memory_one(strstruct page *page;bool last; -if (list_empty (&zone->unaccepted_pages)) -return false; -spin_lock_irqsave (&zone->lock, flags); page =list_first_entry_or_null (&zone->unaccepted_pages, struct page, lru);
@@ -6961,23 +6953,29 @@ static bool try_to_accept_memory_one(strreturn true; } -static bool try_to_accept_memory (struct zone *zone,unsigned int order) +static bool cond_accept_memory (struct zone *zone,unsigned int order) {long to_accept; -int ret = false; +bool ret = false; + +if (!has_unaccepted_memory ()) +return false; + +if (list_empty (&zone->unaccepted_pages)) +return false;/* How much to accept to get to high watermark? */ to_accept =high_wmark_pages (zone) - (zone_page_state (zone,NR_FREE_PAGES ) - -__zone_watermark_unusable_free (zone, order,0 )); +__zone_watermark_unusable_free (zone, order,0 ) - +zone_page_state (zone,NR_UNACCEPTED )); -/* Accept at least one page */ -do { +while (to_accept >0 ) {if (!try_to_accept_memory_one (zone))break ; ret = true; to_accept -=MAX_ORDER_NR_PAGES ; - }while (to_accept >0 ); + }return ret; }
@@ -7020,7 +7018,7 @@ static void accept_page(struct page *pag { } -static bool try_to_accept_memory (struct zone *zone,unsigned int order) +static bool cond_accept_memory (struct zone *zone,unsigned int order) {return false; }
Greg Kroah-Hartman
maintainerPATCH 44/273 mm/hugetlb: fix hugetlb vs. core-mm PT locking
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 5f75cfbd6bb02295ddaed48adf667b6c828ce07b upstream.
We recently made GUP's common page table walking code to also walk hugetlb VMAs without most hugetlb special-casing, preparing for the future of having less hugetlb-specific page table walking code in the codebase. Turns out that we missed one page table locking detail: page table locking for hugetlb folios that are not mapped using a single PMD/PUD.
Assume we have hugetlb folio that spans multiple PTEs (e.g., 64 KiB hugetlb folios on arm64 with 4 KiB base page size). GUP, as it walks the page tables, will perform a pte_offset_map_lock() to grab the PTE table lock.
However, hugetlb that concurrently modifies these page tables would actually grab the mm->page_table_lock: with USE_SPLIT_PTE_PTLOCKS, the locks would differ. Something similar can happen right now with hugetlb folios that span multiple PMDs when USE_SPLIT_PMD_PTLOCKS.
This issue can be reproduced [1], for example triggering:
[ 3105.936100] ------------[ cut here ]------------ [ 3105.939323] WARNING: CPU: 31 PID: 2732 at mm/gup.c:142 try_grab_folio+0x11c/0x188 [ 3105.944634] Modules linked in: [...] [ 3105.974841] CPU: 31 PID: 2732 Comm: reproducer Not tainted 6.10.0-64.eln141.aarch64 #1 [ 3105.980406] Hardware name: QEMU KVM Virtual Machine, BIOS edk2-20240524-4.fc40 05/24/2024 [ 3105.986185] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 3105.991108] pc : try_grab_folio+0x11c/0x188 [ 3105.994013] lr : follow_page_pte+0xd8/0x430 [ 3105.996986] sp : ffff80008eafb8f0 [ 3105.999346] x29: ffff80008eafb900 x28: ffffffe8d481f380 x27: 00f80001207cff43 [ 3106.004414] x26: 0000000000000001 x25: 0000000000000000 x24: ffff80008eafba48 [ 3106.009520] x23: 0000ffff9372f000 x22: ffff7a54459e2000 x21: ffff7a546c1aa978 [ 3106.014529] x20: ffffffe8d481f3c0 x19: 0000000000610041 x18: 0000000000000001 [ 3106.019506] x17: 0000000000000001 x16: ffffffffffffffff x15: 0000000000000000 [ 3106.024494] x14: ffffb85477fdfe08 x13: 0000ffff9372ffff x12: 0000000000000000 [ 3106.029469] x11: 1fffef4a88a96be1 x10: ffff7a54454b5f0c x9 : ffffb854771b12f0 [ 3106.034324] x8 : 0008000000000000 x7 : ffff7a546c1aa980 x6 : 0008000000000080 [ 3106.038902] x5 : 00000000001207cf x4 : 0000ffff9372f000 x3 : ffffffe8d481f000 [ 3106.043420] x2 : 0000000000610041 x1 : 0000000000000001 x0 : 0000000000000000 [ 3106.047957] Call trace: [ 3106.049522] try_grab_folio+0x11c/0x188 [ 3106.051996] follow_pmd_mask.constprop.0.isra.0+0x150/0x2e0 [ 3106.055527] follow_page_mask+0x1a0/0x2b8 [ 3106.058118] __get_user_pages+0xf0/0x348 [ 3106.060647] faultin_page_range+0xb0/0x360 [ 3106.063651] do_madvise+0x340/0x598
Let's make huge_pte_lockptr() effectively use the same PT locks as any core-mm page table walker would. Add ptep_lockptr() to obtain the PTE page table lock using a pte pointer -- unfortunately we cannot convert pte_lockptr() because virt_to_page() doesn't work with kmap'ed page tables we can have with CONFIG_HIGHPTE.
Handle CONFIG_PGTABLE_LEVELS correctly by checking in reverse order, such that when e.g., CONFIG_PGTABLE_LEVELS==2 with PGDIR_SIZE==P4D_SIZE==PUD_SIZE==PMD_SIZE will work as expected. Document why that works.
There is one ugly case: powerpc 8xx, whereby we have an 8 MiB hugetlb folio being mapped using two PTE page tables. While hugetlb wants to take the PMD table lock, core-mm would grab the PTE table lock of one of both PTE page tables. In such corner cases, we have to make sure that both locks match, which is (fortunately!) currently guaranteed for 8xx as it does not support SMP and consequently doesn't use split PT locks.
[1] https://lore.kernel.org/all/[email protected]/
--- include/linux/hugetlb.h | 33 ++++++++++++++++++++++++++++++--- include/linux/mm.h | 11 +++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-)
include/linux/hugetlb.h +30 -3
@@ -967,10 +967,37 @@ static inline bool htlb_allow_alloc_fallstatic inline spinlock_t *huge_pte_lockptr (struct hstate *h,struct mm_struct *mm,pte_t *pte) { -if (huge_page_size (h) ==PMD_SIZE ) +const unsigned long size =huge_page_size (h); + +VM_WARN_ON (size ==PAGE_SIZE ); + +/* +* hugetlb must use the exact same PT locks as core-mm page table +* walkers would. When modifying a PTE table, hugetlb must take the +* PTE PT lock, when modifying a PMD table, hugetlb must take the PMD +* PT lock etc. +* +* The expectation is that any hugetlb folio smaller than a PMD is +* always mapped into a single PTE table and that any hugetlb folio +* smaller than a PUD (but at least as big as a PMD) is always mapped +* into a single PMD table. +* +* If that does not hold for an architecture, then that architecture +* must disable split PT locks such that all *_lockptr() functions +* will give us the same result: the per-MM PT lock. +* +* Note that with e.g., CONFIG_PGTABLE_LEVELS=2 where +* PGDIR_SIZE==P4D_SIZE==PUD_SIZE==PMD_SIZE, we'd use pud_lockptr() +* and core-mm would use pmd_lockptr(). However, in such configurations +* split PMD locks are disabled -- they don't make sense on a single +* PGDIR page table -- and the end result is the same. +*/ +if (size >=PUD_SIZE ) +return pud_lockptr (mm, (pud_t *) pte); +else if (size >=PMD_SIZE ||IS_ENABLED (CONFIG_HIGHPTE ))return pmd_lockptr (mm, (pmd_t *) pte); -VM_BUG_ON (huge_page_size (h) ==PAGE_SIZE ); -return &mm->page_table_lock; +/* pte_alloc_huge() only applies with !CONFIG_HIGHPTE */ +return ptep_lockptr (mm, pte); }#ifndef hugepages_supported
include/linux/mm.h +11 -0
@@ -2960,6 +2960,13 @@ static inline spinlock_t *pte_lockptr(streturn ptlock_ptr (page_ptdesc (pmd_page (*pmd))); } +static inline spinlock_t *ptep_lockptr (struct mm_struct *mm,pte_t *pte) +{ +BUILD_BUG_ON (IS_ENABLED (CONFIG_HIGHPTE )); +BUILD_BUG_ON (MAX_PTRS_PER_PTE *sizeof (pte_t) >PAGE_SIZE ); +return ptlock_ptr (virt_to_ptdesc (pte)); +} +static inline bool ptlock_init (struct ptdesc *ptdesc) {/*
@@ -2984,6 +2991,10 @@ static inline spinlock_t *pte_lockptr(st {return &mm->page_table_lock; } +static inline spinlock_t *ptep_lockptr (struct mm_struct *mm,pte_t *pte) +{ +return &mm->page_table_lock; +}static inline void ptlock_cache_init (void ) {}static inline bool ptlock_init (struct ptdesc *ptdesc) {return true; }static inline void ptlock_free (struct ptdesc *ptdesc) {}
Greg Kroah-Hartman
maintainerPATCH 45/273 md/raid1: Fix data corruption for degraded array with slow disk
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit c916ca35308d3187c9928664f9be249b22a3a701 upstream.
read_balance() will avoid reading from slow disks as much as possible, however, if valid data only lands in slow disks, and a new normal disk is still in recovery, unrecovered data can be read:
raid1_read_request
read_balance
raid1_should_read_first
-> return false
choose_best_rdev
-> normal disk is not recovered, return -1 choose_bb_rdev
-> missing the checking of recovery, return the normal disk
-> read unrecovered data
Root cause is that the checking of recovery is missing in choose_bb_rdev(). Hence add such checking to fix the problem.
Also fix similar problem in choose_slow_rdev().
--- drivers/md/raid1.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/md/raid1.c +10 -4
@@ -617,6 +617,12 @@ static int choose_first_rdev(struct r1conf *conf, struct r1bio *r1_bio,return -1 ; } +static bool rdev_in_recovery (struct md_rdev *rdev,struct r1bio *r1_bio) +{ +return !test_bit (In_sync, &rdev->flags) && + rdev->recovery_offset < r1_bio->sector + r1_bio->sectors; +} +static int choose_bb_rdev (struct r1conf *conf,struct r1bio *r1_bio,int *max_sectors) {
@@ -635,6 +641,7 @@ static int choose_bb_rdev(struct r1conf *conf, struct r1bio *r1_bio, rdev = conf->mirrors[disk].rdev;if (!rdev ||test_bit (Faulty, &rdev->flags) || +rdev_in_recovery (rdev, r1_bio) ||test_bit (WriteMostly, &rdev->flags))continue ;
@@ -673,7 +680,8 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, rdev = conf->mirrors[disk].rdev;if (!rdev ||test_bit (Faulty, &rdev->flags) || - !test_bit (WriteMostly, &rdev->flags)) + !test_bit (WriteMostly, &rdev->flags) || +rdev_in_recovery (rdev, r1_bio))continue ;/* there are no bad blocks, we can use this disk */
@@ -733,9 +741,7 @@ static bool rdev_readable(struct md_rdev *rdev, struct r1bio *r1_bio)if (!rdev ||test_bit (Faulty, &rdev->flags))return false; -/* still in recovery */ -if (!test_bit (In_sync, &rdev->flags) && - rdev->recovery_offset < r1_bio->sector + r1_bio->sectors) +if (rdev_in_recovery (rdev, r1_bio))return false;/* don't read from slow disk unless have to */
Signature · 1 line
2.46.0
Greg Kroah-Hartman
maintainerPATCH 46/273 net: mana: Fix RX buf alloc_size alignment and atomic op panic
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haiyang Zhang <[email protected]>
commit 32316f676b4ee87c0404d333d248ccf777f739bc upstream.
The MANA driver's RX buffer alloc_size is passed into napi_build_skb() to create SKB. skb_shinfo(skb) is located at the end of skb, and its alignment is affected by the alloc_size passed into napi_build_skb(). The size needs to be aligned properly for better performance and atomic operations. Otherwise, on ARM64 CPU, for certain MTU settings like 4000, atomic operations may panic on the skb_shinfo(skb)->dataref due to alignment fault.
To fix this bug, add proper alignment to the alloc_size calculation.
Sample panic info:
[ 253.298819] Unable to handle kernel paging request at virtual address ffff000129ba5cce [ 253.300900] Mem abort info: [ 253.301760] ESR = 0x0000000096000021 [ 253.302825] EC = 0x25: DABT (current EL), IL = 32 bits [ 253.304268] SET = 0, FnV = 0 [ 253.305172] EA = 0, S1PTW = 0 [ 253.306103] FSC = 0x21: alignment fault Call trace: __skb_clone+0xfc/0x198 skb_clone+0x78/0xe0 raw6_local_deliver+0xfc/0x228 ip6_protocol_deliver_rcu+0x80/0x500 ip6_input_finish+0x48/0x80 ip6_input+0x48/0xc0 ip6_sublist_rcv_finish+0x50/0x78 ip6_sublist_rcv+0x1cc/0x2b8 ipv6_list_rcv+0x100/0x150 __netif_receive_skb_list_core+0x180/0x220 netif_receive_skb_list_internal+0x198/0x2a8 __napi_poll+0x138/0x250 net_rx_action+0x148/0x330 handle_softirqs+0x12c/0x3a0
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +5 -1
@@ -599,7 +599,11 @@ static void mana_get_rxbuf_cfg(int mtu,else *headroom =XDP_PACKET_HEADROOM ; - *alloc_size = mtu +MANA_RXBUF_PAD + *headroom; + *alloc_size =SKB_DATA_ALIGN (mtu +MANA_RXBUF_PAD + *headroom); + +/* Using page pool in this case, so alloc_size is PAGE_SIZE */ +if (*alloc_size <PAGE_SIZE ) + *alloc_size =PAGE_SIZE ; *datasize = mtu +ETH_HLEN ; }
Greg Kroah-Hartman
maintainerPATCH 47/273 media: atomisp: Fix streaming no longer working on BYT / ISP2400 devices
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 63de936b513f7a9ce559194d3269ac291f4f4662 upstream.
Commit a0821ca14bb8 ("media: atomisp: Remove test pattern generator (TPG) support") broke BYT support because it removed a seemingly unused field from struct sh_css_sp_config and a seemingly unused value from enum ia_css_input_mode.
But these are part of the ABI between the kernel and firmware on ISP2400 and this part of the TPG support removal changes broke ISP2400 support.
ISP2401 support was not affected because on ISP2401 only a part of struct sh_css_sp_config is used.
Restore the removed field and enum value to fix this.
--- drivers/staging/media/atomisp/pci/ia_css_stream_public.h | 8 ++++-- drivers/staging/media/atomisp/pci/sh_css_internal.h | 19 ++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/ia_css_stream_public.h +6 -2
@@ -27,12 +27,16 @@#include "ia_css_prbs.h" #include "ia_css_input_port.h" -/* Input modes, these enumerate all supported input modes. -* Note that not all ISP modes support all input modes. +/* +* Input modes, these enumerate all supported input modes. +* This enum is part of the atomisp firmware ABI and must +* NOT be changed! +* Note that not all ISP modes support all input modes. */ enum ia_css_input_mode {IA_CSS_INPUT_MODE_SENSOR ,/** data from sensor */ IA_CSS_INPUT_MODE_FIFO ,/** data from input-fifo */ +IA_CSS_INPUT_MODE_TPG ,/** data from test-pattern generator */ IA_CSS_INPUT_MODE_PRBS ,/** data from pseudo-random bit stream */ IA_CSS_INPUT_MODE_MEMORY ,/** data from a frame in memory */ IA_CSS_INPUT_MODE_BUFFERED_SENSOR /** data is sent through mipi buffer */
drivers/staging/media/atomisp/pci/sh_css_internal.h +16 -3
@@ -341,7 +341,14 @@ struct sh_css_sp_input_formatter_set {#define IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT (3) -/* SP configuration information */ +/* +* SP configuration information +* +* This struct is part of the atomisp firmware ABI and is directly copied +* to ISP DRAM by sh_css_store_sp_group_to_ddr() +* +* Do NOT change this struct's layout or remove seemingly unused fields! +*/ struct sh_css_sp_config {u8 no_isp_sync;/* Signal host immediately after start */ u8 enable_raw_pool_locking;/** Enable Raw Buffer Locking for HALv3 Support */
@@ -351,6 +358,10 @@ struct sh_css_sp_config {host (true) or when they are passed to the preview/video pipe (false). */ +/* +* Note the fields below are only used on the ISP2400 not on the ISP2401, +* sh_css_store_sp_group_to_ddr() skip copying these when run on the ISP2401. +*/ struct {u8 a_changed;u8 b_changed;
@@ -360,11 +371,13 @@ struct sh_css_sp_config { } input_formatter;sync_generator_cfg_t sync_gen; +tpg_cfg_t tpg;prbs_cfg_t prbs;input_system_cfg_t input_circuit;u8 input_circuit_cfg_changed; -u32 mipi_sizes_for_check[N_CSI_PORTS ][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT ]; -u8 enable_isys_event_queue; +u32 mipi_sizes_for_check[N_CSI_PORTS ][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT ]; +/* These last 2 fields are used on both the ISP2400 and the ISP2401 */ +u8 enable_isys_event_queue;u8 disable_cont_vf; };
Greg Kroah-Hartman
maintainerPATCH 48/273 net: mana: Fix doorbell out of order violation and avoid unnecessary doorbell rings
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 58a63729c957621f1990c3494c702711188ca347 upstream.
After napi_complete_done() is called when NAPI is polling in the current process context, another NAPI may be scheduled and start running in softirq on another CPU and may ring the doorbell before the current CPU does. When combined with unnecessary rings when there is no need to arm the CQ, it triggers error paths in the hardware.
This patch fixes this by calling napi_complete_done() after doorbell rings. It limits the number of unnecessary rings when there is no need to arm. MANA hardware specifies that there must be one doorbell ring every 8 CQ wraparounds. This driver guarantees one doorbell ring as soon as the number of consumed CQEs exceeds 4 CQ wraparounds. In practical workloads, the 4 CQ wraparounds proves to be big enough that it rarely exceeds this limit before all the napi weight is consumed.
To implement this, add a per-CQ counter cq->work_done_since_doorbell, and make sure the CQ is armed as soon as passing 4 wraparounds of the CQ.
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 22 ++++++++++++++-------- include/net/mana/mana.h | 1 + 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +14 -8
@@ -1777,7 +1777,6 @@ static void mana_poll_rx_cq(struct mana_static int mana_cq_handler (void *context,struct gdma_queue *gdma_queue) {struct mana_cq *cq = context; -u8 arm_bit;int w;WARN_ON_ONCE (cq->gdma_cq != gdma_queue);
@@ -1788,16 +1787,23 @@ static int mana_cq_handler(void *contextmana_poll_tx_cq (cq); w = cq->work_done; + cq->work_done_since_doorbell += w; -if (w < cq->budget && -napi_complete_done (&cq->napi, w)) { - arm_bit =SET_ARM_BIT ; - }else { - arm_bit =0 ; +if (w < cq->budget) { +mana_gd_ring_cq (gdma_queue,SET_ARM_BIT ); + cq->work_done_since_doorbell =0 ; +napi_complete_done (&cq->napi, w); + }else if (cq->work_done_since_doorbell > + cq->gdma_cq->queue_size /COMP_ENTRY_SIZE *4 ) { +/* MANA hardware requires at least one doorbell ring every 8 +* wraparounds of CQ even if there is no need to arm the CQ. +* This driver rings the doorbell as soon as we have exceeded +* 4 wraparounds. +*/ +mana_gd_ring_cq (gdma_queue,0 ); + cq->work_done_since_doorbell =0 ; } -mana_gd_ring_cq (gdma_queue, arm_bit); -return w; }
include/net/mana/mana.h +1 -0
@@ -274,6 +274,7 @@ struct mana_cq {/* NAPI data */ struct napi_struct napi;int work_done; +int work_done_since_doorbell;int budget; };
Greg Kroah-Hartman
maintainerPATCH 49/273 wifi: brcmfmac: cfg80211: Handle SSID based pmksa deletion
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janne Grunau <[email protected]>
commit 2ad4e1ada8eebafa2d75a4b75eeeca882de6ada1 upstream.
wpa_supplicant 2.11 sends since 1efdba5fdc2c ("Handle PMKSA flush in the driver for SAE/OWE offload cases") SSID based PMKSA del commands. brcmfmac is not prepared and tries to dereference the NULL bssid and pmkid pointers in cfg80211_pmksa. PMKID_V3 operations support SSID based updates so copy the SSID.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 13 +++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +10 -3
@@ -4320,9 +4320,16 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp,/* Single PMK operation */ pmk_op->count =cpu_to_le16 (1 ); length +=sizeof (struct brcmf_pmksa_v3 ); -memcpy (pmk_op->pmk[0 ].bssid, pmksa->bssid,ETH_ALEN ); -memcpy (pmk_op->pmk[0 ].pmkid, pmksa->pmkid,WLAN_PMKID_LEN ); - pmk_op->pmk[0 ].pmkid_len =WLAN_PMKID_LEN ; +if (pmksa->bssid) +memcpy (pmk_op->pmk[0 ].bssid, pmksa->bssid,ETH_ALEN ); +if (pmksa->pmkid) { +memcpy (pmk_op->pmk[0 ].pmkid, pmksa->pmkid,WLAN_PMKID_LEN ); + pmk_op->pmk[0 ].pmkid_len =WLAN_PMKID_LEN ; + } +if (pmksa->ssid && pmksa->ssid_len) { +memcpy (pmk_op->pmk[0 ].ssid.SSID, pmksa->ssid, pmksa->ssid_len); + pmk_op->pmk[0 ].ssid.SSID_len = pmksa->ssid_len; + } pmk_op->pmk[0 ].time_left =cpu_to_le32 (alive ?BRCMF_PMKSA_NO_EXPIRY :0 ); }
Greg Kroah-Hartman
maintainerPATCH 50/273 fs/netfs/fscache_cookie: add missing "n_accesses" check
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Kellermann <[email protected]>
commit f71aa06398aabc2e3eaac25acdf3d62e0094ba70 upstream.
This fixes a NULL pointer dereference bug due to a data race which looks like this:
BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 33 PID: 16573 Comm: kworker/u97:799 Not tainted 6.8.7-cm4all1-hp+ #43 Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 10/17/2018 Workqueue: events_unbound netfs_rreq_write_to_cache_work RIP: 0010:cachefiles_prepare_write+0x30/0xa0 Code: 57 41 56 45 89 ce 41 55 49 89 cd 41 54 49 89 d4 55 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 7f 10 00 48 89 34 24 48 8b 68 20 <48> 8b 45 08 4c 8b 38 74 45 49 8b 7f 50 e8 4e a9 b0 ff 48 8b 73 10 RSP: 0018:ffffb4e78113bde0 EFLAGS: 00010286 RAX: ffff976126be6d10 RBX: ffff97615cdb8438 RCX: 0000000000020000 RDX: ffff97605e6c4c68 RSI: ffff97605e6c4c60 RDI: ffff97615cdb8438 RBP: 0000000000000000 R08: 0000000000278333 R09: 0000000000000001 R10: ffff97605e6c4600 R11: 0000000000000001 R12: ffff97605e6c4c68 R13: 0000000000020000 R14: 0000000000000001 R15: ffff976064fe2c00 FS: 0000000000000000(0000) GS:ffff9776dfd40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 000000005942c002 CR4: 00000000001706f0 Call Trace: <TASK> ? __die+0x1f/0x70 ? page_fault_oops+0x15d/0x440 ? search_module_extables+0xe/0x40 ? fixup_exception+0x22/0x2f0 ? exc_page_fault+0x5f/0x100 ? asm_exc_page_fault+0x22/0x30 ? cachefiles_prepare_write+0x30/0xa0 netfs_rreq_write_to_cache_work+0x135/0x2e0 process_one_work+0x137/0x2c0 worker_thread+0x2e9/0x400 ? __pfx_worker_thread+0x10/0x10 kthread+0xcc/0x100 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x30/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK> Modules linked in: CR2: 0000000000000008 ---[ end trace 0000000000000000 ]---
This happened because fscache_cookie_state_machine() was slow and was still running while another process invoked fscache_unuse_cookie(); this led to a fscache_cookie_lru_do_one() call, setting the FSCACHE_COOKIE_DO_LRU_DISCARD flag, which was picked up by fscache_cookie_state_machine(), withdrawing the cookie via cachefiles_withdraw_cookie(), clearing cookie->cache_priv.
At the same time, yet another process invoked cachefiles_prepare_write(), which found a NULL pointer in this code line:
struct cachefiles_object *object = cachefiles_cres_object(cres);
The next line crashes, obviously:
struct cachefiles_cache *cache = object->volume->cache;
During cachefiles_prepare_write(), the "n_accesses" counter is non-zero (via fscache_begin_operation()). The cookie must not be withdrawn until it drops to zero.
The counter is checked by fscache_cookie_state_machine() before switching to FSCACHE_COOKIE_STATE_RELINQUISHING and FSCACHE_COOKIE_STATE_WITHDRAWING (in "case FSCACHE_COOKIE_STATE_FAILED"), but not for FSCACHE_COOKIE_STATE_LRU_DISCARDING ("case FSCACHE_COOKIE_STATE_ACTIVE").
This patch adds the missing check. With a non-zero access counter, the function returns and the next fscache_end_cookie_access() call will queue another fscache_cookie_state_machine() call to handle the still-pending FSCACHE_COOKIE_DO_LRU_DISCARD.
--- fs/netfs/fscache_cookie.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/netfs/fscache_cookie.c +4 -0
@@ -741,6 +741,10 @@ again_locked:spin_lock (&cookie->lock); }if (test_bit (FSCACHE_COOKIE_DO_LRU_DISCARD , &cookie->flags)) { +if (atomic_read (&cookie->n_accesses) !=0 ) +/* still being accessed: postpone it */ +break ; +__fscache_set_cookie_state (cookie,FSCACHE_COOKIE_STATE_LRU_DISCARDING ); wake = true;
Greg Kroah-Hartman
maintainerPATCH 51/273 selinux: fix potential counting error in avc_add_xperms_decision()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Lei <[email protected]>
commit 379d9af3f3da2da1bbfa67baf1820c72a080d1f1 upstream.
The count increases only when a node is successfully added to the linked list.
--- security/selinux/avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/avc.c +1 -1
@@ -330,12 +330,12 @@ static int avc_add_xperms_decision(struc {struct avc_xperms_decision_node *dest_xpd; - node->ae.xp_node->xp.len++; dest_xpd =avc_xperms_decision_alloc (src->used);if (!dest_xpd)return -ENOMEM ;avc_copy_xperms_decision (&dest_xpd->xpd, src);list_add (&dest_xpd->xpd_list, &node->ae.xp_node->xpd_head); + node->ae.xp_node->xp.len++;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 52/273 selinux: add the processing of the failure of avc_add_xperms_decision()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Lei <[email protected]>
commit 6dd1e4c045afa6a4ba5d46f044c83bd357c593c2 upstream.
When avc_add_xperms_decision() fails, the information recorded by the new avc node is incomplete. In this case, the new avc node should be released instead of replacing the old avc node.
--- security/selinux/avc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
security/selinux/avc.c +5 -1
@@ -907,7 +907,11 @@ static int avc_update_node(u32 event, u3 node->ae.avd.auditdeny &= ~perms;break ;case AVC_CALLBACK_ADD_XPERMS : -avc_add_xperms_decision (node, xpd); + rc =avc_add_xperms_decision (node, xpd); +if (rc) { +avc_node_kill (node); + goto out_unlock; + }break ; }avc_node_replace (node, orig);
Greg Kroah-Hartman
maintainerPATCH 53/273 alloc_tag: mark pages reserved during CMA activation as not tagged
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suren Baghdasaryan <[email protected]>
commit 766c163c2068b45330664fb67df67268e588a22d upstream.
During CMA activation, pages in CMA area are prepared and then freed without being allocated. This triggers warnings when memory allocation debug config (CONFIG_MEM_ALLOC_PROFILING_DEBUG) is enabled. Fix this by marking these pages not tagged before freeing them.
--- mm/mm_init.c | 2 ++ 1 file changed, 2 insertions(+)
mm/mm_init.c +2 -0
@@ -2293,6 +2293,8 @@ void __init init_cma_reserved_pageblock(set_pageblock_migratetype (page,MIGRATE_CMA );set_page_refcounted (page); +/* pages were reserved and not allocated */ +clear_page_tag_ref (page);__free_pages (page, pageblock_order);adjust_managed_page_count (page, pageblock_nr_pages);
Greg Kroah-Hartman
maintainerPATCH 54/273 mm/memory-failure: use raw_spinlock_t in struct memory_failure_cpu
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
commit d75abd0d0bc29e6ebfebbf76d11b4067b35844af upstream.
The memory_failure_cpu structure is a per-cpu structure. Access to its content requires the use of get_cpu_var() to lock in the current CPU and disable preemption. The use of a regular spinlock_t for locking purpose is fine for a non-RT kernel.
Since the integration of RT spinlock support into the v5.15 kernel, a spinlock_t in a RT kernel becomes a sleeping lock and taking a sleeping lock in a preemption disabled context is illegal resulting in the following kind of warning.
[12135.732244] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
[12135.732248] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 270076, name: kworker/0:0
[12135.732252] preempt_count: 1, expected: 0
[12135.732255] RCU nest depth: 2, expected: 2
:
[12135.732420] Hardware name: Dell Inc. PowerEdge R640/0HG0J8, BIOS 2.10.2 02/24/2021
[12135.732423] Workqueue: kacpi_notify acpi_os_execute_deferred
[12135.732433] Call Trace:
[12135.732436] <TASK>
[12135.732450] dump_stack_lvl+0x57/0x81
[12135.732461] __might_resched.cold+0xf4/0x12f
[12135.732479] rt_spin_lock+0x4c/0x100
[12135.732491] memory_failure_queue+0x40/0xe0
[12135.732503] ghes_do_memory_failure+0x53/0x390
[12135.732516] ghes_do_proc.constprop.0+0x229/0x3e0
[12135.732575] ghes_proc+0xf9/0x1a0
[12135.732591] ghes_notify_hed+0x6a/0x150
[12135.732602] notifier_call_chain+0x43/0xb0
[12135.732626] blocking_notifier_call_chain+0x43/0x60
[12135.732637] acpi_ev_notify_dispatch+0x47/0x70
[12135.732648] acpi_os_execute_deferred+0x13/0x20
[12135.732654] process_one_work+0x41f/0x500
[12135.732695] worker_thread+0x192/0x360
[12135.732715] kthread+0x111/0x140
[12135.732733] ret_from_fork+0x29/0x50
[12135.732779] </TASK>Fix it by using a raw_spinlock_t for locking instead.
Also move the pr_err() out of the lock critical section and after put_cpu_ptr() to avoid indeterminate latency and the possibility of sleep with this call.
--- mm/memory-failure.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
mm/memory-failure.c +11 -9
@@ -2406,7 +2406,7 @@ struct memory_failure_entry {struct memory_failure_cpu { DECLARE_KFIFO(fifo, struct memory_failure_entry, MEMORY_FAILURE_FIFO_SIZE); -spinlock_t lock; +raw_spinlock_t lock;struct work_struct work; };
@@ -2432,20 +2432,22 @@ void memory_failure_queue(unsigned long {struct memory_failure_cpu *mf_cpu;unsigned long proc_flags; +bool buffer_overflow;struct memory_failure_entry entry = { .pfn = pfn, .flags = flags, }; mf_cpu = &get_cpu_var (memory_failure_cpu); -spin_lock_irqsave (&mf_cpu->lock, proc_flags); -if (kfifo_put (&mf_cpu->fifo, entry)) +raw_spin_lock_irqsave (&mf_cpu->lock, proc_flags); + buffer_overflow = !kfifo_put (&mf_cpu->fifo, entry); +if (!buffer_overflow)schedule_work_on (smp_processor_id (), &mf_cpu->work); -else +raw_spin_unlock_irqrestore (&mf_cpu->lock, proc_flags); +put_cpu_var (memory_failure_cpu); +if (buffer_overflow)pr_err ("buffer overflow when queuing memory failure at %#lx\n" , pfn); -spin_unlock_irqrestore (&mf_cpu->lock, proc_flags); -put_cpu_var (memory_failure_cpu); }EXPORT_SYMBOL_GPL (memory_failure_queue);
@@ -2458,9 +2460,9 @@ static void memory_failure_work_func(str mf_cpu = container_of(work, struct memory_failure_cpu, work);for (;;) { -spin_lock_irqsave (&mf_cpu->lock, proc_flags); +raw_spin_lock_irqsave (&mf_cpu->lock, proc_flags); gotten =kfifo_get (&mf_cpu->fifo, &entry); -spin_unlock_irqrestore (&mf_cpu->lock, proc_flags); +raw_spin_unlock_irqrestore (&mf_cpu->lock, proc_flags);if (!gotten)break ;if (entry.flags &MF_SOFT_OFFLINE )
@@ -2490,7 +2492,7 @@ static int __init memory_failure_init(vofor_each_possible_cpu (cpu) { mf_cpu = &per_cpu (memory_failure_cpu, cpu); -spin_lock_init (&mf_cpu->lock); +raw_spin_lock_init (&mf_cpu->lock);INIT_KFIFO (mf_cpu->fifo);INIT_WORK (&mf_cpu->work, memory_failure_work_func); }
Greg Kroah-Hartman
maintainerPATCH 55/273 selftests: memfd_secret: dont build memfd_secret test on unsupported arches
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Usama Anjum <[email protected]>
commit 7c5e8d212d7d81991a580e7de3904ea213d9a852 upstream.
[1] mentions that memfd_secret is only supported on arm64, riscv, x86 and x86_64 for now. It doesn't support other architectures. I found the build error on arm and decided to send the fix as it was creating noise on KernelCI:
memfd_secret.c: In function 'memfd_secret':
memfd_secret.c:42:24: error: '__NR_memfd_secret' undeclared (first use in this function); did you mean 'memfd_secret'?
42 | return syscall(__NR_memfd_secret, flags);
| ^~~~~~~~~~~~~~~~~
| memfd_secretHence I'm adding condition that memfd_secret should only be compiled on supported architectures.
Also check in run_vmtests script if memfd_secret binary is present before executing it.
--- tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 3 +++ 2 files changed, 5 insertions(+)
tools/testing/selftests/mm/Makefile +2 -0
@@ -51,7 +51,9 @@ TEST_GEN_FILES += madv_populate TEST_GEN_FILES += map_fixed_noreplace TEST_GEN_FILES += map_hugetlb TEST_GEN_FILES += map_populate +ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64)) TEST_GEN_FILES += memfd_secret +endif TEST_GEN_FILES += migration TEST_GEN_FILES += mkdirty TEST_GEN_FILES += mlock-random-test
tools/testing/selftests/mm/run_vmtests.sh +3 -0
@@ -367,8 +367,11 @@ CATEGORY="hmm" run_test bash ./test_hmm. # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests CATEGORY="madv_populate" run_test ./madv_populate +if [ -x ./memfd_secret ] +then (echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix CATEGORY="memfd_secret" run_test ./memfd_secret +fi # KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100 CATEGORY="ksm" run_test ./ksm_tests -H -s 100
Greg Kroah-Hartman
maintainerPATCH 56/273 alloc_tag: introduce clear_page_tag_ref() helper function
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suren Baghdasaryan <[email protected]>
commit a8fc28dad6d574582cdf2f7e78c73c59c623df30 upstream.
In several cases we are freeing pages which were not allocated using common page allocators. For such cases, in order to keep allocation accounting correct, we should clear the page tag to indicate that the page being freed is expected to not have a valid allocation tag. Introduce clear_page_tag_ref() helper function to be used for this.
--- include/linux/pgalloc_tag.h | 13 +++++++++++++ mm/mm_init.c | 10 +--------- mm/page_alloc.c | 9 +-------- 3 files changed, 15 insertions(+), 17 deletions(-)
include/linux/pgalloc_tag.h +13 -0
@@ -43,6 +43,18 @@ static inline void put_page_tag_ref(uniopage_ext_put (page_ext_from_codetag_ref (ref)); } +static inline void clear_page_tag_ref (struct page *page) +{ +if (mem_alloc_profiling_enabled ()) { +union codetag_ref *ref =get_page_tag_ref (page); + +if (ref) { +set_codetag_empty (ref); +put_page_tag_ref (ref); + } + } +} +static inline void pgalloc_tag_add (struct page *page,struct task_struct *task,unsigned int nr) {
@@ -126,6 +138,7 @@ static inline void pgalloc_tag_sub_pagesstatic inline union codetag_ref *get_page_tag_ref (struct page *page) {return NULL ; }static inline void put_page_tag_ref (union codetag_ref *ref) {} +static inline void clear_page_tag_ref (struct page *page) {}static inline void pgalloc_tag_add (struct page *page,struct task_struct *task,unsigned int nr) {}static inline void pgalloc_tag_sub (struct page *page,unsigned int nr) {}
mm/mm_init.c +1 -9
@@ -2507,15 +2507,7 @@ void __init memblock_free_pages(struct p }/* pages were reserved and not allocated */ -if (mem_alloc_profiling_enabled ()) { -union codetag_ref *ref =get_page_tag_ref (page); - -if (ref) { -set_codetag_empty (ref); -put_page_tag_ref (ref); - } - } - +clear_page_tag_ref (page);__free_pages_core (page, order); }
mm/page_alloc.c +1 -8
@@ -5806,14 +5806,7 @@ unsigned long free_reserved_area(void *svoid free_reserved_page (struct page *page) { -if (mem_alloc_profiling_enabled ()) { -union codetag_ref *ref =get_page_tag_ref (page); - -if (ref) { -set_codetag_empty (ref); -put_page_tag_ref (ref); - } - } +clear_page_tag_ref (page);ClearPageReserved (page);init_page_count (page);__free_page (page);
Greg Kroah-Hartman
maintainerPATCH 57/273 mm/numa: no task_numa_fault() call if PMD is changed
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zi Yan <[email protected]>
commit fd8c35a92910f4829b7c99841f39b1b952c259d5 upstream.
When handling a numa page fault, task_numa_fault() should be called by a process that restores the page table of the faulted folio to avoid duplicated stats counting. Commit c5b5a3dd2c1f ("mm: thp: refactor NUMA fault handling") restructured do_huge_pmd_numa_page() and did not avoid task_numa_fault() call in the second page table check after a numa migration failure. Fix it by making all !pmd_same() return immediately.
This issue can cause task_numa_fault() being called more than necessary and lead to unexpected numa balancing results (It is hard to tell whether the issue will cause positive or negative performance impact due to duplicated numa fault counting).
--- mm/huge_memory.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
mm/huge_memory.c +13 -16
@@ -1672,7 +1672,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vmf->ptl =pmd_lock (vma->vm_mm, vmf->pmd);if (unlikely (!pmd_same (oldpmd, *vmf->pmd))) {spin_unlock (vmf->ptl); - goto out; +return 0 ; } pmd =pmd_modify (oldpmd, vma->vm_page_prot);
@@ -1715,22 +1715,16 @@ vm_fault_t do_huge_pmd_numa_page(structif (!migrate_misplaced_folio (folio, vma, target_nid)) { flags |=TNF_MIGRATED ; nid = target_nid; - }else { - flags |=TNF_MIGRATE_FAIL ; - vmf->ptl =pmd_lock (vma->vm_mm, vmf->pmd); -if (unlikely (!pmd_same (oldpmd, *vmf->pmd))) { -spin_unlock (vmf->ptl); - goto out; - } - goto out_map; - } - -out: -if (nid !=NUMA_NO_NODE )task_numa_fault (last_cpupid, nid,HPAGE_PMD_NR , flags); +return 0 ; + } -return 0 ; - + flags |=TNF_MIGRATE_FAIL ; + vmf->ptl =pmd_lock (vma->vm_mm, vmf->pmd); +if (unlikely (!pmd_same (oldpmd, *vmf->pmd))) { +spin_unlock (vmf->ptl); +return 0 ; + } out_map:/* Restore the PMD */ pmd =pmd_modify (oldpmd, vma->vm_page_prot);
@@ -1740,7 +1734,10 @@ out_map:set_pmd_at (vma->vm_mm, haddr, vmf->pmd, pmd);update_mmu_cache_pmd (vma, vmf->address, vmf->pmd);spin_unlock (vmf->ptl); - goto out; + +if (nid !=NUMA_NO_NODE ) +task_numa_fault (last_cpupid, nid,HPAGE_PMD_NR , flags); +return 0 ; }/*
Greg Kroah-Hartman
maintainerPATCH 58/273 mm/vmalloc: fix page mapping if vm_area_alloc_pages() with high order fallback to order 0
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hailong Liu <[email protected]>
commit 61ebe5a747da649057c37be1c37eb934b4af79ca upstream.
The __vmap_pages_range_noflush() assumes its argument pages** contains pages with the same page shift. However, since commit e9c3cda4d86e ("mm,
vmalloc: fix high order __GFP_NOFAIL allocations"), if gfp_flags includes __GFP_NOFAIL with high order in vm_area_alloc_pages() and page allocation failed for high order, the pages** may contain two different page shifts (high order and order-0). This could lead __vmap_pages_range_noflush() to perform incorrect mappings, potentially resulting in memory corruption.
Users might encounter this as follows (vmap_allow_huge = true, 2M is for PMD_SIZE):
kvmalloc(2M, __GFP_NOFAIL|GFP_X)
__vmalloc_node_range_noprof(vm_flags=VM_ALLOW_HUGE_VMAP)
vm_area_alloc_pages(order=9) ---> order-9 allocation failed and fallback to order-0
vmap_pages_range()
vmap_pages_range_noflush()
__vmap_pages_range_noflush(page_shift = 21) ----> wrong mapping happensWe can remove the fallback code because if a high-order allocation fails, __vmalloc_node_range_noprof() will retry with order-0. Therefore, it is unnecessary to fallback to order-0 here. Therefore, fix this by removing the fallback code.
--- mm/vmalloc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
mm/vmalloc.c +2 -9
@@ -3583,15 +3583,8 @@ vm_area_alloc_pages(gfp_t gfp, int nid, page =alloc_pages_noprof (alloc_gfp, order); else page =alloc_pages_node_noprof (nid, alloc_gfp, order); -if (unlikely (!page)) { -if (!nofail) -break ; - -/* fall back to the zero order allocations */ - alloc_gfp |= __GFP_NOFAIL; - order =0 ; -continue ; - } +if (unlikely (!page)) +break ;/* * Higher order allocations must be able to be treated as
Greg Kroah-Hartman
maintainerPATCH 59/273 mm/numa: no task_numa_fault() call if PTE is changed
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zi Yan <[email protected]>
commit 40b760cfd44566bca791c80e0720d70d75382b84 upstream.
When handling a numa page fault, task_numa_fault() should be called by a process that restores the page table of the faulted folio to avoid duplicated stats counting. Commit b99a342d4f11 ("NUMA balancing: reduce TLB flush via delaying mapping on hint page fault") restructured do_numa_page() and did not avoid task_numa_fault() call in the second page table check after a numa migration failure. Fix it by making all !pte_same() return immediately.
This issue can cause task_numa_fault() being called more than necessary and lead to unexpected numa balancing results (It is hard to tell whether the issue will cause positive or negative performance impact due to duplicated numa fault counting).
--- mm/memory.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
mm/memory.c +16 -17
@@ -5155,7 +5155,7 @@ static vm_fault_t do_numa_page(struct vmif (unlikely (!pte_same (old_pte, vmf->orig_pte))) {pte_unmap_unlock (vmf->pte, vmf->ptl); - goto out; +return 0 ; } pte =pte_modify (old_pte, vma->vm_page_prot);
@@ -5218,23 +5218,19 @@ static vm_fault_t do_numa_page(struct vmif (!migrate_misplaced_folio (folio, vma, target_nid)) { nid = target_nid; flags |=TNF_MIGRATED ; - }else { - flags |=TNF_MIGRATE_FAIL ; - vmf->pte =pte_offset_map_lock (vma->vm_mm, vmf->pmd, - vmf->address, &vmf->ptl); -if (unlikely (!vmf->pte)) - goto out; -if (unlikely (!pte_same (ptep_get (vmf->pte), vmf->orig_pte))) { -pte_unmap_unlock (vmf->pte, vmf->ptl); - goto out; - } - goto out_map; +task_numa_fault (last_cpupid, nid, nr_pages, flags); +return 0 ; } -out: -if (nid !=NUMA_NO_NODE ) -task_numa_fault (last_cpupid, nid, nr_pages, flags); -return 0 ; + flags |=TNF_MIGRATE_FAIL ; + vmf->pte =pte_offset_map_lock (vma->vm_mm, vmf->pmd, + vmf->address, &vmf->ptl); +if (unlikely (!vmf->pte)) +return 0 ; +if (unlikely (!pte_same (ptep_get (vmf->pte), vmf->orig_pte))) { +pte_unmap_unlock (vmf->pte, vmf->ptl); +return 0 ; + } out_map:/* * Make it present again, depending on how arch implements
@@ -5247,7 +5243,10 @@ out_map:numa_rebuild_single_mapping (vmf, vma, vmf->address, vmf->pte, writable);pte_unmap_unlock (vmf->pte, vmf->ptl); - goto out; + +if (nid !=NUMA_NO_NODE ) +task_numa_fault (last_cpupid, nid, nr_pages, flags); +return 0 ; }static inline vm_fault_t create_huge_pmd (struct vm_fault *vmf)
Greg Kroah-Hartman
maintainerPATCH 60/273 btrfs: tree-checker: reject BTRFS_FT_UNKNOWN dir type
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 31723c9542dba1681cc3720571fdf12ffe0eddd9 upstream.
[REPORT]
There is a bug report that kernel is rejecting a mismatching inode mode and its dir item:
[ 1881.553937] BTRFS critical (device dm-0): inode mode mismatch with dir: inode mode=040700 btrfs type=2 dir type=0
[CAUSE]
It looks like the inode mode is correct, while the dir item type 0 is BTRFS_FT_UNKNOWN, which should not be generated by btrfs at all.
This may be caused by a memory bit flip.
[ENHANCEMENT]
Although tree-checker is not able to do any cross-leaf verification, for this particular case we can at least reject any dir type with BTRFS_FT_UNKNOWN.
So here we enhance the dir type check from [0, BTRFS_FT_MAX), to (0, BTRFS_FT_MAX).
Although the existing corruption can not be fixed just by such enhanced checking, it should prevent the same 0x2->0x0 bitflip for dir type to reach disk in the future.
--- fs/btrfs/tree-checker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/tree-checker.c +3 -2
@@ -551,9 +551,10 @@ static int check_dir_item(struct extent_/* dir type check */ dir_type =btrfs_dir_ftype (leaf, di); -if (unlikely (dir_type >=BTRFS_FT_MAX )) { +if (unlikely (dir_type <=BTRFS_FT_UNKNOWN || + dir_type >=BTRFS_FT_MAX )) {dir_item_err (leaf, slot, -"invalid dir item type, have %u expect [0, %u)" , +"invalid dir item type, have %u expect (0, %u)" , dir_type,BTRFS_FT_MAX );return -EUCLEAN ; }
Greg Kroah-Hartman
maintainerPATCH 61/273 btrfs: send: allow cloning non-aligned extent if it ends at i_size
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 46a6e10a1ab16cc71d4a3cab73e79aabadd6b8ea upstream.
If we a find that an extent is shared but its end offset is not sector size aligned, then we don't clone it and issue write operations instead. This is because the reflink (remap_file_range) operation does not allow to clone unaligned ranges, except if the end offset of the range matches the i_size of the source and destination files (and the start offset is sector size aligned).
While this is not incorrect because send can only guarantee that a file has the same data in the source and destination snapshots, it's not optimal and generates confusion and surprising behaviour for users.
For example, running this test:
$ cat test.sh #!/bin/bash
DEV=/dev/sdi
MNT=/mnt/sdi
mkfs.btrfs -f $DEV
mount $DEV $MNT
# Use a file size not aligned to any possible sector size. file_size=$((1 * 1024 * 1024 + 5)) # 1MB + 5 bytes dd if=/dev/random of=$MNT/foo bs=$file_size count=1 cp --reflink=always $MNT/foo $MNT/bar
btrfs subvolume snapshot -r $MNT/ $MNT/snap
rm -f /tmp/send-test
btrfs send -f /tmp/send-test $MNT/snap
umount $MNT
mkfs.btrfs -f $DEV
mount $DEV $MNT
btrfs receive -vv -f /tmp/send-test $MNT
xfs_io -r -c "fiemap -v" $MNT/snap/bar
umount $MNT
Gives the following result:
(...)
mkfile o258-7-0
rename o258-7-0 -> bar
write bar - offset=0 length=49152
write bar - offset=49152 length=49152
write bar - offset=98304 length=49152
write bar - offset=147456 length=49152
write bar - offset=196608 length=49152
write bar - offset=245760 length=49152
write bar - offset=294912 length=49152
write bar - offset=344064 length=49152
write bar - offset=393216 length=49152
write bar - offset=442368 length=49152
write bar - offset=491520 length=49152
write bar - offset=540672 length=49152
write bar - offset=589824 length=49152
write bar - offset=638976 length=49152
write bar - offset=688128 length=49152
write bar - offset=737280 length=49152
write bar - offset=786432 length=49152
write bar - offset=835584 length=49152
write bar - offset=884736 length=49152
write bar - offset=933888 length=49152
write bar - offset=983040 length=49152
write bar - offset=1032192 length=16389
chown bar - uid=0, gid=0
chmod bar - mode=0644
utimes bar
utimes
BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=06d640da-9ca1-604c-b87c-3375175a8eb3, stransid=7 /mnt/sdi/snap/bar:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..2055]: 26624..28679 2056 0x1
There's no clone operation to clone extents from the file foo into file bar and fiemap confirms there's no shared flag (0x2000).
So update send_write_or_clone() so that it proceeds with cloning if the source and destination ranges end at the i_size of the respective files.
After this changes the result of the test is:
(...)
mkfile o258-7-0
rename o258-7-0 -> bar
clone bar - source=foo source offset=0 offset=0 length=1048581
chown bar - uid=0, gid=0
chmod bar - mode=0644
utimes bar
utimes
BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=582420f3-ea7d-564e-bbe5-ce440d622190, stransid=7 /mnt/sdi/snap/bar:
EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
0: [0..2055]: 26624..28679 2056 0x2001
A test case for fstests will also follow up soon.
--- fs/btrfs/send.c | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 14 deletions(-)
fs/btrfs/send.c +40 -14
@@ -6158,25 +6158,51 @@ static int send_write_or_clone(struct seu64 offset = key->offset;u64 end;u64 bs = sctx->send_root->fs_info->sectorsize; +struct btrfs_file_extent_item *ei; +u64 disk_byte; +u64 data_offset; +u64 num_bytes; +struct btrfs_inode_info info = {0 }; end =min_t (u64,btrfs_file_extent_end (path), sctx->cur_inode_size);if (offset >= end)return 0 ; -if (clone_root &&IS_ALIGNED (end, bs)) { -struct btrfs_file_extent_item *ei; -u64 disk_byte; -u64 data_offset; - - ei =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], - struct btrfs_file_extent_item); - disk_byte =btrfs_file_extent_disk_bytenr (path->nodes[0 ], ei); - data_offset =btrfs_file_extent_offset (path->nodes[0 ], ei); - ret =clone_range (sctx, path, clone_root, disk_byte, - data_offset, offset, end - offset); - }else { - ret =send_extent_data (sctx, path, offset, end - offset); - } + num_bytes = end - offset; + +if (!clone_root) + goto write_data; + +if (IS_ALIGNED (end, bs)) + goto clone_data; + +/* +* If the extent end is not aligned, we can clone if the extent ends at +* the i_size of the inode and the clone range ends at the i_size of the +* source inode, otherwise the clone operation fails with -EINVAL. +*/ +if (end != sctx->cur_inode_size) + goto write_data; + + ret =get_inode_info (clone_root->root, clone_root->ino, &info); +if (ret <0 ) +return ret; + +if (clone_root->offset + num_bytes == info.size) + goto clone_data; + +write_data: + ret =send_extent_data (sctx, path, offset, num_bytes); + sctx->cur_inode_next_write_offset = end; +return ret; + +clone_data: + ei =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], + struct btrfs_file_extent_item); + disk_byte =btrfs_file_extent_disk_bytenr (path->nodes[0 ], ei); + data_offset =btrfs_file_extent_offset (path->nodes[0 ], ei); + ret =clone_range (sctx, path, clone_root, disk_byte, data_offset, offset, + num_bytes); sctx->cur_inode_next_write_offset = end;return ret; }
Greg Kroah-Hartman
maintainerPATCH 62/273 btrfs: check delayed refs when were checking if a ref exists
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 42fac187b5c746227c92d024f1caf33bc1d337e4 upstream.
In the patch 78c52d9eb6b7 ("btrfs: check for refs on snapshot delete resume") I added some code to handle file systems that had been corrupted by a bug that incorrectly skipped updating the drop progress key while dropping a snapshot. This code would check to see if we had already deleted our reference for a child block, and skip the deletion if we had already.
Unfortunately there is a bug, as the check would only check the on-disk references. I made an incorrect assumption that blocks in an already deleted snapshot that was having the deletion resume on mount wouldn't be modified.
If we have 2 pending deleted snapshots that share blocks, we can easily modify the rules for a block. Take the following example
subvolume a exists, and subvolume b is a snapshot of subvolume a. They share references to block 1. Block 1 will have 2 full references, one for subvolume a and one for subvolume b, and it belongs to subvolume a (btrfs_header_owner(block 1) == subvolume a).
When deleting subvolume a, we will drop our full reference for block 1, and because we are the owner we will drop our full reference for all of block 1's children, convert block 1 to FULL BACKREF, and add a shared reference to all of block 1's children.
Then we will start the snapshot deletion of subvolume b. We look up the extent info for block 1, which checks delayed refs and tells us that FULL BACKREF is set, so sets parent to the bytenr of block 1. However because this is a resumed snapshot deletion, we call into check_ref_exists(). Because check_ref_exists() only looks at the disk, it doesn't find the shared backref for the child of block 1, and thus returns 0 and we skip deleting the reference for the child of block 1 and continue. This orphans the child of block 1.
The fix is to lookup the delayed refs, similar to what we do in btrfs_lookup_extent_info(). However we only care about whether the reference exists or not. If we fail to find our reference on disk, go look up the bytenr in the delayed refs, and if it exists look for an existing ref in the delayed ref head. If that exists then we know we can delete the reference safely and carry on. If it doesn't exist we know we have to skip over this block.
This bug has existed since I introduced this fix, however requires having multiple deleted snapshots pending when we unmount. We noticed this in production because our shutdown path stops the container on the system, which deletes a bunch of subvolumes, and then reboots the box. This gives us plenty of opportunities to hit this issue. Looking at the history we've seen this occasionally in production, but we had a big spike recently thanks to faster machines getting jobs with multiple subvolumes in the job.
Chris Mason wrote a reproducer which does the following
mount /dev/nvme4n1 /btrfs
btrfs subvol create /btrfs/s1
simoop -E -f 4k -n 200000 -z /btrfs/s1
while(true) ; do
btrfs subvol snap /btrfs/s1 /btrfs/s2
simoop -f 4k -n 200000 -r 10 -z /btrfs/s2
btrfs subvol snap /btrfs/s2 /btrfs/s3
btrfs balance start -dusage=80 /btrfs
btrfs subvol del /btrfs/s2 /btrfs/s3
umount /btrfs
btrfsck /dev/nvme4n1 || exit 1
mount /dev/nvme4n1 /btrfs
done
On the second loop this would fail consistently, with my patch it has been running for hours and hasn't failed.
I also used dm-log-writes to capture the state of the failure so I could debug the problem. Using the existing failure case to test my patch validated that it fixes the problem.
--- fs/btrfs/delayed-ref.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ fs/btrfs/delayed-ref.h | 2 + fs/btrfs/extent-tree.c | 51 ++++++++++++++++++++++++++++++++----- 3 files changed, 114 insertions(+), 6 deletions(-)
fs/btrfs/delayed-ref.c +67 -0
@@ -1169,6 +1169,73 @@ btrfs_find_delayed_ref_head(struct btrfsreturn find_ref_head (delayed_refs, bytenr, false); } +static int find_comp (struct btrfs_delayed_ref_node *entry,u64 root,u64 parent) +{ +int type = parent ?BTRFS_SHARED_BLOCK_REF_KEY :BTRFS_TREE_BLOCK_REF_KEY ; + +if (type < entry->type) +return -1 ; +if (type > entry->type) +return 1 ; + +if (type ==BTRFS_TREE_BLOCK_REF_KEY ) { +if (root < entry->ref_root) +return -1 ; +if (root > entry->ref_root) +return 1 ; + }else { +if (parent < entry->parent) +return -1 ; +if (parent > entry->parent) +return 1 ; + } +return 0 ; +} + +/* +* Check to see if a given root/parent reference is attached to the head. This +* only checks for BTRFS_ADD_DELAYED_REF references that match, as that +* indicates the reference exists for the given root or parent. This is for +* tree blocks only. +* +* @head: the head of the bytenr we're searching. +* @root: the root objectid of the reference if it is a normal reference. +* @parent: the parent if this is a shared backref. +*/ +bool btrfs_find_delayed_tree_ref (struct btrfs_delayed_ref_head *head, +u64 root,u64 parent) +{ +struct rb_node *node; +bool found = false; + +lockdep_assert_held (&head->mutex); + +spin_lock (&head->lock); + node = head->ref_tree.rb_root.rb_node; +while (node) { +struct btrfs_delayed_ref_node *entry; +int ret; + + entry = rb_entry(node, struct btrfs_delayed_ref_node, ref_node); + ret =find_comp (entry, root, parent); +if (ret <0 ) { + node = node->rb_left; + }else if (ret >0 ) { + node = node->rb_right; + }else { +/* +* We only want to count ADD actions, as drops mean the +* ref doesn't exist. +*/ +if (entry->action ==BTRFS_ADD_DELAYED_REF ) + found = true; +break ; + } + } +spin_unlock (&head->lock); +return found; +} +void __cold btrfs_delayed_ref_exit (void ) {kmem_cache_destroy (btrfs_delayed_ref_head_cachep);
fs/btrfs/delayed-ref.h +2 -0
@@ -389,6 +389,8 @@ int btrfs_delayed_refs_rsv_refill(structvoid btrfs_migrate_to_delayed_refs_rsv (struct btrfs_fs_info *fs_info,u64 num_bytes);bool btrfs_check_space_for_delayed_refs (struct btrfs_fs_info *fs_info); +bool btrfs_find_delayed_tree_ref (struct btrfs_delayed_ref_head *head, +u64 root,u64 parent);static inline u64 btrfs_delayed_ref_owner (struct btrfs_delayed_ref_node *node) {
fs/btrfs/extent-tree.c +45 -6
68 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 63/273 btrfs: only run the extent map shrinker from kswapd tasks
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit ae1e766f623f7a2a889a0b09eb076dd9a60efbe9 upstream.
Currently the extent map shrinker can be run by any task when attempting to allocate memory and there's enough memory pressure to trigger it.
To avoid too much latency we stop iterating over extent maps and removing them once the task needs to reschedule. This logic was introduced in commit b3ebb9b7e92a ("btrfs: stop extent map shrinker if reschedule is needed").
While that solved high latency problems for some use cases, it's still not enough because with a too high number of tasks entering the extent map shrinker code, either due to memory allocations or because they are a kswapd task, we end up having a very high level of contention on some spin locks, namely:
1) The fs_info->fs_roots_radix_lock spin lock, which we need to find roots to iterate over their inodes;
2) The spin lock of the xarray used to track open inodes for a root (struct btrfs_root::inodes) - on 6.10 kernels and below, it used to be a red black tree and the spin lock was root->inode_lock;
3) The fs_info->delayed_iput_lock spin lock since the shrinker adds delayed iputs (calls btrfs_add_delayed_iput()).
Instead of allowing the extent map shrinker to be run by any task, make it run only by kswapd tasks. This still solves the problem of running into OOM situations due to an unbounded extent map creation, which is simple to trigger by direct IO writes, as described in the changelog of commit 956a17d9d050 ("btrfs: add a shrinker for extent maps"), and by a similar case when doing buffered IO on files with a very large number of holes (keeping the file open and creating many holes, whose extent maps are only released when the file is closed).
--- fs/btrfs/extent_map.c | 22 ++++++---------------- fs/btrfs/super.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-)
fs/btrfs/extent_map.c +6 -16
@@ -1065,8 +1065,7 @@ static long btrfs_scan_inode(struct btrfreturn 0 ;/* -* We want to be fast because we can be called from any path trying to -* allocate memory, so if the lock is busy we don't want to spend time +* We want to be fast so if the lock is busy we don't want to spend time * waiting for it - either some task is about to do IO for the inode or * we may have another task shrinking extent maps, here in this code, so * skip this inode.
@@ -1109,9 +1108,7 @@ next:/* * Stop if we need to reschedule or there's contention on the * lock. This is to avoid slowing other tasks trying to take the -* lock and because the shrinker might be called during a memory -* allocation path and we want to avoid taking a very long time -* and slowing down all sorts of tasks. +* lock. */ if (need_resched () ||rwlock_needbreak (&tree->lock))break ;
@@ -1139,12 +1136,7 @@ static long btrfs_scan_root(struct btrfsif (ctx->scanned >= ctx->nr_to_scan)break ; -/* -* We may be called from memory allocation paths, so we don't -* want to take too much time and slowdown tasks. -*/ -if (need_resched ()) -break ; +cond_resched (); inode =btrfs_find_first_inode (root, min_ino); }
@@ -1202,14 +1194,12 @@ long btrfs_free_extent_maps(struct btrfs ctx.last_ino); } -/* -* We may be called from memory allocation paths, so we don't want to -* take too much time and slowdown tasks, so stop if we need reschedule. -*/ -while (ctx.scanned < ctx.nr_to_scan && !need_resched ()) { +while (ctx.scanned < ctx.nr_to_scan) {struct btrfs_root *root;unsigned long count; +cond_resched (); +spin_lock (&fs_info->fs_roots_radix_lock); count = radix_tree_gang_lookup(&fs_info->fs_roots_radix, (void **)&root,
fs/btrfs/super.c +10 -0
@@ -28,6 +28,7 @@#include <linux/btrfs.h> #include <linux/security.h> #include <linux/fs_parser.h> +#include <linux/swap.h> #include "messages.h" #include "delayed-inode.h" #include "ctree.h"
@@ -2394,6 +2395,15 @@ static long btrfs_free_cached_objects(st const long nr_to_scan = min_t(unsigned long, LONG_MAX, sc->nr_to_scan);struct btrfs_fs_info *fs_info =btrfs_sb (sb); +/* +* We may be called from any task trying to allocate memory and we don't +* want to slow it down with scanning and dropping extent maps. It would +* also cause heavy lock contention if many tasks concurrently enter +* here. Therefore only allow kswapd tasks to scan and drop extent maps. +*/ +if (!current_is_kswapd ()) +return 0 ; +return btrfs_free_extent_maps (fs_info, nr_to_scan); }
Greg Kroah-Hartman
maintainerPATCH 64/273 btrfs: zoned: properly take lock to read/update block groups zoned variables
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
commit e30729d4bd4001881be4d1ad4332a5d4985398f8 upstream.
__btrfs_add_free_space_zoned() references and modifies bg's alloc_offset, ro, and zone_unusable, but without taking the lock. It is mostly safe because they monotonically increase (at least for now) and this function is mostly called by a transaction commit, which is serialized by itself.
Still, taking the lock is a safer and correct option and I'm going to add a change to reset zone_unusable while a block group is still alive. So, add locking around the operations.
--- fs/btrfs/free-space-cache.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/btrfs/free-space-cache.c +8 -6
@@ -2698,15 +2698,16 @@ static int __btrfs_add_free_space_zoned(u64 offset = bytenr - block_group->start;u64 to_free, to_unusable;int bg_reclaim_threshold =0 ; -bool initial = ((size == block_group->length) && (block_group->alloc_offset ==0 )); +bool initial;u64 reclaimable_unusable; -WARN_ON (!initial && offset + size > block_group->zone_capacity); +spin_lock (&block_group->lock); + initial = ((size == block_group->length) && (block_group->alloc_offset ==0 )); +WARN_ON (!initial && offset + size > block_group->zone_capacity);if (!initial) bg_reclaim_threshold =READ_ONCE (sinfo->bg_reclaim_threshold); -spin_lock (&ctl->tree_lock);if (!used) to_free = size;else if (initial)
@@ -2719,7 +2720,9 @@ static int __btrfs_add_free_space_zoned( to_free = offset + size - block_group->alloc_offset; to_unusable = size - to_free; +spin_lock (&ctl->tree_lock); ctl->free_space += to_free; +spin_unlock (&ctl->tree_lock);/* * If the block group is read-only, we should account freed space into * bytes_readonly.
@@ -2728,11 +2731,8 @@ static int __btrfs_add_free_space_zoned( block_group->zone_unusable += to_unusable;WARN_ON (block_group->zone_unusable > block_group->length); } -spin_unlock (&ctl->tree_lock);if (!used) { -spin_lock (&block_group->lock); block_group->alloc_offset -= size; -spin_unlock (&block_group->lock); } reclaimable_unusable = block_group->zone_unusable -
@@ -2746,6 +2746,8 @@ static int __btrfs_add_free_space_zoned(btrfs_mark_bg_to_reclaim (block_group); } +spin_unlock (&block_group->lock); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 65/273 btrfs: tree-checker: add dev extent item checks
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 008e2512dc5696ab2dc5bf264e98a9fe9ceb830e upstream.
[REPORT]
There is a corruption report that btrfs refused to mount a fs that has overlapping dev extents:
BTRFS error (device sdc): dev extent devid 4 physical offset 14263979671552 overlap with previous dev extent end 14263980982272 BTRFS error (device sdc): failed to verify dev extents against chunks: -117
BTRFS error (device sdc): open_ctree failed
[CAUSE]
The direct cause is very obvious, there is a bad dev extent item with incorrect length.
With btrfs check reporting two overlapping extents, the second one shows some clue on the cause:
ERROR: dev extent devid 4 offset 14263979671552 len 6488064 overlap with previous dev extent end 14263980982272
ERROR: dev extent devid 13 offset 2257707008000 len 6488064 overlap with previous dev extent end 2257707270144
ERROR: errors found in extent allocation tree or chunk allocation
The second one looks like a bitflip happened during new chunk allocation:
hex(2257707008000) = 0x20da9d30000 hex(2257707270144) = 0x20da9d70000
diff = 0x00000040000
So it looks like a bitflip happened during new dev extent allocation, resulting the second overlap.
Currently we only do the dev-extent verification at mount time, but if the corruption is caused by memory bitflip, we really want to catch it before writing the corruption to the storage.
Furthermore the dev extent items has the following key definition:
(<device id> DEV_EXTENT <physical offset>)
Thus we can not just rely on the generic key order check to make sure there is no overlapping.
[ENHANCEMENT]
Introduce dedicated dev extent checks, including:
- Fixed member checks
* chunk_tree should always be BTRFS_CHUNK_TREE_OBJECTID (3)
* chunk_objectid should always be BTRFS_FIRST_CHUNK_CHUNK_TREE_OBJECTID (256)
- Alignment checks
* chunk_offset should be aligned to sectorsize
* length should be aligned to sectorsize
* key.offset should be aligned to sectorsize
- Overlap checks
If the previous key is also a dev-extent item, with the same device id, make sure we do not overlap with the previous dev extent.
Reported: Stefan N <[email protected]>
--- fs/btrfs/tree-checker.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
fs/btrfs/tree-checker.c +69 -0
@@ -1718,6 +1718,72 @@ static int check_raid_stripe_extent(consreturn 0 ; } +static int check_dev_extent_item (const struct extent_buffer *leaf, +const struct btrfs_key *key, +int slot, +struct btrfs_key *prev_key) +{ +struct btrfs_dev_extent *de; +const u32 sectorsize = leaf->fs_info->sectorsize; + + de = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); +/* Basic fixed member checks. */ +if (unlikely (btrfs_dev_extent_chunk_tree (leaf, de) != +BTRFS_CHUNK_TREE_OBJECTID )) { +generic_err (leaf, slot, +"invalid dev extent chunk tree id, has %llu expect %llu" , +btrfs_dev_extent_chunk_tree (leaf, de), +BTRFS_CHUNK_TREE_OBJECTID ); +return -EUCLEAN ; + } +if (unlikely (btrfs_dev_extent_chunk_objectid (leaf, de) != +BTRFS_FIRST_CHUNK_TREE_OBJECTID )) { +generic_err (leaf, slot, +"invalid dev extent chunk objectid, has %llu expect %llu" , +btrfs_dev_extent_chunk_objectid (leaf, de), +BTRFS_FIRST_CHUNK_TREE_OBJECTID ); +return -EUCLEAN ; + } +/* Alignment check. */ +if (unlikely (!IS_ALIGNED (key->offset, sectorsize))) { +generic_err (leaf, slot, +"invalid dev extent key.offset, has %llu not aligned to %u" , + key->offset, sectorsize); +return -EUCLEAN ; + } +if (unlikely (!IS_ALIGNED (btrfs_dev_extent_chunk_offset (leaf, de), + sectorsize))) { +generic_err (leaf, slot, +"invalid dev extent chunk offset, has %llu not aligned to %u" , +btrfs_dev_extent_chunk_objectid (leaf, de), + sectorsize); +return -EUCLEAN ; + } +if (unlikely (!IS_ALIGNED (btrfs_dev_extent_length (leaf, de), + sectorsize))) { +generic_err (leaf, slot, +"invalid dev extent length, has %llu not aligned to %u" , +btrfs_dev_extent_length (leaf, de), sectorsize); +return -EUCLEAN ; + } +/* Overlap check with previous dev extent. */ +if (slot && prev_key->objectid == key->objectid && + prev_key->type == key->type) { +struct btrfs_dev_extent *prev_de; +u64 prev_len; + + prev_de = btrfs_item_ptr(leaf, slot - 1, struct btrfs_dev_extent); + prev_len =btrfs_dev_extent_length (leaf, prev_de); +if (unlikely (prev_key->offset + prev_len > key->offset)) { +generic_err (leaf, slot, +"dev extent overlap, prev offset %llu len %llu current offset %llu" , + prev_key->objectid, prev_len, key->offset); +return -EUCLEAN ; + } + } +return 0 ; +} +/* * Common point to switch the item-specific validation. */
@@ -1754,6 +1820,9 @@ static enum btrfs_tree_block_status checcase BTRFS_DEV_ITEM_KEY : ret =check_dev_item (leaf, key, slot);break ; +case BTRFS_DEV_EXTENT_KEY : + ret =check_dev_extent_item (leaf, key, slot, prev_key); +break ;case BTRFS_INODE_ITEM_KEY : ret =check_inode_item (leaf, key, slot);break ;
Greg Kroah-Hartman
maintainerPATCH 66/273 btrfs: only enable extent map shrinker for DEBUG builds
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 534f7eff9239c1b0af852fc33f5af2b62c00eddf upstream.
Although there are several patches improving the extent map shrinker, there are still reports of too frequent shrinker behavior, taking too much CPU for the kswapd process.
So let's only enable extent shrinker for now, until we got more comprehensive understanding and a better solution.
--- fs/btrfs/super.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/btrfs/super.c +7 -1
@@ -2387,7 +2387,13 @@ static long btrfs_nr_cached_objects(strutrace_btrfs_extent_map_shrinker_count (fs_info, nr); -return nr; +/* +* Only report the real number for DEBUG builds, as there are reports of +* serious performance degradation caused by too frequent shrinks. +*/ +if (IS_ENABLED (CONFIG_BTRFS_DEBUG )) +return nr; +return 0 ; }static long btrfs_free_cached_objects (struct super_block *sb,struct shrink_control *sc)
Greg Kroah-Hartman
maintainerPATCH 67/273 drm/amdgpu: Actually check flags for all context ops.
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bas Nieuwenhuizen <[email protected]>
commit 0573a1e2ea7e35bff08944a40f1adf2bb35cea61 upstream.
Missing validation ...
Checked libdrm and it clears all the structs, so we should be safe to just check everything.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +8 -0
@@ -685,16 +685,24 @@ int amdgpu_ctx_ioctl(struct drm_device *switch (args->in.op) {case AMDGPU_CTX_OP_ALLOC_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_alloc (adev, fpriv, filp, priority, &id); args->out.alloc.ctx_id = id;break ;case AMDGPU_CTX_OP_FREE_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_free (fpriv, id);break ;case AMDGPU_CTX_OP_QUERY_STATE : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query (adev, fpriv, id, &args->out);break ;case AMDGPU_CTX_OP_QUERY_STATE2 : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query2 (adev, fpriv, id, &args->out);break ;case AMDGPU_CTX_OP_GET_STABLE_PSTATE :
Greg Kroah-Hartman
maintainerPATCH 68/273 memcg_write_event_control(): fix a user-triggerable oops
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 046667c4d3196938e992fba0dfcde570aa85cd0e upstream.
we are *not* guaranteed that anything past the terminating NUL is mapped (let alone initialized with anything sane).
--- mm/memcontrol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/memcontrol.c +5 -2
@@ -5282,9 +5282,12 @@ static ssize_t memcg_write_event_control buf = endp +1 ; cfd =simple_strtoul (buf, &endp,10 ); -if ((*endp !=' ' ) && (*endp !='\0' )) +if (*endp =='\0' ) + buf = endp; +else if (*endp ==' ' ) + buf = endp +1 ; +else return -EINVAL ; - buf = endp +1 ; event =kzalloc (sizeof (*event),GFP_KERNEL );if (!event)
Greg Kroah-Hartman
maintainerPATCH 69/273 drm/amd/display: Adjust cursor position
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Siqueira <[email protected]>
commit 56fb276d0244d430496f249335a44ae114dd5f54 upstream.
[why & how]
When the commit 9d84c7ef8a87 ("drm/amd/display: Correct cursor position on horizontal mirror") was introduced, it used the wrong calculation for the position copy for X. This commit uses the correct calculation for that based on the original patch.
--- drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 -1
@@ -3698,7 +3698,7 @@ void dcn10_set_cursor_position(struct pi (int)hubp->curs_attr.width || pos_cpy.x <= (int)hubp->curs_attr.width + pipe_ctx->plane_state->src_rect.x) { - pos_cpy.x =2 * viewport_width - temp_x; + pos_cpy.x = temp_x + viewport_width; } } }else {
Greg Kroah-Hartman
maintainerPATCH 70/273 drm/amd/display: fix s2idle entry for DCN3.5+
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <[email protected]>
commit f6098641d3e1e4d4052ff9378857c831f9675f6b upstream.
To be able to get to the lowest power state when suspending systems with DCN3.5+, we must be in IPS before the display hardware is put into D3cold. So, to ensure that the system always reaches the lowest power state while suspending, force systems that support IPS to enter idle optimizations before entering D3cold.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -2724,6 +2724,9 @@ static int dm_suspend(void *handle)hpd_rx_irq_work_suspend (dm); +if (adev->dm.dc->caps.ips_support) +dc_allow_idle_optimizations (adev->dm.dc, true); +dc_set_power_state (dm->dc,DC_ACPI_CM_POWER_STATE_D3 );dc_dmub_srv_set_power_state (dm->dc->ctx->dmub_srv,DC_ACPI_CM_POWER_STATE_D3 );
Greg Kroah-Hartman
maintainerPATCH 71/273 drm/amd/display: Enable otg synchronization logic for DCN321
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Loan Chen <[email protected]>
commit 0dbb81d44108a2a1004e5b485ef3fca5bc078424 upstream.
[Why]
Tiled display cannot synchronize properly after S3. The fix for commit 5f0c74915815 ("drm/amd/display: Fix for otg synchronization logic") is not enable in DCN321, which causes the otg is excluded from synchronization.
[How]
Enable otg synchronization logic in dcn321.
--- drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +3 -0
@@ -1778,6 +1778,9 @@ static bool dcn321_resource_construct( dc->caps.color.mpc.ogam_rom_caps.hlg =0 ; dc->caps.color.mpc.ocsc =1 ; +/* Use pipe context based otg sync logic */ + dc->config.use_pipe_ctx_sync_logic = true; + dc->config.dc_mode_clk_limit_support = true; dc->config.enable_windowed_mpo_odm = true;/* read VBIOS LTTPR caps */
Greg Kroah-Hartman
maintainerPATCH 72/273 drm/amd/display: fix cursor offset on rotation 180
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Melissa Wen <[email protected]>
commit 737222cebecbdbcdde2b69475c52bcb9ecfeb830 upstream.
[why & how]
Cursor gets clipped off in the middle of the screen with hw rotation 180. Fix a miscalculation of cursor offset when it's placed near the edges in the pipe split case.
Cursor bugs with hw rotation were reported on AMD issue tracker:
https://gitlab.freedesktop.org/drm/amd/-/issues/2247
The issues on rotation 270 was fixed by:
https://lore.kernel.org/amd-gfx/[email protected]/
that partially addressed the rotation 180 too. So, this patch is the final bits for rotation 180.
--- drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 -1
@@ -3605,7 +3605,7 @@ void dcn10_set_cursor_position(struct pi (int)hubp->curs_attr.width || pos_cpy.x <= (int)hubp->curs_attr.width + pipe_ctx->plane_state->src_rect.x) { - pos_cpy.x = temp_x + viewport_width; + pos_cpy.x =2 * viewport_width - temp_x; } } }else {
Greg Kroah-Hartman
maintainerPATCH 73/273 drm/amdgpu/jpeg2: properly set atomics vmid field
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e414a304f2c5368a84f03ad34d29b89f965a33c9 upstream.
This needs to be set as well if the IB uses atomics.
--- drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c +2 -2
@@ -543,11 +543,11 @@ void jpeg_v2_0_dec_ring_emit_ib(struct aamdgpu_ring_write (ring,PACKETJ (mmUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 )); -amdgpu_ring_write (ring, (vmid | (vmid <<4 ))); +amdgpu_ring_write (ring, (vmid | (vmid <<4 ) | (vmid <<8 )));amdgpu_ring_write (ring,PACKETJ (mmUVD_LMI_JPEG_VMID_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 )); -amdgpu_ring_write (ring, (vmid | (vmid <<4 ))); +amdgpu_ring_write (ring, (vmid | (vmid <<4 ) | (vmid <<8 )));amdgpu_ring_write (ring,PACKETJ (mmUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 ));
Greg Kroah-Hartman
maintainerPATCH 74/273 drm/amdgpu/jpeg4: properly set atomics vmid field
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e6c6bd6253e792cee6c5c065e106e87b9f0d9ae9 upstream.
This needs to be set as well if the IB uses atomics.
--- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c +2 -2
@@ -773,11 +773,11 @@ void jpeg_v4_0_3_dec_ring_emit_ib(structamdgpu_ring_write (ring,PACKETJ (regUVD_LMI_JRBC_IB_VMID_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 )); -amdgpu_ring_write (ring, (vmid | (vmid <<4 ))); +amdgpu_ring_write (ring, (vmid | (vmid <<4 ) | (vmid <<8 )));amdgpu_ring_write (ring,PACKETJ (regUVD_LMI_JPEG_VMID_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 )); -amdgpu_ring_write (ring, (vmid | (vmid <<4 ))); +amdgpu_ring_write (ring, (vmid | (vmid <<4 ) | (vmid <<8 )));amdgpu_ring_write (ring,PACKETJ (regUVD_LMI_JRBC_IB_64BIT_BAR_LOW_INTERNAL_OFFSET,0 ,0 ,PACKETJ_TYPE0 ));
Greg Kroah-Hartman
maintainerPATCH 75/273 drm/amd/amdgpu: command submission parser for JPEG
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David (Ming Qiang) Wu <[email protected]>
commit 470516c2925493594a690bc4d05b1f4471d9f996 upstream.
Add JPEG IB command parser to ensure registers in the command are within the JPEG IP block.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 + drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c | 61 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.h | 7 +++ drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c | 1 drivers/gpu/drm/amd/amdgpu/soc15d.h | 6 +++ 5 files changed, 76 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +3 -0
@@ -1057,6 +1057,9 @@ static int amdgpu_cs_patch_ibs(struct am r =amdgpu_ring_parse_cs (ring, p, job, ib);if (r)return r; + +if (ib->sa_bo) + ib->gpu_addr =amdgpu_sa_bo_gpu_addr (ib->sa_bo); }else { ib->ptr = (uint32_t *)kptr; r =amdgpu_ring_patch_cs_in_place (ring, p, job, ib);
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c +60 -1
82 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.h +6 -1
@@ -46,6 +46,9 @@#define JRBC_DEC_EXTERNAL_REG_WRITE_ADDR 0x18000 +#define JPEG_REG_RANGE_START 0x4000 +#define JPEG_REG_RANGE_END 0x41c2 +extern const struct amdgpu_ip_block_version jpeg_v4_0_3_ip_block; void jpeg_v4_0_3_dec_ring_emit_ib(struct amdgpu_ring *ring,
@@ -62,5 +65,7 @@ void jpeg_v4_0_3_dec_ring_insert_end(strvoid jpeg_v4_0_3_dec_ring_emit_wreg (struct amdgpu_ring *ring,uint32_t reg,uint32_t val);void jpeg_v4_0_3_dec_ring_emit_reg_wait (struct amdgpu_ring *ring,uint32_t reg,uint32_t val,uint32_t mask); - +int jpeg_v4_0_3_dec_ring_parse_cs (struct amdgpu_cs_parser *parser, +struct amdgpu_job *job, +struct amdgpu_ib *ib);#endif /* __JPEG_V4_0_3_H__ */
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_0.c +1 -0
@@ -523,6 +523,7 @@ static const struct amdgpu_ring_funcs jp .get_rptr = jpeg_v5_0_0_dec_ring_get_rptr, .get_wptr = jpeg_v5_0_0_dec_ring_get_wptr, .set_wptr = jpeg_v5_0_0_dec_ring_set_wptr, + .parse_cs = jpeg_v4_0_3_dec_ring_parse_cs, .emit_frame_size =SOC15_FLUSH_GPU_TLB_NUM_WREG *6 + SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 8 +
drivers/gpu/drm/amd/amdgpu/soc15d.h +6 -0
@@ -76,6 +76,12 @@ ((cond & 0xF) << 24) | \ ((type & 0xF) << 28)) +#define CP_PACKETJ_NOP 0x60000000 +#define CP_PACKETJ_GET_REG (x) ((x) & 0x3FFFF) +#define CP_PACKETJ_GET_RES (x) (((x) >> 18) & 0x3F) +#define CP_PACKETJ_GET_COND (x) (((x) >> 24) & 0xF) +#define CP_PACKETJ_GET_TYPE (x) (((x) >> 28) & 0xF) +/* Packet 3 types */ #define PACKET3_NOP 0x10#define PACKET3_SET_BASE 0x11
Greg Kroah-Hartman
maintainerPATCH 76/273 pidfd: prevent creation of pidfds for kthreads
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 3b5bbe798b2451820e74243b738268f51901e7d0 upstream.
It's currently possible to create pidfds for kthreads but it is unclear what that is supposed to mean. Until we have use-cases for it and we figured out what behavior we want block the creation of pidfds for kthreads.
--- kernel/fork.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
kernel/fork.c +22 -3
@@ -2069,11 +2069,24 @@ static int __pidfd_prepare(struct pid *p*/ int pidfd_prepare (struct pid *pid,unsigned int flags,struct file **ret) { -bool thread = flags &PIDFD_THREAD ; - -if (!pid || !pid_has_task (pid, thread ?PIDTYPE_PID :PIDTYPE_TGID )) +if (!pid)return -EINVAL ; +scoped_guard (rcu) { +struct task_struct *tsk; + +if (flags &PIDFD_THREAD ) + tsk =pid_task (pid,PIDTYPE_PID ); +else + tsk =pid_task (pid,PIDTYPE_TGID ); +if (!tsk) +return -EINVAL ; + +/* Don't create pidfds for kernel threads for now. */ +if (tsk->flags &PF_KTHREAD ) +return -EINVAL ; + } +return __pidfd_prepare (pid, flags, ret); }
@@ -2419,6 +2432,12 @@ __latent_entropy struct task_struct *copif (clone_flags &CLONE_PIDFD ) {int flags = (clone_flags &CLONE_THREAD ) ?PIDFD_THREAD :0 ; +/* Don't create pidfds for kernel threads for now. */ +if (args->kthread) { + retval = -EINVAL ; + goto bad_fork_free_pid; + } +/* Note that no task has been attached to @pid yet. */ retval =__pidfd_prepare (pid, flags, &pidfile);if (retval <0 )
Greg Kroah-Hartman
maintainerPATCH 77/273 s390/uv: Panic for set and remove shared access UVC errors
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudio Imbrenda <[email protected]>
[ Upstream commit cff59d8631e1409ffdd22d9d717e15810181b32c ]
The return value uv_set_shared() and uv_remove_shared() (which are wrappers around the share() function) is not always checked. The system integrity of a protected guest depends on the Share and Unshare UVCs being successful. This means that any caller that fails to check the return value will compromise the security of the protected guest.
No code path that would lead to such violation of the security guarantees is currently exercised, since all the areas that are shared never get unshared during the lifetime of the system. This might change and become an issue in the future.
The Share and Unshare UVCs can only fail in case of hypervisor misbehaviour (either a bug or malicious behaviour). In such cases there is no reasonable way forward, and the system needs to panic.
This patch replaces the return at the end of the share() function with a panic, to guarantee system integrity.
Message-ID: <[email protected]>
--- arch/s390/include/asm/uv.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/s390/include/asm/uv.h +4 -1
@@ -442,7 +442,10 @@ static inline int share(unsigned long addr, u16 cmd)if (!uv_call (0 , (u64)&uvcb))return 0 ; -return -EINVAL ; +pr_err ("%s UVC failed (rc: 0x%x, rrc: 0x%x), possible hypervisor bug.\n" , + uvcb.header.cmd ==UVC_CMD_SET_SHARED_ACCESS ?"Share" :"Unshare" , + uvcb.header.rc, uvcb.header.rrc); +panic ("System security cannot be guaranteed unless the system panics now.\n" ); }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 78/273 netfs: Fault in smaller chunks for non-large folio mappings
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 98055bc3595500bcf2126b93b1595354bdb86a66 ]
As in commit 4e527d5841e2 ("iomap: fault in smaller chunks for non-large folio mappings"), we can see a performance loss for filesystems which have not yet been converted to large folios.
--- fs/netfs/buffered_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/netfs/buffered_write.c +1 -1
@@ -184,7 +184,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,unsigned int bdp_flags = (iocb->ki_flags &IOCB_NOWAIT ) ?BDP_ASYNC :0 ;ssize_t written =0 , ret, ret2;loff_t i_size, pos = iocb->ki_pos, from, to; -size_t max_chunk =PAGE_SIZE <<MAX_PAGECACHE_ORDER ; +size_t max_chunk =mapping_max_folio_size (mapping);bool maybe_trouble = false; if (unlikely(test_bit(NETFS_ICTX_WRITETHROUGH, &ctx->flags) ||
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 79/273 filelock: fix name of file_lease slab cache
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
[ Upstream commit 3f65f3c099bcb27949e712f39ba836f21785924a ]
When struct file_lease was split out from struct file_lock, the name of the file_lock slab cache was copied to the new slab cache for file_lease. This name conflict causes confusion in /proc/slabinfo and /sys/kernel/slab. In particular, it caused failures in drgn's test case for slab cache merging.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -2984,7 +2984,7 @@ static int __init filelock_init(void) filelock_cache =kmem_cache_create ("file_lock_cache" ,sizeof (struct file_lock ),0 ,SLAB_PANIC ,NULL ); - filelease_cache =kmem_cache_create ("file_lock_cache" , + filelease_cache =kmem_cache_create ("file_lease_cache" ,sizeof (struct file_lease ),0 ,SLAB_PANIC ,NULL );for_each_possible_cpu (i) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 80/273 libfs: fix infinite directory reads for offset dir
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: yangerkun <[email protected]>
[ Upstream commit 64a7ce76fb901bf9f9c36cf5d681328fc0fd4b5a ]
After we switch tmpfs dir operations from simple_dir_operations to simple_offset_dir_operations, every rename happened will fill new dentry to dest dir's maple tree(&SHMEM_I(inode)->dir_offsets->mt) with a free key starting with octx->newx_offset, and then set newx_offset equals to free key + 1. This will lead to infinite readdir combine with rename happened at the same time, which fail generic/736 in xfstests(detail show as below).
1. create 5000 files(1 2 3...) under one dir
2. call readdir(man 3 readdir) once, and get one entry
3. rename(entry, "TEMPFILE"), then rename("TEMPFILE", entry)
4. loop 2~3, until readdir return nothing or we loop too many times(tmpfs break test with the second condition)
We choose the same logic what commit 9b378f6ad48cf ("btrfs: fix infinite directory reads") to fix it, record the last_index when we open dir, and do not emit the entry which index >= last_index. The file->private_data now used in offset dir can use directly to do this, and we also update the last_index when we llseek the dir file.
--- fs/libfs.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-)
fs/libfs.c +24 -11
@@ -450,6 +450,14 @@ void simple_offset_destroy(struct offset_ctx *octx)mtree_destroy (&octx->mt); } +static int offset_dir_open (struct inode *inode,struct file *file) +{ +struct offset_ctx *ctx = inode->i_op->get_offset_ctx (inode); + + file->private_data = (void *)ctx->next_offset; +return 0 ; +} +/** * offset_dir_llseek - Advance the read position of a directory descriptor * @file: an open directory whose position is to be updated
@@ -463,6 +471,9 @@ void simple_offset_destroy(struct offset_ctx *octx)*/ static loff_t offset_dir_llseek (struct file *file,loff_t offset,int whence) { +struct inode *inode = file->f_inode; +struct offset_ctx *ctx = inode->i_op->get_offset_ctx (inode); +switch (whence) {case SEEK_CUR : offset += file->f_pos;
@@ -476,7 +487,8 @@ static loff_t offset_dir_llseek(struct file *file, loff_t offset, int whence) }/* In this case, ->private_data is protected by f_pos_lock */ - file->private_data =NULL ; +if (!offset) + file->private_data = (void *)ctx->next_offset;return vfs_setpos (file, offset,LONG_MAX ); }
@@ -507,7 +519,7 @@ static bool offset_dir_emit(struct dir_context *ctx, struct dentry *dentry) inode->i_ino, fs_umode_to_dtype(inode->i_mode)); } -static void *offset_iterate_dir (struct inode *inode,struct dir_context *ctx) +static void offset_iterate_dir (struct inode *inode,struct dir_context *ctx,long last_index) {struct offset_ctx *octx = inode->i_op->get_offset_ctx (inode);struct dentry *dentry;
@@ -515,17 +527,21 @@ static void *offset_iterate_dir(struct inode *inode, struct dir_context *ctx)while (true) { dentry =offset_find_next (octx, ctx->pos);if (!dentry) -return ERR_PTR (-ENOENT ); +return ; + +if (dentry2offset (dentry) >= last_index) { +dput (dentry); +return ; + }if (!offset_dir_emit (ctx, dentry)) {dput (dentry); -break ; +return ; } ctx->pos =dentry2offset (dentry) +1 ;dput (dentry); } -return NULL ; }/**
@@ -552,22 +568,19 @@ static void *offset_iterate_dir(struct inode *inode, struct dir_context *ctx)static int offset_readdir (struct file *file,struct dir_context *ctx) {struct dentry *dir = file->f_path.dentry; +long last_index = (long )file->private_data;lockdep_assert_held (&d_inode (dir)->i_rwsem);if (!dir_emit_dots (file, ctx))return 0 ; -/* In this case, ->private_data is protected by f_pos_lock */ -if (ctx->pos ==DIR_OFFSET_MIN ) - file->private_data =NULL ; -else if (file->private_data ==ERR_PTR (-ENOENT )) -return 0 ; - file->private_data =offset_iterate_dir (d_inode (dir), ctx); +offset_iterate_dir (d_inode (dir), ctx, last_index);return 0 ; }const struct file_operations simple_offset_dir_operations = { + .open = offset_dir_open, .llseek = offset_dir_llseek, .iterate_shared = offset_readdir, .read = generic_read_dir,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 81/273 bpf: Fix updating attached freplace prog in prog_array map
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit fdad456cbcca739bae1849549c7a999857c56f88 ]
The commit f7866c358733 ("bpf: Fix null pointer dereference in resolve_prog_type() for BPF_PROG_TYPE_EXT") fixed a NULL pointer dereference panic, but didn't fix the issue that
fails to update attached freplace prog to prog_array map.
Since commit 1c123c567fb1 ("bpf: Resolve fext program type when checking map compatibility"), freplace prog and its target prog are able to tail call each other.
And the commit 3aac1ead5eb6 ("bpf: Move prog->aux->linked_prog and trampoline into bpf_link on attach") sets prog->aux->dst_prog as NULL after attaching freplace prog to its
target prog.
After loading freplace the prog_array's owner type is BPF_PROG_TYPE_SCHED_CLS. Then, after attaching freplace its prog->aux->dst_prog is NULL. Then, while updating freplace in prog_array the bpf_prog_map_compatible() incorrectly returns false because resolve_prog_type() returns BPF_PROG_TYPE_EXT instead of BPF_PROG_TYPE_SCHED_CLS.
After this patch the resolve_prog_type() returns BPF_PROG_TYPE_SCHED_CLS and update to prog_array can succeed.
--- include/linux/bpf_verifier.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bpf_verifier.h +2 -2
@@ -846,8 +846,8 @@ static inline u32 type_flag(u32 type)/* only use after check_attach_btf_id() */ static inline enum bpf_prog_type resolve_prog_type (const struct bpf_prog *prog) { -return (prog->type ==BPF_PROG_TYPE_EXT && prog->aux->dst_prog) ? - prog->aux->dst_prog->type : prog->type; +return (prog->type ==BPF_PROG_TYPE_EXT && prog->aux->saved_dst_prog_type) ? + prog->aux->saved_dst_prog_type : prog->type; }static inline bool bpf_prog_check_recur (const struct bpf_prog *prog)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 82/273 bpf: Fix a kernel verifier crash in stacksafe()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonghong Song <[email protected]>
[ Upstream commit bed2eb964c70b780fb55925892a74f26cb590b25 ]
Daniel Hodges reported a kernel verifier crash when playing with sched-ext. Further investigation shows that the crash is due to invalid memory access in stacksafe(). More specifically, it is the following code:
if (exact != NOT_EXACT &&
old->stack[spi].slot_type[i % BPF_REG_SIZE] !=
cur->stack[spi].slot_type[i % BPF_REG_SIZE])
return false;The 'i' iterates old->allocated_stack.
If cur->allocated_stack < old->allocated_stack the out-of-bound access will happen.
To fix the issue add 'i >= cur->allocated_stack' check such that if the condition is true, stacksafe() should fail. Otherwise, cur->stack[spi].slot_type[i % BPF_REG_SIZE] memory access is legal.
--- kernel/bpf/verifier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +3 -2
@@ -16881,8 +16881,9 @@ static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old, spi = i /BPF_REG_SIZE ;if (exact !=NOT_EXACT && - old->stack[spi].slot_type[i %BPF_REG_SIZE ] != - cur->stack[spi].slot_type[i %BPF_REG_SIZE ]) + (i >= cur->allocated_stack || + old->stack[spi].slot_type[i %BPF_REG_SIZE ] != + cur->stack[spi].slot_type[i %BPF_REG_SIZE ]))return false; if (!(old->stack[spi].spilled_ptr.live & REG_LIVE_READ)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 83/273 9p: Fix DIO read through netfs
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
[ Upstream commit e3786b29c54cdae3490b07180a54e2461f42144c ]
If a program is watching a file on a 9p mount, it won't see any change in size if the file being exported by the server is changed directly in the source filesystem, presumably because 9p doesn't have change notifications, and because netfs skips the reads if the file is empty.
Fix this by attempting to read the full size specified when a DIO read is requested (such as when 9p is operating in unbuffered mode) and dealing with a short read if the EOF was less than the expected read.
To make this work, filesystems using netfslib must not set NETFS_SREQ_CLEAR_TAIL if performing a DIO read where that read hit the EOF. I don't want to mandatorily clear this flag in netfslib for DIO because, say, ceph might make a read from an object that is not completely filled, but does not reside at the end of file - and so we need to clear the excess.
This can be tested by watching an empty file over 9p within a VM (such as in the ktest framework):
while true; do read content; if [ -n "$content" ]; then echo $content; break; fi; done < /host/tmp/foo
then writing something into the empty file. The watcher should immediately display the file content and break out of the loop. Without this fix, it remains in the loop indefinitely.
--- fs/9p/vfs_addr.c | 3 ++- fs/afs/file.c | 3 ++- fs/ceph/addr.c | 6 ++++-- fs/netfs/io.c | 17 +++++++++++------ fs/nfs/fscache.c | 3 ++- fs/smb/client/file.c | 3 ++- 6 files changed, 23 insertions(+), 12 deletions(-)
fs/9p/vfs_addr.c +2 -1
@@ -75,7 +75,8 @@ static void v9fs_issue_read(struct netfs_io_subrequest *subreq)/* if we just extended the file size, any portion not in * cache won't be on server and is zeroes */ -__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags); +if (subreq->rreq->origin !=NETFS_DIO_READ ) +__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags);netfs_subreq_terminated (subreq, err ?: total, false); }
fs/afs/file.c +2 -1
@@ -242,7 +242,8 @@ static void afs_fetch_data_notify(struct afs_operation *op) req->error = error;if (subreq) { -__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags); +if (subreq->rreq->origin !=NETFS_DIO_READ ) +__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags);netfs_subreq_terminated (subreq, error ?: req->actual_len, false); req->subreq =NULL ; }else if (req->done) {
fs/ceph/addr.c +4 -2
@@ -246,7 +246,8 @@ static void finish_netfs_read(struct ceph_osd_request *req)if (err >=0 ) {if (sparse && err >0 ) err =ceph_sparse_ext_map_end (op); -if (err < subreq->len) +if (err < subreq->len && + subreq->rreq->origin !=NETFS_DIO_READ )__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags);if (IS_ENCRYPTED (inode) && err >0 ) { err = ceph_fscrypt_decrypt_extents(inode,
@@ -282,7 +283,8 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)size_t len;int mode; -__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags); +if (rreq->origin !=NETFS_DIO_READ ) +__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags);__clear_bit (NETFS_SREQ_COPY_TO_CACHE , &subreq->flags);if (subreq->start >= inode->i_size)
fs/netfs/io.c +11 -6
@@ -530,7 +530,8 @@ void netfs_subreq_terminated(struct netfs_io_subrequest *subreq,if (transferred_or_error ==0 ) {if (__test_and_set_bit (NETFS_SREQ_NO_PROGRESS , &subreq->flags)) { - subreq->error = -ENODATA ; +if (rreq->origin !=NETFS_DIO_READ ) + subreq->error = -ENODATA ; goto failed; } }else {
@@ -601,9 +602,14 @@ netfs_rreq_prepare_read(struct netfs_io_request *rreq, }if (subreq->len > ictx->zero_point - subreq->start) subreq->len = ictx->zero_point - subreq->start; + +/* We limit buffered reads to the EOF, but let the +* server deal with larger-than-EOF DIO/unbuffered +* reads. +*/ +if (subreq->len > rreq->i_size - subreq->start) + subreq->len = rreq->i_size - subreq->start; } -if (subreq->len > rreq->i_size - subreq->start) - subreq->len = rreq->i_size - subreq->start;if (rreq->rsize && subreq->len > rreq->rsize) subreq->len = rreq->rsize;
@@ -739,11 +745,10 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync) do { kdebug("submit %llx + %llx >= %llx", rreq->start, rreq->submitted, rreq->i_size); - if (rreq->origin == NETFS_DIO_READ && - rreq->start + rreq->submitted >= rreq->i_size) - break; if (!netfs_rreq_submit_slice(rreq, &io_iter)) break; + if (test_bit(NETFS_SREQ_NO_PROGRESS, &rreq->flags)) + break; if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) && test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags)) break;
fs/nfs/fscache.c +2 -1
@@ -361,7 +361,8 @@ void nfs_netfs_read_completion(struct nfs_pgio_header *hdr)return ; sreq = netfs->sreq; -if (test_bit (NFS_IOHDR_EOF , &hdr->flags)) +if (test_bit (NFS_IOHDR_EOF , &hdr->flags) && + sreq->rreq->origin !=NETFS_DIO_READ )__set_bit (NETFS_SREQ_CLEAR_TAIL , &sreq->flags);if (hdr->error)
fs/smb/client/file.c +2 -1
@@ -196,7 +196,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq) goto out; } -__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags); +if (subreq->rreq->origin !=NETFS_DIO_READ ) +__set_bit (NETFS_SREQ_CLEAR_TAIL , &subreq->flags); rc = rdata->server->ops->async_readv (rdata); out:
Signature · 1 line
2.43.0
Dominique Martinet
maintainerRe: [PATCH 6.10 083/273] 9p: Fix DIO read through netfs
Greg Kroah-Hartman wrote on Tue, Aug 27, 2024 at 04:36:47PM +0200:
Quoted 3 lines
From: Dominique Martinet <[email protected]>
[ Upstream commit
e3786b29c54cdae3490b07180a54e2461f42144c]
As much as I'd like to have this in, it breaks cifs so please hold this
patch until at least these two patches also get backported (I didn't
actually test the fix so not sure which is needed, *probably*
either/both):950b03d0f66 ("netfs: Fix missing iterator reset on retry of short read")
https://lore.kernel.org/r/[email protected] ("netfs, cifs: Fix handling of short DIO read")
For some reason the former got in master but the later wasn't despite having been sent together, I might have missed some mails and only the first might actually be required.. David, Steve please let us know if just the first is enough.
Either way the 9p patch can wait a couple more weeks; stuck debian CI (9p) is bad but cifs corruptions are worse.
Thanks,
Signature · 1 line
Dominique
Re: [PATCH 6.10 083/273] 9p: Fix DIO read through netfs
We are working through this regression with David this week - hopefully will have more info in a few days
Quoted 25 lines · Dominique Martinet
Greg Kroah-Hartman wrote on Tue, Aug 27, 2024 at 04:36:47PM +0200:
Quoted 3 lines
From: Dominique Martinet <[email protected]>
[ Upstream commit
e3786b29c54cdae3490b07180a54e2461f42144c]As much as I'd like to have this in, it breaks cifs so please hold this
patch until at least these two patches also get backported (I didn't
actually test the fix so not sure which is needed, *probably*
either/both):950b03d0f66("netfs: Fix missing iterator reset on retry of short read")
https://lore.kernel.org/r/[email protected] ("netfs, cifs: Fix handling of short DIO read")For some reason the former got in master but the later wasn't despite having been sent together, I might have missed some mails and only the first might actually be required.. David, Steve please let us know if just the first is enough.
Either way the 9p patch can wait a couple more weeks; stuck debian CI (9p) is bad but cifs corruptions are worse.
Thanks,
--
Dominique
Signature · 3 lines
Thanks, Steve
Greg Kroah-Hartman
maintainerRe: [PATCH 6.10 083/273] 9p: Fix DIO read through netfs
In reply to Dominique MartinetQuoted 12 lines · Dominique Martinet
Greg Kroah-Hartman wrote on Tue, Aug 27, 2024 at 04:36:47PM +0200:
Quoted 3 lines
From: Dominique Martinet <[email protected]>
[ Upstream commit
e3786b29c54cdae3490b07180a54e2461f42144c]As much as I'd like to have this in, it breaks cifs so please hold this
patch until at least these two patches also get backported (I didn't
actually test the fix so not sure which is needed, *probably*
either/both):950b03d0f66("netfs: Fix missing iterator reset on retry of short read")
https://lore.kernel.org/r/[email protected] ("netfs, cifs: Fix handling of short DIO read")
Quoted 7 lines
For some reason the former got in master but the later wasn't despite having been sent together, I might have missed some mails and only the first might actually be required.. David, Steve please let us know if just the first is enough.
Either way the 9p patch can wait a couple more weeks; stuck debian CI (9p) is bad but cifs corruptions are worse.
Ok, now dropped, thanks!
greg k-h
Greg Kroah-Hartman
maintainerPATCH 84/273 btrfs: fix invalid mapping of extent xarray state
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
[ Upstream commit 6252690f7e1b173b86a4c27dfc046b351ab423e7 ]
In __extent_writepage_io(), we call btrfs_set_range_writeback() -> folio_start_writeback(), which clears PAGECACHE_TAG_DIRTY mark from the mapping xarray if the folio is not dirty. This worked fine before commit 97713b1a2ced ("btrfs: do not clear page dirty inside extent_write_locked_range()").
After the commit, however, the folio is still dirty at this point, so the mapping DIRTY tag is not cleared anymore. Then, __extent_writepage_io() calls btrfs_folio_clear_dirty() to clear the folio's dirty flag. That results in the page being unlocked with a "strange" state. The page is not PageDirty, but the mapping tag is set as PAGECACHE_TAG_DIRTY.
This strange state looks like causing a hang with a call trace below when running fstests generic/091 on a null_blk device. It is waiting for a folio lock.
While I don't have an exact relation between this hang and the strange state, fixing the state also fixes the hang. And, that state is worth fixing anyway.
This commit reorders btrfs_folio_clear_dirty() and btrfs_set_range_writeback() in __extent_writepage_io(), so that the PAGECACHE_TAG_DIRTY tag is properly removed from the xarray.
[464.274] task:fsx state:D stack:0 pid:3034 tgid:3034 ppid:2853 flags:0x00004002 [464.286] Call Trace: [464.291] <TASK> [464.295] __schedule+0x10ed/0x6260 [464.301] ? __pfx___blk_flush_plug+0x10/0x10 [464.308] ? __submit_bio+0x37c/0x450 [464.314] ? __pfx___schedule+0x10/0x10 [464.321] ? lock_release+0x567/0x790 [464.327] ? __pfx_lock_acquire+0x10/0x10 [464.334] ? __pfx_lock_release+0x10/0x10 [464.340] ? __pfx_lock_acquire+0x10/0x10 [464.347] ? __pfx_lock_release+0x10/0x10 [464.353] ? do_raw_spin_lock+0x12e/0x270 [464.360] schedule+0xdf/0x3b0 [464.365] io_schedule+0x8f/0xf0 [464.371] folio_wait_bit_common+0x2ca/0x6d0 [464.378] ? folio_wait_bit_common+0x1cc/0x6d0 [464.385] ? __pfx_folio_wait_bit_common+0x10/0x10 [464.392] ? __pfx_filemap_get_folios_tag+0x10/0x10 [464.400] ? __pfx_wake_page_function+0x10/0x10 [464.407] ? __pfx___might_resched+0x10/0x10 [464.414] ? do_raw_spin_unlock+0x58/0x1f0 [464.420] extent_write_cache_pages+0xe49/0x1620 [btrfs] [464.428] ? lock_acquire+0x435/0x500 [464.435] ? __pfx_extent_write_cache_pages+0x10/0x10 [btrfs] [464.443] ? btrfs_do_write_iter+0x493/0x640 [btrfs] [464.451] ? orc_find.part.0+0x1d4/0x380 [464.457] ? __pfx_lock_release+0x10/0x10 [464.464] ? __pfx_lock_release+0x10/0x10 [464.471] ? btrfs_do_write_iter+0x493/0x640 [btrfs] [464.478] btrfs_writepages+0x1cc/0x460 [btrfs] [464.485] ? __pfx_btrfs_writepages+0x10/0x10 [btrfs] [464.493] ? is_bpf_text_address+0x6e/0x100 [464.500] ? kernel_text_address+0x145/0x160 [464.507] ? unwind_get_return_address+0x5e/0xa0 [464.514] ? arch_stack_walk+0xac/0x100 [464.521] do_writepages+0x176/0x780 [464.527] ? lock_release+0x567/0x790 [464.533] ? __pfx_do_writepages+0x10/0x10 [464.540] ? __pfx_lock_acquire+0x10/0x10 [464.546] ? __pfx_stack_trace_save+0x10/0x10 [464.553] ? do_raw_spin_lock+0x12e/0x270 [464.560] ? do_raw_spin_unlock+0x58/0x1f0 [464.566] ? _raw_spin_unlock+0x23/0x40 [464.573] ? wbc_attach_and_unlock_inode+0x3da/0x7d0 [464.580] filemap_fdatawrite_wbc+0x113/0x180 [464.587] ? prepare_pages.constprop.0+0x13c/0x5c0 [btrfs] [464.596] __filemap_fdatawrite_range+0xaf/0xf0 [464.603] ? __pfx___filemap_fdatawrite_range+0x10/0x10 [464.611] ? trace_irq_enable.constprop.0+0xce/0x110 [464.618] ? kasan_quarantine_put+0xd7/0x1e0 [464.625] btrfs_start_ordered_extent+0x46f/0x570 [btrfs] [464.633] ? __pfx_btrfs_start_ordered_extent+0x10/0x10 [btrfs] [464.642] ? __clear_extent_bit+0x2c0/0x9d0 [btrfs] [464.650] btrfs_lock_and_flush_ordered_range+0xc6/0x180 [btrfs] [464.659] ? __pfx_btrfs_lock_and_flush_ordered_range+0x10/0x10 [btrfs] [464.669] btrfs_read_folio+0x12a/0x1d0 [btrfs] [464.676] ? __pfx_btrfs_read_folio+0x10/0x10 [btrfs] [464.684] ? __pfx_filemap_add_folio+0x10/0x10 [464.691] ? __pfx___might_resched+0x10/0x10 [464.698] ? __filemap_get_folio+0x1c5/0x450 [464.705] prepare_uptodate_page+0x12e/0x4d0 [btrfs] [464.713] prepare_pages.constprop.0+0x13c/0x5c0 [btrfs] [464.721] ? fault_in_iov_iter_readable+0xd2/0x240 [464.729] btrfs_buffered_write+0x5bd/0x12f0 [btrfs] [464.737] ? __pfx_btrfs_buffered_write+0x10/0x10 [btrfs] [464.745] ? __pfx_lock_release+0x10/0x10 [464.752] ? generic_write_checks+0x275/0x400 [464.759] ? down_write+0x118/0x1f0 [464.765] ? up_write+0x19b/0x500 [464.770] btrfs_direct_write+0x731/0xba0 [btrfs] [464.778] ? __pfx_btrfs_direct_write+0x10/0x10 [btrfs] [464.785] ? __pfx___might_resched+0x10/0x10 [464.792] ? lock_acquire+0x435/0x500 [464.798] ? lock_acquire+0x435/0x500 [464.804] btrfs_do_write_iter+0x494/0x640 [btrfs] [464.811] ? __pfx_btrfs_do_write_iter+0x10/0x10 [btrfs] [464.819] ? __pfx___might_resched+0x10/0x10 [464.825] ? rw_verify_area+0x6d/0x590 [464.831] vfs_write+0x5d7/0xf50 [464.837] ? __might_fault+0x9d/0x120 [464.843] ? __pfx_vfs_write+0x10/0x10 [464.849] ? btrfs_file_llseek+0xb1/0xfb0 [btrfs] [464.856] ? lock_release+0x567/0x790 [464.862] ksys_write+0xfb/0x1d0 [464.867] ? __pfx_ksys_write+0x10/0x10 [464.873] ? _raw_spin_unlock+0x23/0x40 [464.879] ? btrfs_getattr+0x4af/0x670 [btrfs] [464.886] ? vfs_getattr_nosec+0x79/0x340 [464.892] do_syscall_64+0x95/0x180 [464.898] ? __do_sys_newfstat+0xde/0xf0 [464.904] ? __pfx___do_sys_newfstat+0x10/0x10 [464.911] ? trace_irq_enable.constprop.0+0xce/0x110 [464.918] ? syscall_exit_to_user_mode+0xac/0x2a0 [464.925] ? do_syscall_64+0xa1/0x180 [464.931] ? trace_irq_enable.constprop.0+0xce/0x110 [464.939] ? trace_irq_enable.constprop.0+0xce/0x110 [464.946] ? syscall_exit_to_user_mode+0xac/0x2a0 [464.953] ? btrfs_file_llseek+0xb1/0xfb0 [btrfs] [464.960] ? do_syscall_64+0xa1/0x180 [464.966] ? btrfs_file_llseek+0xb1/0xfb0 [btrfs] [464.973] ? trace_irq_enable.constprop.0+0xce/0x110 [464.980] ? syscall_exit_to_user_mode+0xac/0x2a0 [464.987] ? __pfx_btrfs_file_llseek+0x10/0x10 [btrfs] [464.995] ? trace_irq_enable.constprop.0+0xce/0x110 [465.002] ? __pfx_btrfs_file_llseek+0x10/0x10 [btrfs] [465.010] ? do_syscall_64+0xa1/0x180 [465.016] ? lock_release+0x567/0x790 [465.022] ? __pfx_lock_acquire+0x10/0x10 [465.028] ? __pfx_lock_release+0x10/0x10 [465.034] ? trace_irq_enable.constprop.0+0xce/0x110 [465.042] ? syscall_exit_to_user_mode+0xac/0x2a0 [465.049] ? do_syscall_64+0xa1/0x180 [465.055] ? syscall_exit_to_user_mode+0xac/0x2a0 [465.062] ? do_syscall_64+0xa1/0x180 [465.068] ? syscall_exit_to_user_mode+0xac/0x2a0 [465.075] ? do_syscall_64+0xa1/0x180 [465.081] ? clear_bhb_loop+0x25/0x80 [465.087] ? clear_bhb_loop+0x25/0x80 [465.093] ? clear_bhb_loop+0x25/0x80 [465.099] entry_SYSCALL_64_after_hwframe+0x76/0x7e [465.106] RIP: 0033:0x7f093b8ee784 [465.111] RSP: 002b:00007ffc29d31b28 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [465.122] RAX: ffffffffffffffda RBX: 0000000000006000 RCX: 00007f093b8ee784 [465.131] RDX: 000000000001de00 RSI: 00007f093b6ed200 RDI: 0000000000000003 [465.141] RBP: 000000000001de00 R08: 0000000000006000 R09: 0000000000000000 [465.150] R10: 0000000000023e00 R11: 0000000000000202 R12: 0000000000006000 [465.160] R13: 0000000000023e00 R14: 0000000000023e00 R15: 0000000000000001 [465.170] </TASK> [465.174] INFO: lockdep is turned off.
--- fs/btrfs/extent_io.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/extent_io.c +7 -7
@@ -1420,6 +1420,13 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,free_extent_map (em); em =NULL ; +/* +* Although the PageDirty bit might be cleared before entering +* this function, subpage dirty bit is not cleared. +* So clear subpage dirty bit here so next time we won't submit +* page for range already written to disk. +*/ +btrfs_folio_clear_dirty (fs_info,page_folio (page), cur, iosize);btrfs_set_range_writeback (inode, cur, cur + iosize -1 );if (!PageWriteback (page)) { btrfs_err(inode->root->fs_info,
@@ -1427,13 +1434,6 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode, page->index, cur, end); } -/* -* Although the PageDirty bit is cleared before entering this -* function, subpage dirty bit is not cleared. -* So clear subpage dirty bit here so next time we won't submit -* page for range already written to disk. -*/ -btrfs_folio_clear_dirty (fs_info,page_folio (page), cur, iosize);submit_extent_page (bio_ctrl, disk_bytenr, page, iosize, cur -page_offset (page));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 85/273 igc: Fix packet still tx after gate close by reducing i226 MAC retry buffer
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faizal Rahim <[email protected]>
[ Upstream commit e037a26ead187901f83cad9c503ccece5ff6817a ]
Testing uncovered that even when the taprio gate is closed, some packets still transmit.
According to i225/6 hardware errata [1], traffic might overflow the planned QBV window. This happens because MAC maintains an internal buffer, primarily for supporting half duplex retries. Therefore, even when the gate closes, residual MAC data in the buffer may still transmit.
To mitigate this for i226, reduce the MAC's internal buffer from 192 bytes to the recommended 88 bytes by modifying the RETX_CTL register value.
This follows guidelines from:
[1] Ethernet Controller I225/I22 Spec Update Rev 2.1 Errata Item 9:
TSN: Packet Transmission Might Cross Qbv Window
[2] I225/6 SW User Manual Rev 1.2.4: Section 8.11.5 Retry Buffer Control
Note that the RETX_CTL register can't be used in TSN mode because half duplex feature cannot coexist with TSN.
Test Steps:
1. Send taprio cmd to board A:
tc qdisc replace dev enp1s0 parent root handle 100 taprio \
num_tc 4 \
map 3 2 1 0 3 3 3 3 3 3 3 3 3 3 3 3 \
queues 1@0 1@1 1@2 1@3 \
base-time 0 \
sched-entry S 0x07 500000 \
sched-entry S 0x0f 500000 \
flags 0x2 \
txtime-delay 0
Note that for TC3, gate should open for 500us and close for another
500us.3. Take tcpdump log on Board B.
4. Send udp packets via UDP tai app from Board A to Board B.
5. Analyze tcpdump log via wireshark log on Board B. Ensure that the total time from the first to the last packet received during one cycle for TC3 does not exceed 500us.
--- drivers/net/ethernet/intel/igc/igc_defines.h | 6 ++++ drivers/net/ethernet/intel/igc/igc_tsn.c | 34 ++++++++++++++++++++ 2 files changed, 40 insertions(+)
drivers/net/ethernet/intel/igc/igc_defines.h +6 -0
@@ -404,6 +404,12 @@#define IGC_DTXMXPKTSZ_TSN 0x19/* 1600 bytes of max TX DMA packet size */ #define IGC_DTXMXPKTSZ_DEFAULT 0x98/* 9728-byte Jumbo frames */ +/* Retry Buffer Control */ +#define IGC_RETX_CTL 0x041C +#define IGC_RETX_CTL_WATERMARK_MASK 0xF +#define IGC_RETX_CTL_QBVFULLTH_SHIFT 8/* QBV Retry Buffer Full Threshold */ +#define IGC_RETX_CTL_QBVFULLEN 0x1000/* Enable QBV Retry Buffer Full Threshold */ +/* Transmit Scheduling Latency */ /* Latency between transmission scheduling (LaunchTime) and the time * the packet is transmitted to the network in nanosecond.
drivers/net/ethernet/intel/igc/igc_tsn.c +34 -0
@@ -78,6 +78,15 @@ void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter)wr32 (IGC_GTXOFFSET , txoffset); } +static void igc_tsn_restore_retx_default (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; +u32 retxctl; + + retxctl =rd32 (IGC_RETX_CTL ) &IGC_RETX_CTL_WATERMARK_MASK ; +wr32 (IGC_RETX_CTL , retxctl); +} +/* Returns the TSN specific registers to their default values after * the adapter is reset. */
@@ -91,6 +100,9 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)wr32 (IGC_TXPBS ,I225_TXPBSIZE_DEFAULT );wr32 (IGC_DTXMXPKTSZ ,IGC_DTXMXPKTSZ_DEFAULT ); +if (igc_is_device_id_i226 (hw)) +igc_tsn_restore_retx_default (adapter); + tqavctrl =rd32 (IGC_TQAVCTRL ); tqavctrl &= ~(IGC_TQAVCTRL_TRANSMIT_MODE_TSN |IGC_TQAVCTRL_ENHANCED_QAV |IGC_TQAVCTRL_FUTSCDDIS );
@@ -111,6 +123,25 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)return 0 ; } +/* To partially fix i226 HW errata, reduce MAC internal buffering from 192 Bytes +* to 88 Bytes by setting RETX_CTL register using the recommendation from: +* a) Ethernet Controller I225/I226 Specification Update Rev 2.1 +* Item 9: TSN: Packet Transmission Might Cross the Qbv Window +* b) I225/6 SW User Manual Rev 1.2.4: Section 8.11.5 Retry Buffer Control +*/ +static void igc_tsn_set_retx_qbvfullthreshold (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; +u32 retxctl, watermark; + + retxctl =rd32 (IGC_RETX_CTL ); + watermark = retxctl &IGC_RETX_CTL_WATERMARK_MASK ; +/* Set QBVFULLTH value using watermark and set QBVFULLEN */ + retxctl |= (watermark <<IGC_RETX_CTL_QBVFULLTH_SHIFT ) | +IGC_RETX_CTL_QBVFULLEN ; +wr32 (IGC_RETX_CTL , retxctl); +} +static int igc_tsn_enable_offload (struct igc_adapter *adapter) {struct igc_hw *hw = &adapter->hw;
@@ -123,6 +154,9 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)wr32 (IGC_DTXMXPKTSZ ,IGC_DTXMXPKTSZ_TSN );wr32 (IGC_TXPBS ,IGC_TXPBSIZE_TSN ); +if (igc_is_device_id_i226 (hw)) +igc_tsn_set_retx_qbvfullthreshold (adapter); +for (i =0 ; i < adapter->num_tx_queues; i++) {struct igc_ring *ring = adapter->tx_ring[i];u32 txqctl =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 86/273 igc: Fix qbv_config_change_errors logics
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faizal Rahim <[email protected]>
[ Upstream commit f8d6acaee9d35cbff3c3cfad94641666c596f8da ]
When user issues these cmds:
1. Either a) or b)
a) mqprio with hardware offload disabled
b) taprio with txtime-assist feature enabled
2. etf
3. tc qdisc delete
4. taprio with base time in the past
At step 4, qbv_config_change_errors wrongly increased by 1.
Excerpt from IEEE 802.1Q-2018 8.6.9.3.1:
"If AdminBaseTime specifies a time in the past, and the current schedule is running, then: Increment ConfigChangeError counter"
qbv_config_change_errors should only increase if base time is in the past and no taprio is active. In user perspective, taprio was not active when first triggered at step 4. However, i225/6 reuses qbv for etf, so qbv is enabled with a dummy schedule at step 2 where it enters igc_tsn_enable_offload() and qbv_count got incremented to 1. At step 4, it enters igc_tsn_enable_offload() again, qbv_count is incremented to 2. Because taprio is running, tc_setup_type is TC_SETUP_QDISC_ETF and qbv_count > 1, qbv_config_change_errors value got incremented.
This issue happens due to reliance on qbv_count field where a non-zero value indicates that taprio is running. But qbv_count increases regardless if taprio is triggered by user or by other tsn feature. It does not align with qbv_config_change_errors expectation where it is only concerned with taprio triggered by user.
Fixing this by relocating the qbv_config_change_errors logic to igc_save_qbv_schedule(), eliminating reliance on qbv_count and its inaccuracies from i225/6's multiple uses of qbv feature for other TSN features.
The new function created: igc_tsn_is_taprio_activated_by_user() uses taprio_offload_enable field to indicate that the current running taprio was triggered by user, instead of triggered by non-qbv feature like etf.
--- drivers/net/ethernet/intel/igc/igc_main.c | 8 ++++++-- drivers/net/ethernet/intel/igc/igc_tsn.c | 16 ++++++++-------- drivers/net/ethernet/intel/igc/igc_tsn.h | 1 + 3 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +6 -2
@@ -6319,12 +6319,16 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,if (!validate_schedule (adapter, qopt))return -EINVAL ; +igc_ptp_read (adapter, &now); + +if (igc_tsn_is_taprio_activated_by_user (adapter) && +is_base_time_past (qopt->base_time, &now)) + adapter->qbv_config_change_errors++; + adapter->cycle_time = qopt->cycle_time; adapter->base_time = qopt->base_time; adapter->taprio_offload_enable = true; -igc_ptp_read (adapter, &now); -for (n =0 ; n < qopt->num_entries; n++) {struct tc_taprio_sched_entry *e = &qopt->entries[n];
drivers/net/ethernet/intel/igc/igc_tsn.c +8 -8
@@ -87,6 +87,14 @@ static void igc_tsn_restore_retx_default(struct igc_adapter *adapter)wr32 (IGC_RETX_CTL , retxctl); } +bool igc_tsn_is_taprio_activated_by_user (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; + +return (rd32 (IGC_BASET_H ) ||rd32 (IGC_BASET_L )) && + adapter->taprio_offload_enable; +} +/* Returns the TSN specific registers to their default values after * the adapter is reset. */
@@ -296,14 +304,6 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)s64 n =div64_s64 (ktime_sub_ns (systim, base_time), cycle); base_time =ktime_add_ns (base_time, (n +1 ) * cycle); - -/* Increase the counter if scheduling into the past while -* Gate Control List (GCL) is running. -*/ -if ((rd32 (IGC_BASET_H ) ||rd32 (IGC_BASET_L )) && - (adapter->tc_setup_type ==TC_SETUP_QDISC_TAPRIO ) && - (adapter->qbv_count >1 )) - adapter->qbv_config_change_errors++; }else {if (igc_is_device_id_i226 (hw)) {ktime_t adjust_time, expires_time;
drivers/net/ethernet/intel/igc/igc_tsn.h +1 -0
@@ -7,5 +7,6 @@int igc_tsn_offload_apply (struct igc_adapter *adapter);int igc_tsn_reset (struct igc_adapter *adapter);void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter); +bool igc_tsn_is_taprio_activated_by_user (struct igc_adapter *adapter);#endif /* _IGC_BASE_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 87/273 igc: Fix reset adapter logics when tx mode change
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faizal Rahim <[email protected]>
[ Upstream commit 0afeaeb5dae86aceded0d5f0c3a54d27858c0c6f ]
Following the "igc: Fix TX Hang issue when QBV Gate is close" changes, remaining issues with the reset adapter logic in igc_tsn_offload_apply() have been observed:
1. The reset adapter logics for i225 and i226 differ, although they should be the same according to the guidelines in I225/6 HW Design Section 7.5.2.1 on software initialization during tx mode changes.
2. The i225 resets adapter every time, even though tx mode doesn't change. This occurs solely based on the condition igc_is_device_id_i225() when calling schedule_work().
3. i226 doesn't reset adapter for tsn->legacy tx mode changes. It only resets adapter for legacy->tsn tx mode transitions.
4. qbv_count introduced in the patch is actually not needed; in this context, a non-zero value of qbv_count is used to indicate if tx mode was unconditionally set to tsn in igc_tsn_enable_offload(). This could be replaced by checking the existing register IGC_TQAVCTRL_TRANSMIT_MODE_TSN bit.
This patch resolves all issues and enters schedule_work() to reset the adapter only when changing tx mode. It also removes reliance on qbv_count.
qbv_count field will be removed in a future patch.
Test ran:
1. Verify reset adapter behaviour in i225/6:
a) Enrol a new GCL
Reset adapter observed (tx mode change legacy->tsn)
b) Enrol a new GCL without deleting qdisc
No reset adapter observed (tx mode remain tsn->tsn)
c) Delete qdisc
Reset adapter observed (tx mode change tsn->legacy)2. Tested scenario from "igc: Fix TX Hang issue when QBV Gate is closed" to confirm it remains resolved.
--- drivers/net/ethernet/intel/igc/igc_tsn.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +19 -5
@@ -49,6 +49,13 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)return new_flags; } +static bool igc_tsn_is_tx_mode_in_tsn (struct igc_adapter *adapter) +{ +struct igc_hw *hw = &adapter->hw; + +return !!(rd32 (IGC_TQAVCTRL ) &IGC_TQAVCTRL_TRANSMIT_MODE_TSN ); +} +void igc_tsn_adjust_txtime_offset (struct igc_adapter *adapter) {struct igc_hw *hw = &adapter->hw;
@@ -365,15 +372,22 @@ int igc_tsn_reset(struct igc_adapter *adapter)return err; } -int igc_tsn_offload_apply (struct igc_adapter *adapter) +static bool igc_tsn_will_tx_mode_change (struct igc_adapter *adapter) { -struct igc_hw *hw = &adapter->hw; +bool any_tsn_enabled = !!(igc_tsn_new_flags (adapter) & +IGC_FLAG_TSN_ANY_ENABLED ); + +return (any_tsn_enabled && !igc_tsn_is_tx_mode_in_tsn (adapter)) || + (!any_tsn_enabled &&igc_tsn_is_tx_mode_in_tsn (adapter)); +} -/* Per I225/6 HW Design Section 7.5.2.1, transmit mode -* cannot be changed dynamically. Require reset the adapter. +int igc_tsn_offload_apply (struct igc_adapter *adapter) +{ +/* Per I225/6 HW Design Section 7.5.2.1 guideline, if tx mode change +* from legacy->tsn or tsn->legacy, then reset adapter is needed. */ if (netif_running (adapter->netdev) && - (igc_is_device_id_i225 (hw) || !adapter->qbv_count)) { +igc_tsn_will_tx_mode_change (adapter)) {schedule_work (&adapter->reset_task);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 88/273 igc: Fix qbv tx latency by setting gtxoffset
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Faizal Rahim <[email protected]>
[ Upstream commit 6c3fc0b1c3d073bd6fc3bf43dbd0e64240537464 ]
A large tx latency issue was discovered during testing when only QBV was enabled. The issue occurs because gtxoffset was not set when QBV is active, it was only set when launch time is active.
The patch "igc: Correct the launchtime offset" only sets gtxoffset when the launchtime_enable field is set by the user. Enabling launchtime_enable ultimately sets the register IGC_TXQCTL_QUEUE_MODE_LAUNCHT (referred to as LaunchT in the SW user manual).
Section 7.5.2.6 of the IGC i225/6 SW User Manual Rev 1.2.4 states:
"The latency between transmission scheduling (launch time) and the time the packet is transmitted to the network is listed in Table 7-61."
However, the patch misinterprets the phrase "launch time" in that section by assuming it specifically refers to the LaunchT register, whereas it actually denotes the generic term for when a packet is released from the internal buffer to the MAC transmit logic.
This launch time, as per that section, also implicitly refers to the QBV gate open time, where a packet waits in the buffer for the QBV gate to open. Therefore, latency applies whenever QBV is in use. TSN features such as QBU and QAV reuse QBV, making the latency universal to TSN features.
Discussed with i226 HW owner (Shalev, Avi) and we were in agreement that the term "launch time" used in Section 7.5.2.6 is not clear and can be easily misinterpreted. Avi will update this section to:
"When TQAVCTRL.TRANSMIT_MODE = TSN, the latency between transmission scheduling and the time the packet is transmitted to the network is listed in Table 7-61."
Fix this issue by using igc_tsn_is_tx_mode_in_tsn() as a condition to write to gtxoffset, aligning with the newly updated SW User Manual.
Tested:
1. Enrol taprio on talker board
base-time 0
cycle-time 1000000
flags 0x2
index 0 cmd S gatemask 0x1 interval1
index 0 cmd S gatemask 0x1 interval2
Note:
interval1 = interval for a 64 bytes packet to go through interval2 = cycle-time - interval1
2. Take tcpdump on listener board
3. Use udp tai app on talker to send packets to listener
4. Check the timestamp on listener via wireshark
Test Result:
100 Mbps: 113 ~193 ns
1000 Mbps: 52 ~ 84 ns
2500 Mbps: 95 ~ 223 ns
Note that the test result is similar to the patch "igc: Correct the launchtime offset".
--- drivers/net/ethernet/intel/igc/igc_tsn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_tsn.c +1 -1
@@ -61,7 +61,7 @@ void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter)struct igc_hw *hw = &adapter->hw;u16 txoffset; -if (!is_any_launchtime (adapter)) +if (!igc_tsn_is_tx_mode_in_tsn (adapter))return ;switch (adapter->link_speed) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 89/273 gtp: pull network headers in gtp_dev_xmit()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3a3be7ff9224f424e485287b54be00d2c6bd9c40 ]
syzbot/KMSAN reported use of uninit-value in get_dev_xmit() [1]
We must make sure the IPv4 or Ipv6 header is pulled in skb->head before accessing fields in them.
Use pskb_inet_may_pull() to fix this issue.
[1]
BUG: KMSAN: uninit-value in ipv6_pdp_find drivers/net/gtp.c:220 [inline] BUG: KMSAN: uninit-value in gtp_build_skb_ip6 drivers/net/gtp.c:1229 [inline] BUG: KMSAN: uninit-value in gtp_dev_xmit+0x1424/0x2540 drivers/net/gtp.c:1281 ipv6_pdp_find drivers/net/gtp.c:220 [inline] gtp_build_skb_ip6 drivers/net/gtp.c:1229 [inline] gtp_dev_xmit+0x1424/0x2540 drivers/net/gtp.c:1281 __netdev_start_xmit include/linux/netdevice.h:4913 [inline] netdev_start_xmit include/linux/netdevice.h:4922 [inline] xmit_one net/core/dev.c:3580 [inline] dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3596 __dev_queue_xmit+0x358c/0x5610 net/core/dev.c:4423 dev_queue_xmit include/linux/netdevice.h:3105 [inline] packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3145 [inline] packet_sendmsg+0x90e3/0xa3a0 net/packet/af_packet.c:3177 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 __sys_sendto+0x685/0x830 net/socket.c:2204 __do_sys_sendto net/socket.c:2216 [inline] __se_sys_sendto net/socket.c:2212 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2212 x64_sys_call+0x3799/0x3c10 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:3994 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4080 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:583 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:674 alloc_skb include/linux/skbuff.h:1320 [inline] alloc_skb_with_frags+0xc8/0xbf0 net/core/skbuff.c:6526 sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2815 packet_alloc_skb net/packet/af_packet.c:2994 [inline] packet_snd net/packet/af_packet.c:3088 [inline] packet_sendmsg+0x749c/0xa3a0 net/packet/af_packet.c:3177 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 __sys_sendto+0x685/0x830 net/socket.c:2204 __do_sys_sendto net/socket.c:2216 [inline] __se_sys_sendto net/socket.c:2212 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2212 x64_sys_call+0x3799/0x3c10 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 0 UID: 0 PID: 7115 Comm: syz.1.515 Not tainted 6.11.0-rc1-syzkaller-00043-g94ede2a3e913 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
--- drivers/net/gtp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/gtp.c +3 -0
@@ -1269,6 +1269,9 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)if (skb_cow_head (skb, dev->needed_headroom)) goto tx_err; +if (!pskb_inet_may_pull (skb)) + goto tx_err; +skb_reset_inner_headers (skb);/* PDP context lookups in gtp_build_skb_*() need rcu read-side lock. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 90/273 net/mlx5: SD, Do not query MPIR register if no sd_group
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
[ Upstream commit c31fe2b5095d8c84562ce90db07600f7e9f318df ]
Unconditionally calling the MPIR query on BF separate mode yields the FW syndrome below [1]. Do not call it unless admin clearly specified the SD group, i.e. expressing the intention of using the multi-PF netdev feature.
This fix covers cases not covered in
commit fca3b4791850 ("net/mlx5: Do not query MPIR on embedded CPU function").
[1]
mlx5_cmd_out_err:808:(pid 8267): ACCESS_REG(0x805) op_mod(0x1) failed, status bad system state(0x4), syndrome (0x685f19), err(-5)
--- .../net/ethernet/mellanox/mlx5/core/lib/sd.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/sd.c +9 -9
@@ -126,7 +126,7 @@ static bool mlx5_sd_is_supported(struct mlx5_core_dev *dev, u8 host_buses) }static int mlx5_query_sd (struct mlx5_core_dev *dev,bool *sdm, -u8 *host_buses,u8 *sd_group) +u8 *host_buses) {u32 out[MLX5_ST_SZ_DW (mpir_reg)];int err;
@@ -135,10 +135,6 @@ static int mlx5_query_sd(struct mlx5_core_dev *dev, bool *sdm,if (err)return err; - err =mlx5_query_nic_vport_sd_group (dev, sd_group); -if (err) -return err; - *sdm =MLX5_GET (mpir_reg, out, sdm); *host_buses =MLX5_GET (mpir_reg, out, host_buses);
@@ -166,19 +162,23 @@ static int sd_init(struct mlx5_core_dev *dev)if (mlx5_core_is_ecpf (dev))return 0 ; + err =mlx5_query_nic_vport_sd_group (dev, &sd_group); +if (err) +return err; + +if (!sd_group) +return 0 ; +if (!MLX5_CAP_MCAM_REG (dev, mpir))return 0 ; - err =mlx5_query_sd (dev, &sdm, &host_buses, &sd_group); + err =mlx5_query_sd (dev, &sdm, &host_buses);if (err)return err;if (!sdm)return 0 ; -if (!sd_group) -return 0 ; - group_id =mlx5_sd_group_id (dev, sd_group);if (!mlx5_sd_is_supported (dev, host_buses)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 91/273 net/mlx5e: Take state lock during tx timeout reporter
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Tatulea <[email protected]>
[ Upstream commit e6b5afd30b99b43682a7764e1a74a42fe4d5f4b3 ]
mlx5e_safe_reopen_channels() requires the state lock taken. The referenced changed in the Fixes tag removed the lock to fix another issue. This patch adds it back but at a later point (when calling mlx5e_safe_reopen_channels()) to avoid the deadlock referenced in the Fixes tag.
--- drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +2 -0
@@ -146,7 +146,9 @@ static int mlx5e_tx_reporter_timeout_recover(void *ctx)return err; } +mutex_lock (&priv->state_lock); err =mlx5e_safe_reopen_channels (priv); +mutex_unlock (&priv->state_lock);if (!err) { to_ctx->status =1 ;/* all channels recovered */ return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 92/273 net/mlx5e: Correctly report errors for ethtool rx flows
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <[email protected]>
[ Upstream commit cbc796be1779c4dbc9a482c7233995e2a8b6bfb3 ]
Previously, an ethtool rx flow with no attrs would not be added to the NIC as it has no rules to configure the hw with, but it would be reported as successful to the caller (return code 0). This is confusing for the user as ethtool then reports "Added rule $num", but no rule was actually added.
This change corrects that by instead reporting these wrong rules as -EINVAL.
--- drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 -1
@@ -734,7 +734,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,if (num_tuples <=0 ) {netdev_warn (priv->netdev,"%s: flow is not valid %d\n" , __func__, num_tuples); -return num_tuples; +return num_tuples <0 ? num_tuples : -EINVAL ; } eth_ft =get_flow_table (priv, fs, num_tuples);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 93/273 atm: idt77252: prevent use after free in dequeue_rx()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit a9a18e8f770c9b0703dab93580d0b02e199a4c79 ]
We can't dereference "skb" after calling vcc->push() because the skb is released.
--- drivers/atm/idt77252.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/atm/idt77252.c +5 -4
@@ -1118,8 +1118,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) rpp->len += skb->len;if (stat &SAR_RSQE_EPDU ) { +unsigned int len, truesize;unsigned char *l1l2; -unsigned int len; l1l2 = (unsigned char *) ((unsigned long ) skb->data + skb->len -6 );
@@ -1189,14 +1189,15 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)ATM_SKB (skb)->vcc = vcc;__net_timestamp (skb); + truesize = skb->truesize; vcc->push (vcc, skb);atomic_inc (&vcc->stats->rx); -if (skb->truesize >SAR_FB_SIZE_3 ) +if (truesize >SAR_FB_SIZE_3 )add_rx_skb (card,3 ,SAR_FB_SIZE_3 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_2 ) +else if (truesize >SAR_FB_SIZE_2 )add_rx_skb (card,2 ,SAR_FB_SIZE_2 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_1 ) +else if (truesize >SAR_FB_SIZE_1 )add_rx_skb (card,1 ,SAR_FB_SIZE_1 ,1 );else add_rx_skb (card,0 ,SAR_FB_SIZE_0 ,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 94/273 net: axienet: Fix register defines comment description
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radhey Shyam Pandey <[email protected]>
[ Upstream commit 9ff2f816e2aa65ca9a1cdf0954842f8173c0f48d ]
In axiethernet header fix register defines comment description to be inline with IP documentation. It updates MAC configuration register, MDIO configuration register and frame filter control description.
--- drivers/net/ethernet/xilinx/xilinx_axienet.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet.h +8 -8
@@ -160,16 +160,16 @@#define XAE_RCW1_OFFSET 0x00000404/* Rx Configuration Word 1 */ #define XAE_TC_OFFSET 0x00000408/* Tx Configuration */ #define XAE_FCC_OFFSET 0x0000040C/* Flow Control Configuration */ -#define XAE_EMMC_OFFSET 0x00000410/* EMAC mode configuration */ -#define XAE_PHYC_OFFSET 0x00000414/* RGMII/SGMII configuration */ +#define XAE_EMMC_OFFSET 0x00000410/* MAC speed configuration */ +#define XAE_PHYC_OFFSET 0x00000414/* RX Max Frame Configuration */ #define XAE_ID_OFFSET 0x000004F8/* Identification register */ -#define XAE_MDIO_MC_OFFSET 0x00000500/* MII Management Config */ -#define XAE_MDIO_MCR_OFFSET 0x00000504/* MII Management Control */ -#define XAE_MDIO_MWD_OFFSET 0x00000508/* MII Management Write Data */ -#define XAE_MDIO_MRD_OFFSET 0x0000050C/* MII Management Read Data */ +#define XAE_MDIO_MC_OFFSET 0x00000500/* MDIO Setup */ +#define XAE_MDIO_MCR_OFFSET 0x00000504/* MDIO Control */ +#define XAE_MDIO_MWD_OFFSET 0x00000508/* MDIO Write Data */ +#define XAE_MDIO_MRD_OFFSET 0x0000050C/* MDIO Read Data */ #define XAE_UAW0_OFFSET 0x00000700/* Unicast address word 0 */ #define XAE_UAW1_OFFSET 0x00000704/* Unicast address word 1 */ -#define XAE_FMI_OFFSET 0x00000708/* Filter Mask Index */ +#define XAE_FMI_OFFSET 0x00000708/* Frame Filter Control */ #define XAE_AF0_OFFSET 0x00000710/* Address Filter 0 */ #define XAE_AF1_OFFSET 0x00000714/* Address Filter 1 */
@@ -308,7 +308,7 @@*/ #define XAE_UAW1_UNICASTADDR_MASK 0x0000FFFF -/* Bit masks for Axi Ethernet FMI register */ +/* Bit masks for Axi Ethernet FMC register */ #define XAE_FMI_PM_MASK 0x80000000/* Promis. mode enable */ #define XAE_FMI_IND_MASK 0x00000003/* Index Mask */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 95/273 net: dsa: vsc73xx: fix port MAC configuration in full duplex mode
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit 63796bc2e97cd5ebcef60bad4953259d4ad11cb4 ]
According to the datasheet description ("Port Mode Procedure" in 5.6.2), the VSC73XX_MAC_CFG_WEXC_DIS bit is configured only for half duplex mode.
The WEXC_DIS bit is responsible for MAC behavior after an excessive collision. Let's set it as described in the datasheet.
--- drivers/net/dsa/vitesse-vsc73xx-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/dsa/vitesse-vsc73xx-core.c +5 -1
@@ -817,6 +817,11 @@ static void vsc73xx_mac_link_up(struct phylink_config *config,if (duplex ==DUPLEX_FULL ) val |=VSC73XX_MAC_CFG_FDX ; +else +/* In datasheet description ("Port Mode Procedure" in 5.6.2) +* this bit is configured only for half duplex. +*/ + val |=VSC73XX_MAC_CFG_WEXC_DIS ;/* This routine is described in the datasheet (below ARBDISC register * description)
@@ -827,7 +832,6 @@ static void vsc73xx_mac_link_up(struct phylink_config *config,get_random_bytes (&seed,1 ); val |= seed <<VSC73XX_MAC_CFG_SEED_OFFSET ; val |=VSC73XX_MAC_CFG_SEED_LOAD ; - val |=VSC73XX_MAC_CFG_WEXC_DIS ;vsc73xx_write (vsc,VSC73XX_BLOCK_MAC , port,VSC73XX_MAC_CFG , val);/* Flow control for the PHY facing ports:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 96/273 net: dsa: vsc73xx: pass value in phy_write operation
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit 5b9eebc2c7a5f0cc7950d918c1e8a4ad4bed5010 ]
In the 'vsc73xx_phy_write' function, the register value is missing, and the phy write operation always sends zeros.
This commit passes the value variable into the proper register.
--- drivers/net/dsa/vitesse-vsc73xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/vitesse-vsc73xx-core.c +1 -1
@@ -534,7 +534,7 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum,return 0 ; } - cmd = (phy <<21 ) | (regnum <<16 ); + cmd = (phy <<21 ) | (regnum <<16 ) | val; ret =vsc73xx_write (vsc,VSC73XX_BLOCK_MII ,0 ,1 , cmd);if (ret)return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/273 net: dsa: vsc73xx: check busy flag in MDIO operations
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit fa63c6434b6f6aaf9d8d599dc899bc0a074cc0ad ]
The VSC73xx has a busy flag used during MDIO operations. It is raised when MDIO read/write operations are in progress. Without it, PHYs are misconfigured and bus operations do not work as expected.
--- drivers/net/dsa/vitesse-vsc73xx-core.c | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/net/dsa/vitesse-vsc73xx-core.c +36 -1
@@ -38,6 +38,10 @@#define VSC73XX_BLOCK_ARBITER 0x5/* Only subblock 0 */ #define VSC73XX_BLOCK_SYSTEM 0x7/* Only subblock 0 */ +/* MII Block subblock */ +#define VSC73XX_BLOCK_MII_INTERNAL 0x0/* Internal MDIO subblock */ +#define VSC73XX_BLOCK_MII_EXTERNAL 0x1/* External MDIO subblock */ +#define CPU_PORT 6/* CPU port */ /* MAC Block registers */
@@ -196,6 +200,8 @@#define VSC73XX_MII_CMD 0x1#define VSC73XX_MII_DATA 0x2 +#define VSC73XX_MII_STAT_BUSY BIT(3) +/* Arbiter block 5 registers */ #define VSC73XX_ARBEMPTY 0x0c#define VSC73XX_ARBDISC 0x0e
@@ -270,6 +276,7 @@#define IS_739X (a) (IS_7395(a) || IS_7398(a))#define VSC73XX_POLL_SLEEP_US 1000 +#define VSC73XX_MDIO_POLL_SLEEP_US 5#define VSC73XX_POLL_TIMEOUT_US 10000struct vsc73xx_counter {
@@ -487,6 +494,22 @@ static int vsc73xx_detect(struct vsc73xx *vsc)return 0 ; } +static int vsc73xx_mdio_busy_check (struct vsc73xx *vsc) +{ +int ret, err; +u32 val; + + ret =read_poll_timeout (vsc73xx_read, err, + err <0 || !(val &VSC73XX_MII_STAT_BUSY ), +VSC73XX_MDIO_POLL_SLEEP_US , +VSC73XX_POLL_TIMEOUT_US , false, vsc, +VSC73XX_BLOCK_MII ,VSC73XX_BLOCK_MII_INTERNAL , +VSC73XX_MII_STAT , &val); +if (ret) +return ret; +return err; +} +static int vsc73xx_phy_read (struct dsa_switch *ds,int phy,int regnum) {struct vsc73xx *vsc = ds->priv;
@@ -494,12 +517,20 @@ static int vsc73xx_phy_read(struct dsa_switch *ds, int phy, int regnum)u32 val;int ret; + ret =vsc73xx_mdio_busy_check (vsc); +if (ret) +return ret; +/* Setting bit 26 means "read" */ cmd =BIT (26 ) | (phy <<21 ) | (regnum <<16 ); ret =vsc73xx_write (vsc,VSC73XX_BLOCK_MII ,0 ,1 , cmd);if (ret)return ret; -msleep (2 ); + + ret =vsc73xx_mdio_busy_check (vsc); +if (ret) +return ret; + ret =vsc73xx_read (vsc,VSC73XX_BLOCK_MII ,0 ,2 , &val);if (ret)return ret;
@@ -523,6 +554,10 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum,u32 cmd;int ret; + ret =vsc73xx_mdio_busy_check (vsc); +if (ret) +return ret; +/* It was found through tedious experiments that this router * chip really hates to have it's PHYs reset. They * never recover if that happens: autonegotiation stops
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 98/273 net: ethernet: mtk_wed: fix use-after-free panic in mtk_wed_setup_tc_block_cb()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Zhang <[email protected]>
[ Upstream commit db1b4bedb9b97c6d34b03d03815147c04fffe8b4 ]
When there are multiple ap interfaces on one band and with WED on, turning the interface down will cause a kernel panic on MT798X.
Previously, cb_priv was freed in mtk_wed_setup_tc_block() without marking NULL,and mtk_wed_setup_tc_block_cb() didn't check the value, too.
Assign NULL after free cb_priv in mtk_wed_setup_tc_block() and check NULL in mtk_wed_setup_tc_block_cb().
----------
Unable to handle kernel paging request at virtual address 0072460bca32b4f5 Call trace: mtk_wed_setup_tc_block_cb+0x4/0x38 0xffffffc0794084bc tcf_block_playback_offloads+0x70/0x1e8 tcf_block_unbind+0x6c/0xc8
...
---------
--- drivers/net/ethernet/mediatek/mtk_wed.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mediatek/mtk_wed.c +4 -2
@@ -2666,14 +2666,15 @@ mtk_wed_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri {struct mtk_wed_flow_block_priv *priv = cb_priv;struct flow_cls_offload *cls = type_data; -struct mtk_wed_hw *hw = priv->hw; +struct mtk_wed_hw *hw =NULL ; -if (!tc_can_offload (priv->dev)) +if (!priv || !tc_can_offload (priv->dev))return -EOPNOTSUPP ;if (type !=TC_SETUP_CLSFLOWER )return -EOPNOTSUPP ; + hw = priv->hw;return mtk_flow_offload_cmd (hw->eth, cls, hw->index); }
@@ -2729,6 +2730,7 @@ mtk_wed_setup_tc_block(struct mtk_wed_hw *hw, struct net_device *dev,flow_block_cb_remove (block_cb, f);list_del (&block_cb->driver_list);kfree (block_cb->cb_priv); + block_cb->cb_priv =NULL ; }return 0 ;default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 99/273 mlxbf_gige: disable RX filters until RX path initialized
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Thompson <[email protected]>
[ Upstream commit df934abb185c71c9f2fa07a5013672d0cbd36560 ]
A recent change to the driver exposed a bug where the MAC RX filters (unicast MAC, broadcast MAC, and multicast MAC) are configured and enabled before the RX path is fully initialized. The result of this bug is that after the PHY is started packets that match these MAC RX filters start to flow into the RX FIFO. And then, after rx_init() is completed, these packets will go into the driver RX ring as well. If enough packets are received to fill the RX ring (default size is 128 packets) before the call to request_irq() completes, the driver RX function becomes stuck.
This bug is intermittent but is most likely to be seen where the oob_net0 interface is connected to a busy network with lots of broadcast and multicast traffic.
All the MAC RX filters must be disabled until the RX path is ready, i.e. all initialization is done and all the IRQs are installed.
--- .../ethernet/mellanox/mlxbf_gige/mlxbf_gige.h | 8 +++ .../mellanox/mlxbf_gige/mlxbf_gige_main.c | 10 ++++ .../mellanox/mlxbf_gige/mlxbf_gige_regs.h | 2 + .../mellanox/mlxbf_gige/mlxbf_gige_rx.c | 50 ++++++++++++++++--- 4 files changed, 64 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige.h +8 -0
@@ -40,6 +40,7 @@*/ #define MLXBF_GIGE_BCAST_MAC_FILTER_IDX 0#define MLXBF_GIGE_LOCAL_MAC_FILTER_IDX 1 +#define MLXBF_GIGE_MAX_FILTER_IDX 3/* Define for broadcast MAC literal */ #define BCAST_MAC_ADDR 0xFFFFFFFFFFFF
@@ -175,6 +176,13 @@ enum mlxbf_gige_res {int mlxbf_gige_mdio_probe (struct platform_device *pdev,struct mlxbf_gige *priv);void mlxbf_gige_mdio_remove (struct mlxbf_gige *priv); + +void mlxbf_gige_enable_multicast_rx (struct mlxbf_gige *priv); +void mlxbf_gige_disable_multicast_rx (struct mlxbf_gige *priv); +void mlxbf_gige_enable_mac_rx_filter (struct mlxbf_gige *priv, +unsigned int index); +void mlxbf_gige_disable_mac_rx_filter (struct mlxbf_gige *priv, +unsigned int index);void mlxbf_gige_set_mac_rx_filter (struct mlxbf_gige *priv,unsigned int index,u64 dmac); void mlxbf_gige_get_mac_rx_filter(struct mlxbf_gige *priv,
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +10 -0
@@ -168,6 +168,10 @@ static int mlxbf_gige_open(struct net_device *netdev)if (err) goto napi_deinit; +mlxbf_gige_enable_mac_rx_filter (priv,MLXBF_GIGE_BCAST_MAC_FILTER_IDX ); +mlxbf_gige_enable_mac_rx_filter (priv,MLXBF_GIGE_LOCAL_MAC_FILTER_IDX ); +mlxbf_gige_enable_multicast_rx (priv); +/* Set bits in INT_EN that we care about */ int_en =MLXBF_GIGE_INT_EN_HW_ACCESS_ERROR | MLXBF_GIGE_INT_EN_TX_CHECKSUM_INPUTS |
@@ -379,6 +383,7 @@ static int mlxbf_gige_probe(struct platform_device *pdev)void __iomem *plu_base;void __iomem *base;int addr, phy_irq; +unsigned int i;int err; base =devm_platform_ioremap_resource (pdev,MLXBF_GIGE_RES_MAC );
@@ -423,6 +428,11 @@ static int mlxbf_gige_probe(struct platform_device *pdev) priv->rx_q_entries =MLXBF_GIGE_DEFAULT_RXQ_SZ ; priv->tx_q_entries =MLXBF_GIGE_DEFAULT_TXQ_SZ ; +for (i =0 ; i <=MLXBF_GIGE_MAX_FILTER_IDX ; i++) +mlxbf_gige_disable_mac_rx_filter (priv, i); +mlxbf_gige_disable_multicast_rx (priv); +mlxbf_gige_disable_promisc (priv); +/* Write initial MAC address to hardware */ mlxbf_gige_initial_mac (priv);
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_regs.h +2 -0
@@ -62,6 +62,8 @@#define MLXBF_GIGE_TX_STATUS_DATA_FIFO_FULL BIT(1)#define MLXBF_GIGE_RX_MAC_FILTER_DMAC_RANGE_START 0x0520#define MLXBF_GIGE_RX_MAC_FILTER_DMAC_RANGE_END 0x0528 +#define MLXBF_GIGE_RX_MAC_FILTER_GENERAL 0x0530 +#define MLXBF_GIGE_RX_MAC_FILTER_EN_MULTICAST BIT(1)#define MLXBF_GIGE_RX_MAC_FILTER_COUNT_DISC 0x0540#define MLXBF_GIGE_RX_MAC_FILTER_COUNT_DISC_EN BIT(0)#define MLXBF_GIGE_RX_MAC_FILTER_COUNT_PASS 0x0548
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c +44 -6
65 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 100/273 mptcp: correct MPTCP_SUBFLOW_ATTR_SSN_OFFSET reserved size
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugene Syromiatnikov <[email protected]>
[ Upstream commit 655111b838cdabdb604f3625a9ff08c5eedb11da ]
ssn_offset field is u32 and is placed into the netlink response with nla_put_u32(), but only 2 bytes are reserved for the attribute payload in subflow_get_info_size() (even though it makes no difference in the end, as it is aligned up to 4 bytes). Supply the correct argument to the relevant nla_total_size() call to make it less confusing.
--- net/mptcp/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/diag.c +1 -1
@@ -94,7 +94,7 @@ static size_t subflow_get_info_size(const struct sock *sk)nla_total_size (4 ) +/* MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ */ nla_total_size_64bit (8 ) +/* MPTCP_SUBFLOW_ATTR_MAP_SEQ */ nla_total_size (4 ) +/* MPTCP_SUBFLOW_ATTR_MAP_SFSEQ */ -nla_total_size (2 ) +/* MPTCP_SUBFLOW_ATTR_SSN_OFFSET */ +nla_total_size (4 ) +/* MPTCP_SUBFLOW_ATTR_SSN_OFFSET */ nla_total_size (2 ) +/* MPTCP_SUBFLOW_ATTR_MAP_DATALEN */ nla_total_size (4 ) +/* MPTCP_SUBFLOW_ATTR_FLAGS */ nla_total_size(1) + /* MPTCP_SUBFLOW_ATTR_ID_REM */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 101/273 tcp: Update window clamping condition
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subash Abhinov Kasiviswanathan <[email protected]>
[ Upstream commit a2cbb1603943281a604f5adc48079a148db5cb0d ]
This patch is based on the discussions between Neal Cardwell and Eric Dumazet in the link
https://lore.kernel.org/netdev/[email protected]/
It was correctly pointed out that tp->window_clamp would not be updated in cases where net.ipv4.tcp_moderate_rcvbuf=0 or if (copied <= tp->rcvq_space.space). While it is expected for most setups to leave the sysctl enabled, the latter condition may not end up hitting depending on the TCP receive queue size and the pattern of arriving data.
The updated check should be hit only on initial MSS update from TCP_MIN_MSS to measured MSS value and subsequently if there was an update to a larger value.
--- net/ipv4/tcp_input.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
net/ipv4/tcp_input.c +12 -16
@@ -238,9 +238,14 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)*/ if (unlikely (len != icsk->icsk_ack.rcv_mss)) {u64 val = (u64 )skb->len <<TCP_RMEM_TO_WIN_SCALE ; +u8 old_ratio =tcp_sk (sk)->scaling_ratio;do_div (val, skb->truesize);tcp_sk (sk)->scaling_ratio = val ? val :1 ; + +if (old_ratio !=tcp_sk (sk)->scaling_ratio) +WRITE_ONCE (tcp_sk (sk)->window_clamp, +tcp_win_from_space (sk, sk->sk_rcvbuf)); } icsk->icsk_ack.rcv_mss = min_t(unsigned int, len,tcp_sk (sk)->advmss);
@@ -754,7 +759,8 @@ void tcp_rcv_space_adjust(struct sock *sk)* <prev RTT . ><current RTT .. ><next RTT .... > */ -if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf)) { +if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && + !(sk->sk_userlocks &SOCK_RCVBUF_LOCK )) {u64 rcvwin, grow;int rcvbuf;
@@ -770,22 +776,12 @@ void tcp_rcv_space_adjust(struct sock *sk) rcvbuf =min_t (u64,tcp_space_from_win (sk, rcvwin),READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_rmem[2 ])); -if (!(sk->sk_userlocks &SOCK_RCVBUF_LOCK )) { -if (rcvbuf > sk->sk_rcvbuf) { -WRITE_ONCE (sk->sk_rcvbuf, rcvbuf); - -/* Make the window clamp follow along. */ -WRITE_ONCE (tp->window_clamp, -tcp_win_from_space (sk, rcvbuf)); - } - }else { -/* Make the window clamp follow along while being bounded -* by SO_RCVBUF. -*/ -int clamp =tcp_win_from_space (sk,min (rcvbuf, sk->sk_rcvbuf)); +if (rcvbuf > sk->sk_rcvbuf) { +WRITE_ONCE (sk->sk_rcvbuf, rcvbuf); -if (clamp > tp->window_clamp) -WRITE_ONCE (tp->window_clamp, clamp); +/* Make the window clamp follow along. */ +WRITE_ONCE (tp->window_clamp, +tcp_win_from_space (sk, rcvbuf)); } } tp->rcvq_space.space = copied;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 102/273 netfilter: allow ipv6 fragments to arrive on different devices
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Hughes <[email protected]>
[ Upstream commit 3cd740b985963f874a1a094f1969e998b9d05554 ]
Commit 264640fc2c5f4 ("ipv6: distinguish frag queues by device for multicast and link-local packets") modified the ipv6 fragment reassembly logic to distinguish frag queues by device for multicast and link-local packets but in fact only the main reassembly code limits the use of the device to those address types and the netfilter reassembly code uses the device for all packets.
This means that if fragments of a packet arrive on different interfaces then netfilter will fail to reassemble them and the fragments will be expired without going any further through the filters.
--- net/ipv6/netfilter/nf_conntrack_reasm.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/netfilter/nf_conntrack_reasm.c +4 -0
@@ -154,6 +154,10 @@ static struct frag_queue *fq_find(struct net *net, __be32 id, u32 user, };struct inet_frag_queue *q; +if (!(ipv6_addr_type (&hdr->daddr) & (IPV6_ADDR_MULTICAST | +IPV6_ADDR_LINKLOCAL ))) + key.iif =0 ; + q =inet_frag_find (nf_frag->fqdir, &key);if (!q)return NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 103/273 netfilter: nfnetlink: Initialise extack before use in ACKs
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donald Hunter <[email protected]>
[ Upstream commit d1a7b382a9d3f0f3e5a80e0be2991c075fa4f618 ]
Add missing extack initialisation when ACKing BATCH_BEGIN and BATCH_END.
--- net/netfilter/nfnetlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/netfilter/nfnetlink.c +4 -1
@@ -427,8 +427,10 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,nfnl_unlock (subsys_id); -if (nlh->nlmsg_flags &NLM_F_ACK ) +if (nlh->nlmsg_flags &NLM_F_ACK ) { +memset (&extack,0 ,sizeof (extack));nfnl_err_add (&err_list, nlh,0 , &extack); + }while (skb->len >=nlmsg_total_size (0 )) {int msglen, type;
@@ -577,6 +579,7 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ss->abort (net, oskb,NFNL_ABORT_NONE );netlink_ack (oskb,nlmsg_hdr (oskb), err,NULL ); }else if (nlh->nlmsg_flags &NLM_F_ACK ) { +memset (&extack,0 ,sizeof (extack));nfnl_err_add (&err_list, nlh,0 , &extack); } }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 104/273 netfilter: flowtable: initialise extack before use
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Donald Hunter <[email protected]>
[ Upstream commit e9767137308daf906496613fd879808a07f006a2 ]
Fix missing initialisation of extack in flow offload.
--- net/netfilter/nf_flow_table_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_flow_table_offload.c +1 -1
@@ -841,8 +841,8 @@ static int nf_flow_offload_tuple(struct nf_flowtable *flowtable, struct list_head *block_cb_list) {struct flow_cls_offload cls_flow = {}; +struct netlink_ext_ack extack = {};struct flow_block_cb *block_cb; -struct netlink_ext_ack extack;__be16 proto =ETH_P_ALL ;int err, i =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 105/273 netfilter: nf_queue: drop packets with cloned unconfirmed conntracks
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 7d8dc1c7be8d3509e8f5164dd5df64c8e34d7eeb ]
Conntrack assumes an unconfirmed entry (not yet committed to global hash table) has a refcount of 1 and is not visible to other cores.
With multicast forwarding this assumption breaks down because such skbs get cloned after being picked up, i.e. ct->use refcount is > 1.
Likewise, bridge netfilter will clone broad/mutlicast frames and all frames in case they need to be flood-forwarded during learning phase.
For ip multicast forwarding or plain bridge flood-forward this will "work" because packets don't leave softirq and are implicitly serialized.
With nfqueue this no longer holds true, the packets get queued and can be reinjected in arbitrary ways.
Disable this feature, I see no other solution.
After this patch, nfqueue cannot queue packets except the last multicast/broadcast packet.
--- net/bridge/br_netfilter_hooks.c | 6 +++++- net/netfilter/nfnetlink_queue.c | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-)
net/bridge/br_netfilter_hooks.c +5 -1
@@ -619,8 +619,12 @@ static unsigned int br_nf_local_in(void *priv,if (likely (nf_ct_is_confirmed (ct)))return NF_ACCEPT ; +if (WARN_ON_ONCE (refcount_read (&nfct->use) !=1 )) { +nf_reset_ct (skb); +return NF_ACCEPT ; + } +WARN_ON_ONCE (skb_shared (skb)); -WARN_ON_ONCE (refcount_read (&nfct->use) !=1 );/* We can't call nf_confirm here, it would create a dependency * on nf_conntrack module.
net/netfilter/nfnetlink_queue.c +33 -2
@@ -820,10 +820,41 @@ static bool nf_ct_drop_unconfirmed(const struct nf_queue_entry *entry) {#if IS_ENABLED (CONFIG_NF_CONNTRACK )static const unsigned long flags =IPS_CONFIRMED |IPS_DYING ; -const struct nf_conn *ct = (void *)skb_nfct (entry->skb); +struct nf_conn *ct = (void *)skb_nfct (entry->skb); +unsigned long status; +unsigned int use; -if (ct && ((ct->status & flags) ==IPS_DYING )) +if (!ct) +return false; + + status =READ_ONCE (ct->status); +if ((status & flags) ==IPS_DYING )return true; + +if (status &IPS_CONFIRMED ) +return false; + +/* in some cases skb_clone() can occur after initial conntrack +* pickup, but conntrack assumes exclusive skb->_nfct ownership for +* unconfirmed entries. +* +* This happens for br_netfilter and with ip multicast routing. +* We can't be solved with serialization here because one clone could +* have been queued for local delivery. +*/ + use =refcount_read (&ct->ct_general.use); +if (likely (use ==1 )) +return false; + +/* Can't decrement further? Exclusive ownership. */ +if (!refcount_dec_not_one (&ct->ct_general.use)) +return false; + +skb_set_nfct (entry->skb,0 ); +/* No nf_ct_put(): we already decremented .use and it cannot +* drop down to 0. +*/ +return true;#endif return false; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 106/273 netfilter: nf_tables: Audit log dump reset after the fact
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit e0b6648b0446e59522819c75ba1dcb09e68d3e94 ]
In theory, dumpreset may fail and invalidate the preceeding log message. Fix this and use the occasion to prepare for object reset locking, which benefits from a few unrelated changes:
* Add an early call to nfnetlink_unicast if not resetting which effectively skips the audit logging but also unindents it.
* Extract the table's name from the netlink attribute (which is verified via earlier table lookup) to not rely upon validity of the looked up table pointer.
* Do not use local variable family, it will vanish.
--- net/netfilter/nf_tables_api.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
net/netfilter/nf_tables_api.c +13 -15
@@ -8012,6 +8012,7 @@ static int nf_tables_dump_obj_done(struct netlink_callback *cb)static int nf_tables_getobj (struct sk_buff *skb,const struct nfnl_info *info,const struct nlattr *const nla[]) { +const struct nftables_pernet *nft_net =nft_pernet (info->net);struct netlink_ext_ack *extack = info->extack;u8 genmask =nft_genmask_cur (info->net);u8 family = info->nfmsg->nfgen_family;
@@ -8021,6 +8022,7 @@ static int nf_tables_getobj(struct sk_buff *skb, const struct nfnl_info *info,struct sk_buff *skb2;bool reset = false;u32 objtype; +char *buf;int err;if (info->nlh->nlmsg_flags &NLM_F_DUMP ) {
@@ -8059,27 +8061,23 @@ static int nf_tables_getobj(struct sk_buff *skb, const struct nfnl_info *info,if (NFNL_MSG_TYPE (info->nlh->nlmsg_type) ==NFT_MSG_GETOBJ_RESET ) reset = true; -if (reset) { -const struct nftables_pernet *nft_net; -char *buf; - - nft_net =nft_pernet (net); - buf =kasprintf (GFP_ATOMIC ,"%s:%u" , table->name, nft_net->base_seq); - -audit_log_nfcfg (buf, - family, -1 , -AUDIT_NFT_OP_OBJ_RESET , -GFP_ATOMIC ); -kfree (buf); - } - err =nf_tables_fill_obj_info (skb2, net,NETLINK_CB (skb).portid, info->nlh->nlmsg_seq,NFT_MSG_NEWOBJ ,0 , family, table, obj, reset);if (err <0 ) goto err_fill_obj_info; +if (!reset) +return nfnetlink_unicast (skb2, net,NETLINK_CB (skb).portid); + + buf =kasprintf (GFP_ATOMIC ,"%.*s:%u" , +nla_len (nla[NFTA_OBJ_TABLE ]), + (char *)nla_data (nla[NFTA_OBJ_TABLE ]), + nft_net->base_seq); +audit_log_nfcfg (buf, info->nfmsg->nfgen_family,1 , +AUDIT_NFT_OP_OBJ_RESET ,GFP_ATOMIC ); +kfree (buf); +return nfnetlink_unicast (skb2, net,NETLINK_CB (skb).portid); err_fill_obj_info:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 107/273 netfilter: nf_tables: Introduce nf_tables_getobj_single
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit 69fc3e9e90f1afc11f4015e6b75d18ab9acee348 ]
Outsource the reply skb preparation for non-dump getrule requests into a distinct function. Prep work for object reset locking.
Stable-dep-of: bd662c4218f9 ("netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests")
--- net/netfilter/nf_tables_api.c | 75 ++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 31 deletions(-)
net/netfilter/nf_tables_api.c +44 -31
@@ -8009,10 +8009,10 @@ static int nf_tables_dump_obj_done(struct netlink_callback *cb) }/* called with rcu_read_lock held */ -static int nf_tables_getobj (struct sk_buff *skb,const struct nfnl_info *info, -const struct nlattr *const nla[]) +static struct sk_buff * +nf_tables_getobj_single (u32 portid,const struct nfnl_info *info, +const struct nlattr *const nla[],bool reset) { -const struct nftables_pernet *nft_net =nft_pernet (info->net);struct netlink_ext_ack *extack = info->extack;u8 genmask =nft_genmask_cur (info->net);u8 family = info->nfmsg->nfgen_family;
@@ -8020,52 +8020,69 @@ static int nf_tables_getobj(struct sk_buff *skb, const struct nfnl_info *info,struct net *net = info->net;struct nft_object *obj;struct sk_buff *skb2; -bool reset = false;u32 objtype; -char *buf;int err; -if (info->nlh->nlmsg_flags &NLM_F_DUMP ) { -struct netlink_dump_control c = { - .start = nf_tables_dump_obj_start, - .dump = nf_tables_dump_obj, - .done = nf_tables_dump_obj_done, - .module =THIS_MODULE , - .data = (void *)nla, - }; - -return nft_netlink_dump_start_rcu (info->sk, skb, info->nlh, &c); - } -if (!nla[NFTA_OBJ_NAME ] || !nla[NFTA_OBJ_TYPE ]) -return -EINVAL ; +return ERR_PTR (-EINVAL ); table =nft_table_lookup (net, nla[NFTA_OBJ_TABLE ], family, genmask,0 );if (IS_ERR (table)) {NL_SET_BAD_ATTR (extack, nla[NFTA_OBJ_TABLE ]); -return PTR_ERR (table); +return ERR_CAST (table); } objtype =ntohl (nla_get_be32 (nla[NFTA_OBJ_TYPE ])); obj =nft_obj_lookup (net, table, nla[NFTA_OBJ_NAME ], objtype, genmask);if (IS_ERR (obj)) {NL_SET_BAD_ATTR (extack, nla[NFTA_OBJ_NAME ]); -return PTR_ERR (obj); +return ERR_CAST (obj); } skb2 =alloc_skb (NLMSG_GOODSIZE ,GFP_ATOMIC );if (!skb2) -return -ENOMEM ; +return ERR_PTR (-ENOMEM ); + + err =nf_tables_fill_obj_info (skb2, net, portid, + info->nlh->nlmsg_seq,NFT_MSG_NEWOBJ ,0 , + family, table, obj, reset); +if (err <0 ) { +kfree_skb (skb2); +return ERR_PTR (err); + } + +return skb2; +} + +static int nf_tables_getobj (struct sk_buff *skb,const struct nfnl_info *info, +const struct nlattr *const nla[]) +{ +struct nftables_pernet *nft_net =nft_pernet (info->net); +u32 portid =NETLINK_CB (skb).portid; +struct net *net = info->net; +struct sk_buff *skb2; +bool reset = false; +char *buf; + +if (info->nlh->nlmsg_flags &NLM_F_DUMP ) { +struct netlink_dump_control c = { + .start = nf_tables_dump_obj_start, + .dump = nf_tables_dump_obj, + .done = nf_tables_dump_obj_done, + .module =THIS_MODULE , + .data = (void *)nla, + }; + +return nft_netlink_dump_start_rcu (info->sk, skb, info->nlh, &c); + }if (NFNL_MSG_TYPE (info->nlh->nlmsg_type) ==NFT_MSG_GETOBJ_RESET ) reset = true; - err =nf_tables_fill_obj_info (skb2, net,NETLINK_CB (skb).portid, - info->nlh->nlmsg_seq,NFT_MSG_NEWOBJ ,0 , - family, table, obj, reset); -if (err <0 ) - goto err_fill_obj_info; + skb2 =nf_tables_getobj_single (portid, info, nla, reset); +if (IS_ERR (skb2)) +return PTR_ERR (skb2);if (!reset)return nfnetlink_unicast (skb2, net,NETLINK_CB (skb).portid);
@@ -8078,11 +8095,7 @@ static int nf_tables_getobj(struct sk_buff *skb, const struct nfnl_info *info, AUDIT_NFT_OP_OBJ_RESET, GFP_ATOMIC);kfree (buf); -return nfnetlink_unicast (skb2, net,NETLINK_CB (skb).portid); - -err_fill_obj_info: -kfree_skb (skb2); -return err; +return nfnetlink_unicast (skb2, net, portid); }static void nft_obj_destroy (const struct nft_ctx *ctx,struct nft_object *obj)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 108/273 netfilter: nf_tables: Add locking for NFT_MSG_GETOBJ_RESET requests
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit bd662c4218f9648e888bebde9468146965f3f8a0 ]
Objects' dump callbacks are not concurrency-safe per-se with reset bit set. If two CPUs perform a reset at the same time, at least counter and quota objects suffer from value underrun.
Prevent this by introducing dedicated locking callbacks for nfnetlink and the asynchronous dump handling to serialize access.
--- net/netfilter/nf_tables_api.c | 72 ++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 13 deletions(-)
net/netfilter/nf_tables_api.c +59 -13
@@ -7977,6 +7977,19 @@ static int nf_tables_dump_obj(struct sk_buff *skb, struct netlink_callback *cb)return skb->len; } +static int nf_tables_dumpreset_obj (struct sk_buff *skb, +struct netlink_callback *cb) +{ +struct nftables_pernet *nft_net =nft_pernet (sock_net (skb->sk)); +int ret; + +mutex_lock (&nft_net->commit_mutex); + ret =nf_tables_dump_obj (skb, cb); +mutex_unlock (&nft_net->commit_mutex); + +return ret; +} +static int nf_tables_dump_obj_start (struct netlink_callback *cb) {struct nft_obj_dump_ctx *ctx = (void *)cb->ctx;
@@ -7993,12 +8006,18 @@ static int nf_tables_dump_obj_start(struct netlink_callback *cb)if (nla[NFTA_OBJ_TYPE ]) ctx->type =ntohl (nla_get_be32 (nla[NFTA_OBJ_TYPE ])); -if (NFNL_MSG_TYPE (cb->nlh->nlmsg_type) ==NFT_MSG_GETOBJ_RESET ) - ctx->reset = true; -return 0 ; } +static int nf_tables_dumpreset_obj_start (struct netlink_callback *cb) +{ +struct nft_obj_dump_ctx *ctx = (void *)cb->ctx; + + ctx->reset = true; + +return nf_tables_dump_obj_start (cb); +} +static int nf_tables_dump_obj_done (struct netlink_callback *cb) {struct nft_obj_dump_ctx *ctx = (void *)cb->ctx;
@@ -8057,18 +8076,43 @@ nf_tables_getobj_single(u32 portid, const struct nfnl_info *info,static int nf_tables_getobj (struct sk_buff *skb,const struct nfnl_info *info,const struct nlattr *const nla[]) +{ +u32 portid =NETLINK_CB (skb).portid; +struct sk_buff *skb2; + +if (info->nlh->nlmsg_flags &NLM_F_DUMP ) { +struct netlink_dump_control c = { + .start = nf_tables_dump_obj_start, + .dump = nf_tables_dump_obj, + .done = nf_tables_dump_obj_done, + .module =THIS_MODULE , + .data = (void *)nla, + }; + +return nft_netlink_dump_start_rcu (info->sk, skb, info->nlh, &c); + } + + skb2 =nf_tables_getobj_single (portid, info, nla, false); +if (IS_ERR (skb2)) +return PTR_ERR (skb2); + +return nfnetlink_unicast (skb2, info->net, portid); +} + +static int nf_tables_getobj_reset (struct sk_buff *skb, +const struct nfnl_info *info, +const struct nlattr *const nla[]) {struct nftables_pernet *nft_net =nft_pernet (info->net);u32 portid =NETLINK_CB (skb).portid;struct net *net = info->net;struct sk_buff *skb2; -bool reset = false;char *buf;if (info->nlh->nlmsg_flags &NLM_F_DUMP ) {struct netlink_dump_control c = { - .start = nf_tables_dump_obj_start, - .dump = nf_tables_dump_obj, + .start = nf_tables_dumpreset_obj_start, + .dump = nf_tables_dumpreset_obj, .done = nf_tables_dump_obj_done, .module =THIS_MODULE , .data = (void *)nla,
@@ -8077,16 +8121,18 @@ static int nf_tables_getobj(struct sk_buff *skb, const struct nfnl_info *info,return nft_netlink_dump_start_rcu (info->sk, skb, info->nlh, &c); } -if (NFNL_MSG_TYPE (info->nlh->nlmsg_type) ==NFT_MSG_GETOBJ_RESET ) - reset = true; +if (!try_module_get (THIS_MODULE )) +return -EINVAL ; +rcu_read_unlock (); +mutex_lock (&nft_net->commit_mutex); + skb2 =nf_tables_getobj_single (portid, info, nla, true); +mutex_unlock (&nft_net->commit_mutex); +rcu_read_lock (); +module_put (THIS_MODULE ); - skb2 =nf_tables_getobj_single (portid, info, nla, reset);if (IS_ERR (skb2))return PTR_ERR (skb2); -if (!reset) -return nfnetlink_unicast (skb2, net,NETLINK_CB (skb).portid); - buf = kasprintf(GFP_ATOMIC, "%.*s:%u", nla_len(nla[NFTA_OBJ_TABLE]), (char *)nla_data(nla[NFTA_OBJ_TABLE]),
@@ -9378,7 +9424,7 @@ static const struct nfnl_callback nf_tables_cb[NFT_MSG_MAX] = { .policy = nft_obj_policy, }, [NFT_MSG_GETOBJ_RESET] = { - .call = nf_tables_getobj, + .call = nf_tables_getobj_reset, .type = NFNL_CB_RCU, .attr_count = NFTA_OBJ_MAX, .policy = nft_obj_policy,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 109/273 selftest: af_unix: Fix kselftest compilation warnings
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhinav Jain <[email protected]>
[ Upstream commit 6c569b77f0300f8a9960277c7094fa0f128eb811 ]
Change expected_buf from (const void *) to (const char *) in function __recvpair().
This change fixes the below warnings during test compilation:
``` In file included from msg_oob.c:14: msg_oob.c: In function ‘__recvpair’: ../../kselftest_harness.h:106:40: warning: format ‘%s’ expects argument of type ‘char *’,but argument 6 has type ‘const void *’ [-Wformat=] ../../kselftest_harness.h:101:17: note: in expansion of macro ‘__TH_LOG’ msg_oob.c:235:17: note: in expansion of macro ‘TH_LOG’ ../../kselftest_harness.h:106:40: warning: format ‘%s’ expects argument of type ‘char *’,but argument 6 has type ‘const void *’ [-Wformat=] ../../kselftest_harness.h:101:17: note: in expansion of macro ‘__TH_LOG’ msg_oob.c:259:25: note: in expansion of macro ‘TH_LOG’ ```
--- tools/testing/selftests/net/af_unix/msg_oob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/af_unix/msg_oob.c +1 -1
@@ -209,7 +209,7 @@ static void __sendpair(struct __test_metadata *_metadata,static void __recvpair (struct __test_metadata *_metadata,FIXTURE_DATA (msg_oob) *self, -const void *expected_buf,int expected_len, +const char *expected_buf,int expected_len,int buf_len,int flags) {int i, ret[2 ], recv_errno[2 ], expected_errno =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 110/273 vsock: fix recursive ->recvmsg calls
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 69139d2919dd4aa9a553c8245e7c63e82613e3fc ]
After a vsock socket has been added to a BPF sockmap, its prot->recvmsg has been replaced with vsock_bpf_recvmsg(). Thus the following recursiion could happen:
vsock_bpf_recvmsg()
-> __vsock_recvmsg()
-> vsock_connectible_recvmsg()
-> prot->recvmsg()
-> vsock_bpf_recvmsg() again
We need to fix it by calling the original ->recvmsg() without any BPF sockmap logic in __vsock_recvmsg().
--- include/net/af_vsock.h | 4 ++++ net/vmw_vsock/af_vsock.c | 50 +++++++++++++++++++++++---------------- net/vmw_vsock/vsock_bpf.c | 4 ++-- 3 files changed, 35 insertions(+), 23 deletions(-)
include/net/af_vsock.h +4 -0
@@ -230,8 +230,12 @@ struct vsock_tap {int vsock_add_tap (struct vsock_tap *vt);int vsock_remove_tap (struct vsock_tap *vt);void vsock_deliver_tap (struct sk_buff *build_skb (void *opaque),void *opaque); +int __vsock_connectible_recvmsg (struct socket *sock,struct msghdr *msg,size_t len, +int flags);int vsock_connectible_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags); +int __vsock_dgram_recvmsg (struct socket *sock,struct msghdr *msg, +size_t len,int flags);int vsock_dgram_recvmsg (struct socket *sock,struct msghdr *msg,size_t len,int flags);
net/vmw_vsock/af_vsock.c +29 -21
89 lines not on this page · raw message
net/vmw_vsock/vsock_bpf.c +2 -2
@@ -64,9 +64,9 @@ static int __vsock_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, intint err;if (sk->sk_type ==SOCK_STREAM || sk->sk_type ==SOCK_SEQPACKET ) - err =vsock_connectible_recvmsg (sock, msg, len, flags); + err =__vsock_connectible_recvmsg (sock, msg, len, flags);else if (sk->sk_type ==SOCK_DGRAM ) - err =vsock_dgram_recvmsg (sock, msg, len, flags); + err =__vsock_dgram_recvmsg (sock, msg, len, flags);else err = -EPROTOTYPE ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 111/273 selftests: net: lib: ignore possible errors
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit 7e0620bc6a5ec6b340a0be40054f294ca26c010f ]
No need to disable errexit temporary, simply ignore the only possible and not handled error.
Stable-dep-of: 7965a7f32a53 ("selftests: net: lib: kill PIDs before del netns")
--- tools/testing/selftests/net/lib.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
tools/testing/selftests/net/lib.sh +1 -9
@@ -128,25 +128,17 @@ slowwait_for_counter() cleanup_ns() { local ns="" - local errexit=0 local ret=0 - # disable errexit temporary - if [[ $- =~ "e" ]]; then - errexit=1 - set +e - fi - for ns in "$@"; do [ -z "${ns}" ] && continue - ip netns delete "${ns}" &> /dev/null + ip netns delete "${ns}" &> /dev/null || true if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then echo "Warn: Failed to remove namespace $ns" ret=1 fi done - [ $errexit -eq 1 ] && set -e return $ret }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 112/273 selftests: net: lib: kill PIDs before del netns
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit 7965a7f32a53d9ad807ce2c53bdda69ba104974f ]
When deleting netns, it is possible to still have some tasks running, e.g. background tasks like tcpdump running in the background, not stopped because the test has been interrupted.
Before deleting the netns, it is then safer to kill all attached PIDs, if any. That should reduce some noises after the end of some tests, and help with the debugging of some issues. That's why this modification is seen as a "fix".
--- tools/testing/selftests/net/lib.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/lib.sh +1 -0
@@ -132,6 +132,7 @@ cleanup_ns() for ns in "$@"; do [ -z "${ns}" ] && continue + ip netns pids "${ns}" 2> /dev/null | xargs -r kill || true ip netns delete "${ns}" &> /dev/null || true if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then echo "Warn: Failed to remove namespace $ns"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 113/273 net: hns3: fix wrong use of semaphore up
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Wang <[email protected]>
[ Upstream commit 8445d9d3c03101859663d34fda747f6a50947556 ]
Currently, if hns3 PF or VF FLR reset failed after five times retry, the reset done process will directly release the semaphore which has already released in hclge_reset_prepare_general. This will cause down operation fail.
So this patch fixes it by adding reset state judgement. The up operation is only called after successful PF FLR reset.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 4 ++-- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -2
@@ -11516,8 +11516,8 @@ static void hclge_reset_done(struct hnae3_ae_dev *ae_dev)dev_err (&hdev->pdev->dev,"fail to rebuild, ret=%d\n" , ret); hdev->reset_type =HNAE3_NONE_RESET ; -clear_bit (HCLGE_STATE_RST_HANDLING , &hdev->state); -up (&hdev->reset_sem); +if (test_and_clear_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) +up (&hdev->reset_sem); }static void hclge_clear_resetting_state (struct hclge_dev *hdev)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2 -2
@@ -1747,8 +1747,8 @@ static void hclgevf_reset_done(struct hnae3_ae_dev *ae_dev) ret); hdev->reset_type =HNAE3_NONE_RESET ; -clear_bit (HCLGEVF_STATE_RST_HANDLING , &hdev->state); -up (&hdev->reset_sem); +if (test_and_clear_bit (HCLGEVF_STATE_RST_HANDLING , &hdev->state)) +up (&hdev->reset_sem); }static u32 hclgevf_get_fw_version (struct hnae3_handle *handle)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 114/273 net: hns3: use the users cfg after reset
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peiyang Wang <[email protected]>
[ Upstream commit 30545e17eac1f50c5ef49644daf6af205100a965 ]
Consider the followed case that the user change speed and reset the net interface. Before the hw change speed successfully, the driver get old old speed from hw by timer task. After reset, the previous speed is config to hw. As a result, the new speed is configed successfully but lost after PF reset. The followed pictured shows more dirrectly.
+------+ +----+ +----+
| USER | | PF | | HW |
+---+--+ +-+--+ +-+--+
| ethtool -s 100G | |
+------------------>| set speed 100G |
| +--------------------->|
| | set successfully |
| |<---------------------+---+
| |query cfg (timer task)| |
| +--------------------->| | handle speed
| | return 200G | | changing event
| ethtool --reset |<---------------------+ | (100G)
+------------------>| cfg previous speed |<--+
| | after reset (200G) |
| +--------------------->|
| | +---+
| |query cfg (timer task)| |
| +--------------------->| | handle speed
| | return 100G | | changing event
| |<---------------------+ | (200G)
| | |<--+
| |query cfg (timer task)|
| +--------------------->|
| | return 200G |
| |<---------------------+
| | |
v v vThis patch save new speed if hw change speed successfully, which will be used after reset successfully.
--- .../hisilicon/hns3/hns3pf/hclge_main.c | 24 ++++++++++++++----- .../hisilicon/hns3/hns3pf/hclge_mdio.c | 3 +++ 2 files changed, 21 insertions(+), 6 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +18 -6
@@ -2653,8 +2653,17 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_handle *handle, int speed, {struct hclge_vport *vport =hclge_get_vport (handle);struct hclge_dev *hdev = vport->back; +int ret; + + ret =hclge_cfg_mac_speed_dup (hdev, speed, duplex, lane_num); -return hclge_cfg_mac_speed_dup (hdev, speed, duplex, lane_num); +if (ret) +return ret; + + hdev->hw.mac.req_speed = speed; + hdev->hw.mac.req_duplex = duplex; + +return 0 ; }static int hclge_set_autoneg_en (struct hclge_dev *hdev,bool enable)
@@ -2956,17 +2965,20 @@ static int hclge_mac_init(struct hclge_dev *hdev)if (!test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state)) hdev->hw.mac.duplex =HCLGE_MAC_FULL ; - ret =hclge_cfg_mac_speed_dup_hw (hdev, hdev->hw.mac.speed, - hdev->hw.mac.duplex, hdev->hw.mac.lane_num); -if (ret) -return ret; -if (hdev->hw.mac.support_autoneg) { ret =hclge_set_autoneg_en (hdev, hdev->hw.mac.autoneg);if (ret)return ret; } +if (!hdev->hw.mac.autoneg) { + ret =hclge_cfg_mac_speed_dup_hw (hdev, hdev->hw.mac.req_speed, + hdev->hw.mac.req_duplex, + hdev->hw.mac.lane_num); +if (ret) +return ret; + } + mac->link =0 ;if (mac->user_fec_mode &BIT (HNAE3_FEC_USER_DEF )) {
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c +3 -0
@@ -191,6 +191,9 @@ static void hclge_mac_adjust_link(struct net_device *netdev)if (ret)netdev_err (netdev,"failed to adjust link.\n" ); + hdev->hw.mac.req_speed = (u32 )speed; + hdev->hw.mac.req_duplex = (u8 )duplex; + ret =hclge_cfg_flowctrl (hdev);if (ret)netdev_err (netdev,"failed to configure flow control.\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 115/273 net: hns3: fix a deadlock problem when config TC during resetting
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jie Wang <[email protected]>
[ Upstream commit be5e816d00a506719e9dbb1a9c861c5ced30a109 ]
When config TC during the reset process, may cause a deadlock, the flow is as below:
pf reset start
│
▼
......
setup tc │
│ ▼
▼ DOWN: napi_disable()
napi_disable()(skip) │
│ │
▼ ▼
...... ......
│ │
▼ │
napi_enable() │
▼
UINIT: netif_napi_del()
│
▼
......
│
▼
INIT: netif_napi_add()
│
▼
...... global reset start
│ │
▼ ▼
UP: napi_enable()(skip) ......
│ │
▼ ▼
...... napi_disable()In reset process, the driver will DOWN the port and then UINIT, in this case, the setup tc process will UP the port before UINIT, so cause the problem. Adds a DOWN process in UINIT to fix it.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +3 -0
@@ -5724,6 +5724,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)struct net_device *netdev = handle->kinfo.netdev;struct hns3_nic_priv *priv =netdev_priv (netdev); +if (!test_bit (HNS3_NIC_STATE_DOWN , &priv->state)) +hns3_nic_net_stop (netdev); +if (!test_and_clear_bit (HNS3_NIC_STATE_INITED , &priv->state)) {netdev_warn (netdev,"already uninitialized\n" );return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 116/273 kbuild: refactor variables in scripts/link-vmlinux.sh
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit ddf41329839f49dadf26973cd845ea160ac1784d ]
Clean up the variables in scripts/link-vmlinux.sh
- Specify the extra objects directly in vmlinux_link()
- Move the AS rule to kallsyms()
- Set kallsymso and btf_vmlinux_bin_o where they are generated
- Remove unneeded variable, kallsymso_prev
- Introduce the btf_data variable
- Introduce the strip_debug flag instead of checking the output name
No functional change intended.
Stable-dep-of: 020925ce9299 ("kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols")
--- scripts/link-vmlinux.sh | 65 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 31 deletions(-)
scripts/link-vmlinux.sh +34 -31
@@ -45,7 +45,6 @@ info() # Link of vmlinux # ${1} - output file -# ${2}, ${3}, ... - optional extra .o files vmlinux_link() { local output=${1}
@@ -90,7 +89,7 @@ vmlinux_link() ldflags="${ldflags} ${wl}--script=${objtree}/${KBUILD_LDS}" # The kallsyms linking does not need debug symbols included. - if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then + if [ -n "${strip_debug}" ] ; then ldflags="${ldflags} ${wl}--strip-debug" fi
@@ -101,7 +100,7 @@ vmlinux_link() ${ld} ${ldflags} -o ${output} \ ${wl}--whole-archive ${objs} ${wl}--no-whole-archive \ ${wl}--start-group ${libs} ${wl}--end-group \ - $@ ${ldlibs} + ${kallsymso} ${btf_vmlinux_bin_o} ${ldlibs} } # generate .BTF typeinfo from DWARF debuginfo
@@ -110,6 +109,7 @@ vmlinux_link() gen_btf() { local pahole_ver + local btf_data=${2} if ! [ -x "$(command -v ${PAHOLE})" ]; then echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
@@ -124,16 +124,16 @@ gen_btf() vmlinux_link ${1} - info "BTF" ${2} + info BTF "${btf_data}" LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1} - # Create ${2} which contains just .BTF section but no symbols. Add + # Create ${btf_data} which contains just .BTF section but no symbols. Add # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all # deletes all symbols including __start_BTF and __stop_BTF, which will # be redefined in the linker script. Add 2>/dev/null to suppress GNU # objcopy warnings: "empty loadable segment detected at ..." ${OBJCOPY} --only-section=.BTF --set-section-flags .BTF=alloc,readonly \ - --strip-all ${1} ${2} 2>/dev/null + --strip-all ${1} "${btf_data}" 2>/dev/null # Change e_type to ET_REL so that it can be used to link final vmlinux. # GNU ld 2.35+ and lld do not allow an ET_EXEC input. if is_enabled CONFIG_CPU_BIG_ENDIAN; then
@@ -141,10 +141,12 @@ gen_btf() else et_rel='\1\0' fi - printf "${et_rel}" | dd of=${2} conv=notrunc bs=1 seek=16 status=none + printf "${et_rel}" | dd of="${btf_data}" conv=notrunc bs=1 seek=16 status=none + + btf_vmlinux_bin_o=${btf_data} } -# Create ${2} .S file with all symbols from the ${1} object file +# Create ${2}.o file with all symbols from the ${1} object file kallsyms() { local kallsymopt;
@@ -165,27 +167,25 @@ kallsyms() kallsymopt="${kallsymopt} --lto-clang" fi - info KSYMS ${2} - scripts/kallsyms ${kallsymopt} ${1} > ${2} + info KSYMS "${2}.S" + scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S" + + info AS "${2}.o" + ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \ + ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} -c -o "${2}.o" "${2}.S" + + kallsymso=${2}.o } # Perform one step in kallsyms generation, including temporary linking of # vmlinux. kallsyms_step() { - kallsymso_prev=${kallsymso} kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1} - kallsymso=${kallsyms_vmlinux}.o - kallsyms_S=${kallsyms_vmlinux}.S - - vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} - mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms - kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S} - info AS ${kallsymso} - ${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \ - ${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ - -c -o ${kallsymso} ${kallsyms_S} + vmlinux_link "${kallsyms_vmlinux}" + mksysmap "${kallsyms_vmlinux}" "${kallsyms_vmlinux}.syms" + kallsyms "${kallsyms_vmlinux}.syms" "${kallsyms_vmlinux}" } # Create map file with all symbols from ${1}
@@ -223,19 +223,18 @@ fi ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init init/version-timestamp.o -btf_vmlinux_bin_o="" +btf_vmlinux_bin_o= +kallsymso= +strip_debug= + if is_enabled CONFIG_DEBUG_INFO_BTF; then - btf_vmlinux_bin_o=.btf.vmlinux.bin.o - if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then + if ! gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" exit 1 fi fi -kallsymso="" -kallsymso_prev="" -kallsyms_vmlinux="" if is_enabled CONFIG_KALLSYMS; then # kallsyms support
@@ -261,11 +260,13 @@ if is_enabled CONFIG_KALLSYMS; then # a) Verify that the System.map from vmlinux matches the map from # ${kallsymso}. + # The kallsyms linking does not need debug symbols included. + strip_debug=1 + kallsyms_step 1 - kallsyms_step 2 + size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) - # step 3 - size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev}) + kallsyms_step 2 size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso}) if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
@@ -273,7 +274,9 @@ if is_enabled CONFIG_KALLSYMS; then fi fi -vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o} +strip_debug= + +vmlinux_link vmlinux # fill in BTF IDs if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 117/273 kbuild: remove PROVIDE() for kallsyms symbols
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit c442db3f49f27e5a60a641b2ac9a3c6320796ed6 ]
This reimplements commit 951bcae6c5a0 ("kallsyms: Avoid weak references for kallsyms symbols") because I am not a big fan of PROVIDE().
As an alternative solution, this commit prepends one more kallsyms step.
KSYMS .tmp_vmlinux.kallsyms0.S # added
AS .tmp_vmlinux.kallsyms0.o # added
LD .tmp_vmlinux.btf
BTF .btf.vmlinux.bin.o
LD .tmp_vmlinux.kallsyms1
NM .tmp_vmlinux.kallsyms1.syms
KSYMS .tmp_vmlinux.kallsyms1.S
AS .tmp_vmlinux.kallsyms1.o
LD .tmp_vmlinux.kallsyms2
NM .tmp_vmlinux.kallsyms2.syms
KSYMS .tmp_vmlinux.kallsyms2.S
AS .tmp_vmlinux.kallsyms2.o
LD vmlinuxStep 0 takes /dev/null as input, and generates .tmp_vmlinux.kallsyms0.o, which has a valid kallsyms format with the empty symbol list, and can be linked to vmlinux. Since it is really small, the added compile-time cost is negligible.
Stable-dep-of: 020925ce9299 ("kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols")
--- include/asm-generic/vmlinux.lds.h | 19 ------------------- kernel/kallsyms_internal.h | 5 ----- scripts/kallsyms.c | 6 ------ scripts/link-vmlinux.sh | 9 +++++++-- 4 files changed, 7 insertions(+), 32 deletions(-)
include/asm-generic/vmlinux.lds.h +0 -19
@@ -451,30 +451,11 @@#endif #endif -/* -* Some symbol definitions will not exist yet during the first pass of the -* link, but are guaranteed to exist in the final link. Provide preliminary -* definitions that will be superseded in the final link to avoid having to -* rely on weak external linkage, which requires a GOT when used in position -* independent code. -*/ -#define PRELIMINARY_SYMBOL_DEFINITIONS \ - PROVIDE(kallsyms_addresses = .); \ - PROVIDE(kallsyms_offsets = .); \ - PROVIDE(kallsyms_names = .); \ - PROVIDE(kallsyms_num_syms = .); \ - PROVIDE(kallsyms_relative_base = .); \ - PROVIDE(kallsyms_token_table = .); \ - PROVIDE(kallsyms_token_index = .); \ - PROVIDE(kallsyms_markers = .); \ - PROVIDE(kallsyms_seqs_of_names = .); -/* * Read only Data */ #define RO_DATA (align) \ . = ALIGN((align)); \ - PRELIMINARY_SYMBOL_DEFINITIONS \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ __start_rodata = .; \ *(.rodata) *(.rodata.*) \
kernel/kallsyms_internal.h +0 -5
@@ -4,11 +4,6 @@#include <linux/types.h> -/* -* These will be re-linked against their real values during the second link -* stage. Preliminary values must be provided in the linker script using the -* PROVIDE() directive so that the first link stage can complete successfully. -*/ extern const unsigned long kallsyms_addresses[];extern const int kallsyms_offsets[];extern const u8 kallsyms_names[];
scripts/kallsyms.c +0 -6
@@ -259,12 +259,6 @@ static void shrink_table(void) } } table_cnt = pos; - -/* When valid symbol is not registered, exit to error */ -if (!table_cnt) { -fprintf (stderr,"No valid symbol.\n" ); -exit (1 ); - } }static void read_map (const char *in)
scripts/link-vmlinux.sh +7 -2
@@ -227,6 +227,10 @@ btf_vmlinux_bin_o= kallsymso= strip_debug= +if is_enabled CONFIG_KALLSYMS; then + kallsyms /dev/null .tmp_vmlinux.kallsyms0 +fi + if is_enabled CONFIG_DEBUG_INFO_BTF; then if ! gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then echo >&2 "Failed to generate BTF for vmlinux"
@@ -239,9 +243,10 @@ if is_enabled CONFIG_KALLSYMS; then # kallsyms support # Generate section listing all symbols and add it into vmlinux - # It's a three step process: + # It's a four step process: + # 0) Generate a dummy __kallsyms with empty symbol list. # 1) Link .tmp_vmlinux.kallsyms1 so it has all symbols and sections, - # but __kallsyms is empty. + # with a dummy __kallsyms. # Running kallsyms on that gives us .tmp_kallsyms1.o with # the right size # 2) Link .tmp_vmlinux.kallsyms2 so it now has a __kallsyms section of
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 118/273 kallsyms: get rid of code for absolute kallsyms
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
[ Upstream commit 64e166099b69bfc09f667253358a15160b86ea43 ]
Commit cf8e8658100d ("arch: Remove Itanium (IA-64) architecture") removed the last use of the absolute kallsyms.
Stable-dep-of: 020925ce9299 ("kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols")
--- init/Kconfig | 18 ------- kernel/kallsyms.c | 5 +- kernel/kallsyms_internal.h | 1 - kernel/vmcore_info.c | 4 -- scripts/kallsyms.c | 78 ++++++++++++----------------- scripts/link-vmlinux.sh | 4 -- tools/perf/tests/vmlinux-kallsyms.c | 1 - 7 files changed, 33 insertions(+), 78 deletions(-)
init/Kconfig +0 -18
@@ -1789,24 +1789,6 @@ config KALLSYMS_ABSOLUTE_PERCPU depends on KALLSYMS default X86_64 && SMP -config KALLSYMS_BASE_RELATIVE - bool - depends on KALLSYMS - default y - help - Instead of emitting them as absolute values in the native word size, - emit the symbol references in the kallsyms table as 32-bit entries, - each containing a relative value in the range [base, base + U32_MAX] - or, when KALLSYMS_ABSOLUTE_PERCPU is in effect, each containing either - an absolute value in the range [0, S32_MAX] or a relative value in the - range [base, base + S32_MAX], where base is the lowest relative symbol - address encountered in the image. - - On 64-bit builds, this reduces the size of the address table by 50%, - but more importantly, it results in entries whose values are build - time constants, and no relocation pass is required at runtime to fix - up the entries based on the runtime load address of the kernel. - # end of the "standard kernel features (expert users)" menu config ARCH_HAS_MEMBARRIER_CALLBACKS
kernel/kallsyms.c +1 -4
@@ -148,9 +148,6 @@ static unsigned int get_symbol_offset(unsigned long pos)unsigned long kallsyms_sym_address (int idx) { -if (!IS_ENABLED (CONFIG_KALLSYMS_BASE_RELATIVE )) -return kallsyms_addresses[idx]; -/* values are unsigned offsets if --absolute-percpu is not in effect */ if (!IS_ENABLED (CONFIG_KALLSYMS_ABSOLUTE_PERCPU ))return kallsyms_relative_base + (u32 )kallsyms_offsets[idx];
@@ -325,7 +322,7 @@ static unsigned long get_symbol_pos(unsigned long addr,unsigned long symbol_start =0 , symbol_end =0 ;unsigned long i, low, high, mid; -/* Do a binary search on the sorted kallsyms_addresses array. */ +/* Do a binary search on the sorted kallsyms_offsets array. */ low =0 ; high = kallsyms_num_syms;
kernel/kallsyms_internal.h +0 -1
@@ -4,7 +4,6 @@#include <linux/types.h> -extern const unsigned long kallsyms_addresses[];extern const int kallsyms_offsets[];extern const u8 kallsyms_names[];
kernel/vmcore_info.c +0 -4
@@ -216,12 +216,8 @@ static int __init crash_save_vmcoreinfo_init(void)VMCOREINFO_SYMBOL (kallsyms_num_syms);VMCOREINFO_SYMBOL (kallsyms_token_table);VMCOREINFO_SYMBOL (kallsyms_token_index); -#ifdef CONFIG_KALLSYMS_BASE_RELATIVE VMCOREINFO_SYMBOL (kallsyms_offsets);VMCOREINFO_SYMBOL (kallsyms_relative_base); -#else -VMCOREINFO_SYMBOL (kallsyms_addresses); -#endif /* CONFIG_KALLSYMS_BASE_RELATIVE */ #endif /* CONFIG_KALLSYMS */ arch_crash_save_vmcoreinfo ();
scripts/kallsyms.c +32 -46
122 lines not on this page · raw message
scripts/link-vmlinux.sh +0 -4
@@ -159,10 +159,6 @@ kallsyms() kallsymopt="${kallsymopt} --absolute-percpu" fi - if is_enabled CONFIG_KALLSYMS_BASE_RELATIVE; then - kallsymopt="${kallsymopt} --base-relative" - fi - if is_enabled CONFIG_LTO_CLANG; then kallsymopt="${kallsymopt} --lto-clang" fi
tools/perf/tests/vmlinux-kallsyms.c +0 -1
@@ -26,7 +26,6 @@ static bool is_ignored_symbol(const char *name, char type)* when --all-symbols is specified so exclude them to get a * stable symbol list. */ -"kallsyms_addresses" ,"kallsyms_offsets" ,"kallsyms_relative_base" , "kallsyms_num_syms",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 119/273 kallsyms: Do not cleanup .llvm.<hash> suffix before sorting symbols
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
[ Upstream commit 020925ce92990c3bf59ab2cde386ac6d9ec734ff ]
Cleaning up the symbols causes various issues afterwards. Let's sort the list based on original name.
--- scripts/kallsyms.c | 31 ++----------------------------- scripts/link-vmlinux.sh | 4 ---- 2 files changed, 2 insertions(+), 33 deletions(-)
scripts/kallsyms.c +2 -29
@@ -5,8 +5,7 @@* This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * -* Usage: kallsyms [--all-symbols] [--absolute-percpu] -* [--lto-clang] in.map > out.S +* Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might
@@ -63,7 +62,6 @@ static struct sym_entry **table;static unsigned int table_size, table_cnt;static int all_symbols;static int absolute_percpu; -static int lto_clang;static int token_profit[0x10000 ];
@@ -74,8 +72,7 @@ static unsigned char best_table_len[256];static void usage (void ) { -fprintf (stderr,"Usage: kallsyms [--all-symbols] [--absolute-percpu] " -"[--lto-clang] in.map > out.S\n" ); +fprintf (stderr,"Usage: kallsyms [--all-symbols] [--absolute-percpu] in.map > out.S\n" );exit (1 ); }
@@ -345,25 +342,6 @@ static int symbol_absolute(const struct sym_entry *s)return s->percpu_absolute; } -static void cleanup_symbol_name (char *s) -{ -char *p; - -/* -* ASCII[.] = 2e -* ASCII[0-9] = 30,39 -* ASCII[A-Z] = 41,5a -* ASCII[_] = 5f -* ASCII[a-z] = 61,7a -* -* As above, replacing the first '.' in ".llvm." with '\0' does not -* affect the main sorting, but it helps us with subsorting. -*/ - p =strstr (s,".llvm." ); -if (p) - *p ='\0' ; -} -static int compare_names (const void *a,const void *b) {int ret;
@@ -528,10 +506,6 @@ static void write_src(void)output_address (relative_base);printf ("\n" ); -if (lto_clang) -for (i =0 ; i < table_cnt; i++) -cleanup_symbol_name ((char *)table[i]->sym); -sort_symbols_by_name ();output_label ("kallsyms_seqs_of_names" );for (i =0 ; i < table_cnt; i++)
@@ -808,7 +782,6 @@ int main(int argc, char **argv)static const struct option long_options[] = { {"all-symbols" , no_argument, &all_symbols,1 }, {"absolute-percpu" , no_argument, &absolute_percpu,1 }, - {"lto-clang" , no_argument, <o_clang,1 }, {}, };
scripts/link-vmlinux.sh +0 -4
@@ -159,10 +159,6 @@ kallsyms() kallsymopt="${kallsymopt} --absolute-percpu" fi - if is_enabled CONFIG_LTO_CLANG; then - kallsymopt="${kallsymopt} --lto-clang" - fi - info KSYMS "${2}.S" scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 120/273 kallsyms: Match symbols exactly with CONFIG_LTO_CLANG
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
[ Upstream commit fb6a421fb6153d97cf3058f9bd550b377b76a490 ]
With CONFIG_LTO_CLANG=y, the compiler may add .llvm.<hash> suffix to function names to avoid duplication. APIs like kallsyms_lookup_name() and kallsyms_on_each_match_symbol() tries to match these symbol names without the .llvm.<hash> suffix, e.g., match "c_stop" with symbol c_stop.llvm.17132674095431275852. This turned out to be problematic for use cases that require exact match, for example, livepatch.
Fix this by making the APIs to match symbols exactly.
Also cleanup kallsyms_selftests accordingly.
--- kernel/kallsyms.c | 55 +++++--------------------------------- kernel/kallsyms_selftest.c | 22 +-------------- 2 files changed, 7 insertions(+), 70 deletions(-)
kernel/kallsyms.c +6 -49
@@ -160,38 +160,6 @@ unsigned long kallsyms_sym_address(int idx)return kallsyms_relative_base -1 - kallsyms_offsets[idx]; } -static void cleanup_symbol_name (char *s) -{ -char *res; - -if (!IS_ENABLED (CONFIG_LTO_CLANG )) -return ; - -/* -* LLVM appends various suffixes for local functions and variables that -* must be promoted to global scope as part of LTO. This can break -* hooking of static functions with kprobes. '.' is not a valid -* character in an identifier in C. Suffixes only in LLVM LTO observed: -* - foo.llvm.[0-9a-f]+ -*/ - res =strstr (s,".llvm." ); -if (res) - *res ='\0' ; - -return ; -} - -static int compare_symbol_name (const char *name,char *namebuf) -{ -/* The kallsyms_seqs_of_names is sorted based on names after -* cleanup_symbol_name() (see scripts/kallsyms.c) if clang lto is enabled. -* To ensure correct bisection in kallsyms_lookup_names(), do -* cleanup_symbol_name(namebuf) before comparing name and namebuf. -*/ -cleanup_symbol_name (namebuf); -return strcmp (name, namebuf); -} -static unsigned int get_symbol_seq (int index) {unsigned int i, seq =0 ;
@@ -219,7 +187,7 @@ static int kallsyms_lookup_names(const char *name, seq =get_symbol_seq (mid); off =get_symbol_offset (seq);kallsyms_expand_symbol (off, namebuf,ARRAY_SIZE (namebuf)); - ret =compare_symbol_name (name, namebuf); + ret =strcmp (name, namebuf);if (ret >0 ) low = mid +1 ;else if (ret <0 )
@@ -236,7 +204,7 @@ static int kallsyms_lookup_names(const char *name, seq =get_symbol_seq (low -1 ); off =get_symbol_offset (seq);kallsyms_expand_symbol (off, namebuf,ARRAY_SIZE (namebuf)); -if (compare_symbol_name (name, namebuf)) +if (strcmp (name, namebuf))break ; low--; }
@@ -248,7 +216,7 @@ static int kallsyms_lookup_names(const char *name, seq =get_symbol_seq (high +1 ); off =get_symbol_offset (seq);kallsyms_expand_symbol (off, namebuf,ARRAY_SIZE (namebuf)); -if (compare_symbol_name (name, namebuf)) +if (strcmp (name, namebuf))break ; high++; }
@@ -407,8 +375,7 @@ static int kallsyms_lookup_buildid(unsigned long addr,if (modbuildid) *modbuildid =NULL ; - ret =strlen (namebuf); - goto found; +return strlen (namebuf); }/* See if it's in a module or a BPF JITed image. */
@@ -422,8 +389,6 @@ static int kallsyms_lookup_buildid(unsigned long addr, ret =ftrace_mod_address_lookup (addr, symbolsize, offset, modname, namebuf); -found: -cleanup_symbol_name (namebuf);return ret; }
@@ -450,8 +415,6 @@ const char *kallsyms_lookup(unsigned long addr,int lookup_symbol_name (unsigned long addr,char *symname) { -int res; - symname[0 ] ='\0' ; symname[KSYM_NAME_LEN -1 ] ='\0' ;
@@ -462,16 +425,10 @@ int lookup_symbol_name(unsigned long addr, char *symname)/* Grab name */ kallsyms_expand_symbol (get_symbol_offset (pos), symname,KSYM_NAME_LEN ); - goto found; +return 0 ; }/* See if it's in a module. */ - res =lookup_module_symbol_name (addr, symname); -if (res) -return res; - -found: -cleanup_symbol_name (symname); -return 0 ; +return lookup_module_symbol_name (addr, symname); }/* Look up a kernel symbol and return it in a text buffer. */
kernel/kallsyms_selftest.c +1 -21
@@ -187,31 +187,11 @@ static void test_perf_kallsyms_lookup_name(void) stat.min, stat.max, div_u64(stat.sum, stat.real_cnt)); } -static bool match_cleanup_name (const char *s,const char *name) -{ -char *p; -int len; - -if (!IS_ENABLED (CONFIG_LTO_CLANG )) -return false; - - p =strstr (s,".llvm." ); -if (!p) -return false; - - len =strlen (name); -if (p - s != len) -return false; - -return !strncmp (s, name, len); -} -static int find_symbol (void *data,const char *name,unsigned long addr) {struct test_stat *stat = (struct test_stat *)data; -if (strcmp (name, stat->name) ==0 || - (!stat->perf &&match_cleanup_name (name, stat->name))) { +if (!strcmp (name, stat->name)) { stat->real_cnt++; stat->addr = addr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 121/273 iommu: Restore lost return in iommu_report_device_fault()
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barak Biber <[email protected]>
[ Upstream commit fca5b78511e98bdff2cdd55c172b23200a7b3404 ]
When iommu_report_device_fault gets called with a partial fault it is supposed to collect the fault into the group and then return.
Instead the return was accidently deleted which results in trying to process the fault and an eventual crash.
Deleting the return was a typo, put it back.
--- drivers/iommu/io-pgfault.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/io-pgfault.c +1 -0
@@ -192,6 +192,7 @@ void iommu_report_device_fault(struct device *dev, struct iopf_fault *evt)report_partial_fault (iopf_param, fault);iopf_put_dev_fault_param (iopf_param);/* A request that is not the last does not need to be ack'd */ +return ; }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 122/273 gpio: mlxbf3: Support shutdown() function
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asmaa Mnebhi <[email protected]>
[ Upstream commit aad41832326723627ad8ac9ee8a543b6dca4454d ]
During Linux graceful reboot, the GPIO interrupts are not disabled. Since the drivers are not removed during graceful reboot, the logic to call mlxbf3_gpio_irq_disable() is not triggered. Interrupts that remain enabled can cause issues on subsequent boots.
For example, the mlxbf-gige driver contains PHY logic to bring up the link. If the gpio-mlxbf3 driver loads first, the mlxbf-gige driver
will use a GPIO interrupt to bring up the link.
Otherwise, it will use polling.
The next time Linux boots and loads the drivers in this order, we encounter the issue:
- mlxbf-gige loads first and uses polling while the GPIO10
interrupt is still enabled from the previous boot. So if
the interrupt triggers, there is nothing to clear it.
- gpio-mlxbf3 loads.
- i2c-mlxbf loads. The interrupt doesn't trigger for I2C
because it is shared with the GPIO interrupt line which
was not cleared.
The solution is to add a shutdown function to the GPIO driver to clear and disable all interrupts. Also clear the interrupt after disabling it in mlxbf3_gpio_irq_disable().
--- drivers/gpio/gpio-mlxbf3.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpio/gpio-mlxbf3.c +14 -0
@@ -39,6 +39,8 @@#define MLXBF_GPIO_CAUSE_OR_EVTEN0 0x14#define MLXBF_GPIO_CAUSE_OR_CLRCAUSE 0x18 +#define MLXBF_GPIO_CLR_ALL_INTS GENMASK(31, 0) +struct mlxbf3_gpio_context {struct gpio_chip gc;
@@ -82,6 +84,8 @@ static void mlxbf3_gpio_irq_disable(struct irq_data *irqd) val =readl (gs->gpio_cause_io +MLXBF_GPIO_CAUSE_OR_EVTEN0 ); val &= ~BIT (offset);writel (val, gs->gpio_cause_io +MLXBF_GPIO_CAUSE_OR_EVTEN0 ); + +writel (BIT (offset), gs->gpio_cause_io +MLXBF_GPIO_CAUSE_OR_CLRCAUSE );raw_spin_unlock_irqrestore (&gs->gc.bgpio_lock, flags);gpiochip_disable_irq (gc, offset);
@@ -253,6 +257,15 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)return 0 ; } +static void mlxbf3_gpio_shutdown (struct platform_device *pdev) +{ +struct mlxbf3_gpio_context *gs =platform_get_drvdata (pdev); + +/* Disable and clear all interrupts */ +writel (0 , gs->gpio_cause_io +MLXBF_GPIO_CAUSE_OR_EVTEN0 ); +writel (MLXBF_GPIO_CLR_ALL_INTS , gs->gpio_cause_io +MLXBF_GPIO_CAUSE_OR_CLRCAUSE ); +} +static const struct acpi_device_id mlxbf3_gpio_acpi_match[] = { {"MLNXBF33" ,0 }, {}
@@ -265,6 +278,7 @@ static struct platform_driver mlxbf3_gpio_driver = { .acpi_match_table = mlxbf3_gpio_acpi_match, }, .probe = mlxbf3_gpio_probe, + .shutdown = mlxbf3_gpio_shutdown, };module_platform_driver (mlxbf3_gpio_driver);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 123/273 ALSA: hda/realtek: Fix noise from speakers on Lenovo IdeaPad 3 15IAU7
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parsa Poorshikhian <[email protected]>
[ Upstream commit ef9718b3d54e822de294351251f3a574f8a082ce ]
Fix noise from speakers connected to AUX port when no sound is playing. The problem occurs because the alc_shutup_pins function includes a 0x10ec0257 vendor ID, which causes noise on Lenovo IdeaPad 3 15IAU7 with Realtek ALC257 codec when no sound is playing.
Removing this vendor ID from the function fixes the bug.
--- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-)
sound/pci/hda/patch_realtek.c +0 -1
@@ -583,7 +583,6 @@ static void alc_shutup_pins(struct hda_codec *codec)switch (codec->core.vendor_id) {case 0x10ec0236 :case 0x10ec0256 : -case 0x10ec0257 :case 0x19e58326 :case 0x10ec0283 :case 0x10ec0285 :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 124/273 drm/v3d: Fix out-of-bounds read in `v3d_csd_job_run()`
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maíra Canal <[email protected]>
[ Upstream commit 497d370a644d95a9f04271aa92cb96d32e84c770 ]
When enabling UBSAN on Raspberry Pi 5, we get the following warning:
[ 387.894977] UBSAN: array-index-out-of-bounds in drivers/gpu/drm/v3d/v3d_sched.c:320:3 [ 387.903868] index 7 is out of range for type '__u32 [7]' [ 387.909692] CPU: 0 PID: 1207 Comm: kworker/u16:2 Tainted: G WC 6.10.3-v8-16k-numa #151 [ 387.919166] Hardware name: Raspberry Pi 5 Model B Rev 1.0 (DT) [ 387.925961] Workqueue: v3d_csd drm_sched_run_job_work [gpu_sched] [ 387.932525] Call trace: [ 387.935296] dump_backtrace+0x170/0x1b8 [ 387.939403] show_stack+0x20/0x38 [ 387.942907] dump_stack_lvl+0x90/0xd0 [ 387.946785] dump_stack+0x18/0x28 [ 387.950301] __ubsan_handle_out_of_bounds+0x98/0xd0 [ 387.955383] v3d_csd_job_run+0x3a8/0x438 [v3d] [ 387.960707] drm_sched_run_job_work+0x520/0x6d0 [gpu_sched] [ 387.966862] process_one_work+0x62c/0xb48 [ 387.971296] worker_thread+0x468/0x5b0 [ 387.975317] kthread+0x1c4/0x1e0 [ 387.978818] ret_from_fork+0x10/0x20 [ 387.983014] ---[ end trace ]---
This happens because the UAPI provides only seven configuration registers and we are reading the eighth position of this u32 array.
Therefore, fix the out-of-bounds read in v3d_csd_job_run() by accessing only seven positions on the '__u32 [7]' array. The eighth register exists indeed on V3D 7.1, but it isn't currently used. That being so, let's guarantee that it remains unused and add a note that it could be set in a future patch.
--- drivers/gpu/drm/v3d/v3d_sched.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/v3d/v3d_sched.c +11 -3
@@ -315,7 +315,7 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)struct v3d_dev *v3d = job->base.v3d;struct drm_device *dev = &v3d->drm;struct dma_fence *fence; -int i, csd_cfg0_reg, csd_cfg_reg_count; +int i, csd_cfg0_reg; v3d->csd_job = job;
@@ -335,9 +335,17 @@ v3d_csd_job_run(struct drm_sched_job *sched_job)v3d_switch_perfmon (v3d, &job->base); csd_cfg0_reg =V3D_CSD_QUEUED_CFG0 (v3d->ver); - csd_cfg_reg_count = v3d->ver <71 ?6 :7 ; -for (i =1 ; i <= csd_cfg_reg_count; i++) +for (i =1 ; i <=6 ; i++)V3D_CORE_WRITE (0 , csd_cfg0_reg +4 * i, job->args.cfg[i]); + +/* Although V3D 7.1 has an eighth configuration register, we are not +* using it. Therefore, make sure it remains unused. +* +* XXX: Set the CFG7 register +*/ +if (v3d->ver >=71 ) +V3D_CORE_WRITE (0 ,V3D_V7_CSD_QUEUED_CFG7 ,0 ); +/* CFG0 write kicks off the job. */ V3D_CORE_WRITE (0 , csd_cfg0_reg, job->args.cfg[0 ]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 125/273 rust: work around `bindgen` 0.69.0 issue
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
[ Upstream commit 9e98db17837093cb0f4dcfcc3524739d93249c45 ]
bindgen 0.69.0 contains a bug: --version does not work without providing a header [1]:
error: the following required arguments were not provided:
<HEADER>
Usage: bindgen <FLAGS> <OPTIONS> <HEADER> -- <CLANG_ARGS>...
Thus, in preparation for supporting several bindgen versions, work around the issue by passing a dummy argument.
Include a comment so that we can remove the workaround in the future.
Stable-dep-of: 5ce86c6c8613 ("rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT")
--- init/Kconfig | 5 ++++- scripts/rust_is_available.sh | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)
init/Kconfig +4 -1
@@ -1911,7 +1911,10 @@ config RUSTC_VERSION_TEXT config BINDGEN_VERSION_TEXT string depends on RUST - default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version || echo n) + # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 + # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when + # the minimum version is upgraded past that (0.69.1 already fixed the issue). + default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version workaround-for-0.69.0 || echo n) # # Place an empty function call at each tracepoint site. Can be
scripts/rust_is_available.sh +5 -1
@@ -129,8 +129,12 @@ fi # Check that the Rust bindings generator is suitable. # # Non-stable and distributions' versions may have a version suffix, e.g. `-dev`. +# +# The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 +# (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when +# the minimum version is upgraded past that (0.69.1 already fixed the issue). rust_bindings_generator_output=$( \ - LC_ALL=C "$BINDGEN" --version 2>/dev/null + LC_ALL=C "$BINDGEN" --version workaround-for-0.69.0 2>/dev/null ) || rust_bindings_generator_code=$? if [ -n "$rust_bindings_generator_code" ]; then echo >&2 "***"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 126/273 rust: suppress error messages from CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 5ce86c6c861352c9346ebb5c96ed70cb67414aa3 ]
While this is a somewhat unusual case, I encountered odd error messages when I ran Kconfig in a foreign architecture chroot.
$ make allmodconfig sh: 1: rustc: not found sh: 1: bindgen: not found # # configuration written to .config #
The successful execution of 'command -v rustc' does not necessarily mean that 'rustc --version' will succeed.
$ sh -c 'command -v rustc' /home/masahiro/.cargo/bin/rustc $ sh -c 'rustc --version' sh: 1: rustc: not found
Here, 'rustc' is built for x86, and I ran it in an arm64 system.
The current code:
command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n
can be turned into:
command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version 2>/dev/null || echo n
However, I did not understand the necessity of 'command -v $(RUSTC)'.
I simplified it to:
$(RUSTC) --version 2>/dev/null || echo n
--- init/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
init/Kconfig +2 -2
@@ -1906,7 +1906,7 @@ config RUST config RUSTC_VERSION_TEXT string depends on RUST - default $(shell,command -v $(RUSTC) >/dev/null 2>&1 && $(RUSTC) --version || echo n) + default $(shell,$(RUSTC) --version 2>/dev/null || echo n) config BINDGEN_VERSION_TEXT string
@@ -1914,7 +1914,7 @@ config BINDGEN_VERSION_TEXT # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when # the minimum version is upgraded past that (0.69.1 already fixed the issue). - default $(shell,command -v $(BINDGEN) >/dev/null 2>&1 && $(BINDGEN) --version workaround-for-0.69.0 || echo n) + default $(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null || echo n) # # Place an empty function call at each tracepoint site. Can be
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 127/273 rust: fix the default format for CONFIG_{RUSTC,BINDGEN}_VERSION_TEXT
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit aacf93e87f0d808ef46e621aa56caea336b4433c ]
Another oddity in these config entries is their default value can fall back to 'n', which is a value for bool or tristate symbols.
The '|| echo n' is an incorrect workaround to avoid the syntax error. This is not a big deal, as the entry is hidden by 'depends on RUST' in situations where '$(RUSTC) --version' or '$(BINDGEN) --version' fails. Anyway, it looks odd.
The default of a string type symbol should be a double-quoted string literal. Turn it into an empty string when the version command fails.
--- init/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
init/Kconfig +2 -2
@@ -1906,7 +1906,7 @@ config RUST config RUSTC_VERSION_TEXT string depends on RUST - default $(shell,$(RUSTC) --version 2>/dev/null || echo n) + default "$(shell,$(RUSTC) --version 2>/dev/null)" config BINDGEN_VERSION_TEXT string
@@ -1914,7 +1914,7 @@ config BINDGEN_VERSION_TEXT # The dummy parameter `workaround-for-0.69.0` is required to support 0.69.0 # (https://github.com/rust-lang/rust-bindgen/pull/2678). It can be removed when # the minimum version is upgraded past that (0.69.1 already fixed the issue). - default $(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null || echo n) + default "$(shell,$(BINDGEN) --version workaround-for-0.69.0 2>/dev/null)" # # Place an empty function call at each tracepoint site. Can be
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 128/273 s390/dasd: Remove DMA alignment
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Farman <[email protected]>
[ Upstream commit 2a07bb64d80152701d507b1498237ed1b8d83866 ]
This reverts commit bc792884b76f ("s390/dasd: Establish DMA alignment").
Quoting the original commit:
linux-next commit bf8d08532bc1 ("iomap: add support for dma aligned direct-io") changes the alignment requirement to come from the block device rather than the block size, and the default alignment requirement is 512-byte boundaries. Since DASD I/O has page alignments for IDAW/TIDAW requests, let's override this value to restore the expected behavior.
I mentioned TIDAW, but that was wrong. TIDAWs have no distinct alignment requirement (per p. 15-70 of POPS SA22-7832-13):
Unless otherwise specified, TIDAWs may designate a block of main storage on any boundary and length up to 4K bytes, provided the specified block does not cross a 4 K-byte boundary.
IDAWs do, but the original commit neglected that while ECKD DASD are typically formatted in 4096-byte blocks, they don't HAVE to be. Formatting an ECKD volume with smaller blocks is permitted (dasdfmt -b xxx), and the problematic commit enforces alignment properties to such a device that will result in errors, such as:
[test@host ~]# lsdasd -l a367 | grep blksz
blksz: 512
[test@host ~]# mkfs.xfs -f /dev/disk/by-path/ccw-0.0.a367-part1
meta-data=/dev/dasdc1 isize=512 agcount=4, agsize=230075 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=1 bigtime=1 inobtcount=1 nrext64=1
data = bsize=4096 blocks=920299, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0 error reading existing superblock: Invalid argument mkfs.xfs: pwrite failed: Invalid argument
libxfs_bwrite: write failed on (unknown) bno 0x70565c/0x100, err=22 mkfs.xfs: Releasing dirty buffer to free list!
found dirty buffer (bulk) on free list!
mkfs.xfs: pwrite failed: Invalid argument
...snipped...
The original commit omitted the FBA discipline for just this reason, but the formatted block size of the other disciplines was overlooked. The solution to all of this is to revert to the original behavior, such that the block size can be respected. There were two commits [1] that moved this code in the interim, so a straight git-revert is not possible, but the change is straightforward.
But what of the original problem? That was manifested with a direct-io QEMU guest, where QEMU itself was changed a month or two later with commit 25474d90aa ("block: use the request length for iov alignment") such that the blamed kernel commit is unnecessary.
[1] commit 0127a47f58c6 ("dasd: move queue setup to common code") commit fde07a4d74e3 ("dasd: use the atomic queue limits API")
--- drivers/s390/block/dasd_genhd.c | 1 - 1 file changed, 1 deletion(-)
drivers/s390/block/dasd_genhd.c +0 -1
@@ -41,7 +41,6 @@ int dasd_gendisk_alloc(struct dasd_block *block)*/ .max_segment_size = PAGE_SIZE, .seg_boundary_mask = PAGE_SIZE - 1, - .dma_alignment = PAGE_SIZE - 1, .max_segments = USHRT_MAX, };struct gendisk *gdp;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/273 io_uring/napi: Remove unnecessary s64 cast
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
[ Upstream commit f7c696a56cc7d70515774a24057b473757ec6089 ]
Since the do_div() macro casts the divisor to u32 anyway, remove the unnecessary s64 cast and fix the following Coccinelle/coccicheck warning reported by do_div.cocci:
WARNING: do_div() does a 64-by-32 division, please consider using div64_s64 instead
Stable-dep-of: 84f2eecf9501 ("io_uring/napi: check napi_enabled in io_napi_add() before proceeding")
--- io_uring/napi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/napi.c +1 -1
@@ -285,7 +285,7 @@ void __io_napi_adjust_timeout(struct io_ring_ctx *ctx, struct io_wait_queue *iows64 poll_to_ns =timespec64_to_ns (ts);if (poll_to_ns >0 ) {u64 val = poll_to_ns +999 ; -do_div (val, (s64 )1000 ); +do_div (val,1000 ); poll_to = val; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 130/273 io_uring/napi: use ktime in busy polling
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
[ Upstream commit 342b2e395d5f34c9f111a818556e617939f83a8c ]
It's more natural to use ktime/ns instead of keeping around usec, especially since we're comparing it against user provided timers, so convert napi busy poll internal handling to ktime. It's also nicer since the type (ktime_t vs unsigned long) now tells the unit of measure.
Keep everything as ktime, which we convert to/from micro seconds for IORING_[UN]REGISTER_NAPI. The net/ busy polling works seems to work with usec, however it's not real usec as shift by 10 is used to get it from nsecs, see busy_loop_current_time(), so it's easy to get truncated nsec back and we get back better precision.
Note, we can further improve it later by removing the truncation and maybe convincing net/ to use ktime/ns instead.
Stable-dep-of: 84f2eecf9501 ("io_uring/napi: check napi_enabled in io_napi_add() before proceeding")
--- include/linux/io_uring_types.h | 2 +- io_uring/io_uring.h | 2 +- io_uring/napi.c | 48 +++++++++++++++++++--------------- io_uring/napi.h | 2 +- 4 files changed, 30 insertions(+), 24 deletions(-)
include/linux/io_uring_types.h +1 -1
@@ -410,7 +410,7 @@ struct io_ring_ctx {spinlock_t napi_lock;/* napi_list lock */ /* napi busy poll default timeout */ -unsigned int napi_busy_poll_to; +ktime_t napi_busy_poll_dt;bool napi_prefer_busy_poll;bool napi_enabled;
io_uring/io_uring.h +1 -1
@@ -43,7 +43,7 @@ struct io_wait_queue {ktime_t timeout;#ifdef CONFIG_NET_RX_BUSY_POLL -unsigned int napi_busy_poll_to; +ktime_t napi_busy_poll_dt;bool napi_prefer_busy_poll;#endif };
io_uring/napi.c +27 -21
122 lines not on this page · raw message
io_uring/napi.h +1 -1
@@ -55,7 +55,7 @@ static inline void io_napi_add(struct io_kiocb *req)struct io_ring_ctx *ctx = req->ctx;struct socket *sock; -if (!READ_ONCE (ctx->napi_busy_poll_to)) +if (!READ_ONCE (ctx->napi_busy_poll_dt))return ; sock =sock_from_file (req->file);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/273 io_uring/napi: check napi_enabled in io_napi_add() before proceeding
In reply to Greg Kroah-Hartman6.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Langlois <[email protected]>
[ Upstream commit 84f2eecf95018386c145ada19bb45b03bdb80d9e ]
doing so avoids the overhead of adding napi ids to all the rings that do not enable napi.
if no id is added to napi_list because napi is disabled, __io_napi_busy_loop() will not be called.
--- io_uring/napi.c | 2 +- io_uring/napi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
io_uring/napi.c +1 -1
@@ -311,7 +311,7 @@ void __io_napi_busy_loop(struct io_ring_ctx *ctx, struct io_wait_queue *iowq) { iowq->napi_prefer_busy_poll =READ_ONCE (ctx->napi_prefer_busy_poll); -if (!(ctx->flags &IORING_SETUP_SQPOLL ) && ctx->napi_enabled) +if (!(ctx->flags &IORING_SETUP_SQPOLL ))io_napi_blocking_busy_loop (ctx, iowq); }
io_uring/napi.h +1 -1
@@ -55,7 +55,7 @@ static inline void io_napi_add(struct io_kiocb *req)struct io_ring_ctx *ctx = req->ctx;struct socket *sock; -if (!READ_ONCE (ctx->napi_busy_poll_dt)) +if (!READ_ONCE (ctx->napi_enabled))return ; sock =sock_from_file (req->file);
Signature · 1 line
2.43.0