Repository navigation
Rebase edera/mainline onto master @ aebb72744764 - #114
Closed
edera-rebase-app[bot] wants to merge 10000 commits into
Closed
edera-rebase-app[bot] wants to merge 10000 commits into
edera-rebase-app[bot] wants to merge 10000 commits into
Conversation
…it/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
"These address a few issues in the cpufreq core and drivers, including
issues actually seen in the field, a few issues related to runtime PM,
including a false-positive warning introduced relatively recently and
a long-standing defect in the runtime PM core code related to
autosuspend, and revert a problematic recent update of the intel_rapl
power capping driver.
Specifics:
- Revert a recent update of the intel_rapl power capping driver that
caused perf to return bogus values (Dennis Chen)
- Fix the synchronization of boost state updates in cpufreq
(Christian Loehle)
- Fix issues related to system suspend-resume synchronization in the
cpufreq core and intel_pstate driver (Rafael Wysocki)
- Fix P-state index mismatch in extract_io() in the ACPI cpufreq
driver on systems with defective _PSS (Li RongQing)
- Fix issues related to target frequency caching in cpufreq (Rafael
Wysocki)
- Prevent a false-positive warning in pm_runtime_remove() introduced
by a previous fix during the 7.0 development cycle (Zhou Minqiang)
- Extend a recent improvement related to the handling of suppliers
during device runtime-suspend to some previously missed cases in
which it is relevant for consistency (Brian Norris)
- Update runtime PM documentation to reflect new behavior after
recent changes (Stanley Jhu)
- Add last_busy timestamp updates for devices requested to resume
from runtime suspend that are missing if those devices are not
actually suspended (Rafael Wysocki)"
* tag 'pm-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
Revert "powercap: intel_rapl: Expose all package CPUs in PMU cpumask"
PM: runtime: Update last_busy in rpm_resume() for active devices
cpufreq: Fix updates of cached resolved frequency and index
cpufreq: Cache post-resolution target frequency in __resolve_freq()
cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()
cpufreq: Serialize global boost updates
cpufreq: Preserve global boost state on failed updates
PM: runtime: Update runtime_pm.rst for non-fatal resume errors
PM: runtime: Only queue an idle check for RPM-linked suppliers (part 2)
PM: runtime: Fix check_flush_dependency warning from pm_runtime_remove
cpufreq: intel_pstate: Use rdmsrq_safe() to read MSR_MISC_PWR_MGMT
cpufreq: intel_pstate: Clear last written P-state value on suspend
cpufreq: Force passing target frequency to driver during resume
cpufreq: Improve suspend-resume synchronization
cpufreq: Hold the policy write lock when changing boost state
…/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki:
"These fix a mistake in the ACPI APEI GHES code causing recoverable
CPU, memory, CXL and vendor-specific errors reported through GHES to
never show up in a vmcore, address a potential deadlock related to
ACPI device hotplug that causes lockdep to complain and give up, and
fix up the recently added support for _Ixx GPEs:
- Make recoverable CPU, memory, CXL and vendor-specific errors
reported through GHES show up in vmcores by fixing a broken error
severity check in ghes_log_hwerr() (Breno Leitao)
- Avoid printing diagnostic messages for ACPI device objects after
dropping reference to them (Sasha Levin)
- Avoid holding the physical_node_lock for ACPI device objects across
device_offline() and device_online() due to a potential deadlock
that causes lockdep to complain and turn itself off (Sasha Levin)
- Avoid spurious system wakeups from suspend-to-idle on platforms
where an _Ixx GPE is shared by user-wakeup and background events
(Saranya Gopal)"
* tag 'acpi-7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: s2idle: Handle shared _Ixx GPEs without an EC
ACPI: APEI: GHES: Fix severity check in ghes_log_hwerr()
ACPI: scan: Do not hold physical_node_lock across device_offline() and device_online()
ACPI: scan: Print the offline failure message in acpi_bus_offline()
All E825C PFs share the CGU registers R10 and R11. On dual complex E825 the second complex reaches the CGU of complex 0 through cgu_peer. RCLK pin callbacks read, modify and write these registers under dpll_lock and the pf->dplls.lock of their PF. ice_ptp_link_change() rewrites R10 under the pf->dplls.lock of its PF only, so a link change on one PF can write back a stale R10 and undo an RCLK pin change made by another PF. Add a mutex to struct ice_adapter, which all E825C PFs share, and hold it around these sequences. Tested on GNR-D with dual complex E825, with a 2 to 4 ms delay after the read of R10 in the link change path to widen the window. Toggling the RCLK pin of one port while another port of the same complex went down and up 143 times lost 120 of 86814 updates of the mux in R10 without this patch, and none of 76992 with it. Fixes: ad1df4f ("ice: dpll: Support E825-C SyncE and dynamic pin discovery") Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Petr Oros <poros@redhat.com> Link: https://patch.msgid.link/20261110094350.184185-2-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
R10 holds one divider for each recovered clock output, shared by all ports. ice_ptp_link_change() sets it from the link speed of its own port even when another port drives the output, and checks the mux only to decide whether an error is worth reporting. With ports running at different speeds, a link change on one port leaves the output of another port with a wrong divider. Skip the outputs that the port does not drive, and check the mux under cgu_synce_lock, so that another PF cannot select its port in between. The check computes the mux value as port % ports_per_phy + 3, while ice_tspll_cfg_bypass_mux_e825c() and ice_dpll_rclk_update_e825c() use port + 3. With the skip, a port from ports_per_phy up would never update the divider, so use port + 3 as they do. Tested on GNR-D with dual complex E825. With the RCLK pin of one port connected, five down and up cycles of another port of the same complex called ice_tspll_cfg_synce_ethdiv_e825c() 20 times without this patch and never with it. Five cycles of the port driving the output still called it 10 times. Both ports ran at 25 Gb/s, so the divider value did not change on this setup. Fixes: ad1df4f ("ice: dpll: Support E825-C SyncE and dynamic pin discovery") Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Petr Oros <poros@redhat.com> Link: https://patch.msgid.link/20261110094350.184185-3-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Ivan Vecera says: ==================== ice: dpll: fix updates of the SyncE CGU registers on E825 All E825C PFs share the CGU registers R10 and R11, which hold the mux and the divider of the two recovered clock outputs. Both patches fix how a link change updates them, both found in review: - Patch 1 adds a lock shared by all PFs around the read-modify-write sequences of these registers. A link change on one PF could undo an RCLK pin change made by another PF. - Patch 2 lets a link change set the divider of an output only when its port drives that output. Every port set it from its own link speed, which is wrong when ports run at different speeds. Both were tested on GNR-D with dual complex E825, details are in the commit messages. Patch 1 was also patch 2 of the net-next series "dpll: do not serialize driver callbacks under global dpll_lock" [1], which needs it. v2 of that series will drop it. [1] https://lore.kernel.org/netdev/20261106121005.1327603-1-ivecera@redhat.com/ ==================== Link: https://patch.msgid.link/20261110094350.184185-1-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
gtp0_handle_echo_resp() and gtp1u_handle_echo_resp() return the result
of genlmsg_multicast_netns() to gtp_encap_recv(). When the netlink
notification is delivered that result is 0, and gtp_encap_recv() treats
0 as "the skb has been consumed":
switch (ret) {
case 1:
netdev_dbg(gtp->dev, "pass up to the process\n");
break;
case 0:
break;
case -1:
netdev_dbg(gtp->dev, "GTP packet has been dropped\n");
kfree_skb(skb);
ret = 0;
break;
}
The echo response handlers only read from the skb and never free it or
pass it on, so every echo response that is reported to a listener on the
gtp multicast group leaks the skb. Echo responses are handled for any
peer when the UDP sockets were created by the kernel, so a remote host
can leak memory on the receiver by sending GTP echo responses while a
process with CAP_NET_ADMIN is subscribed to the gtp multicast group, for
example a daemon that monitors echo responses.
The error paths do not leak but have a related problem. -ENOMEM and the error from
genlmsg_multicast_netns() (-ESRCH when nobody listens) are not -1, so
they are returned unchanged to the UDP stack, which takes a negative
value from encap_rcv() as a request to resubmit the packet to the
protocol with that number.
Return -1 when the notification cannot be built, so that
gtp_encap_recv() drops the skb, and consume the skb once the
notification has been handed to netlink, whether or not anybody is
listening.
Found by LLM-assisted source review, untested.
Fixes: d33bd75 ("gtp: Implement GTP echo request")
Cc: stable@vger.kernel.org
Signed-off-by: Joas Antonio dos Santos <joasantonio108@gmail.com>
Link: https://patch.msgid.link/20261110-gtp-echo-rsp-leak-v1-1-192c032f3dfa@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
…inux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski:
"To no surprise, this batch was mostly driven by issues found by LLMs
(notably: sashiko) during reviews of other changes. This is why it's
bigger than what I normally send at this stage.
Fixes in GPIO core:
- fix a race in shared GPIO descriptor release path
- fix several issues in gpio-shared-proxy: race between concurrent
initial users, dropping votes in error paths and driving the
default value with no votes cast
- fix stack out-of-bounds access bugs in GPIO hog handling
- fix a race in GPIO descriptor consumer label update
- reset lookup flags on each hogged line
- fix GPIO descriptor leak and fast-path cancellation in
gpiod_get_array()
- fix return value in of_gpiochip_instance_match() stub for
!CONFIG_OF
- fix potential misconfiguration of flags for hogged lines on OF
systems
- fix a reference leak in deferred GPIO controller setup error path
Fixes in GPIO drivers:
- fix interrupt handling bugs in gpio-aspeed
- fix an interrupt leak and two UAF bugs in gpio-virtuser
- fix a UAF bugs in gpio-sodaville, gpio-mpc8xxx and gpio-brcmstb
- fix a sleeping-while-atomic bug in gpio-mvebu
- reject unsupported interrupt types in gpio-mpfs
- fix an irqchip leak in gpio-regmap helper
- fix debounce arithmetic in gpio-rockchip
- propagate runtime PM failures in gpio-omap
- defer GPIO chip registration to postcore_initcall() in gpio-sa1100"
* tag 'gpio-fixes-for-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (26 commits)
gpiolib: fix stack out-of-bounds access in gpiochip_add_hog()
gpio: shared: fix a race in shared desc release path
gpio: sodaville: fix use-after-free bug when registering the irqchip
gpio: virtuser: fix interrupt leak and UAF
gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()
gpiolib: synchronize updates of descriptor labels
gpiolib: of: return -ENOENT from of_gpio_count() stub
gpiolib: fix fast-path cancellation in gpiod_get_array()
gpiolib: fix GPIO descriptor leak in gpiod_get_array()
gpio: of: fix potential misconfiguration of hogged lines
gpio: mpfs: reject unsupported interrupt types
gpio: keep the chip reference when deferred setup fails
gpio: regmap: free the irqchip if adding the irq domain fails
gpio: aspeed: Preserve the pending G7 interrupt status on control writes
gpio: aspeed: Clear only the acked line's G4 interrupt status
gpiolib: reset lookup flags for each hogged line
gpio: virtuser: remove the debugfs files before freeing the line data
gpio: mpc8xxx: Fix potential use-after-free of IRQ domain
gpio: shared-proxy: Drop the vote when switching to input
gpio: shared-proxy: Drive the default value when no votes are cast
...
Since commit abed42f ("net/mlx5e: Conditionally create async ICOSQ"), the async ICOSQ is only created when an XDP program is attached or priv->ktls_rx_was_enabled is set. When TLS RX offload is enabled for the first time, mlx5e_ktls_set_feature_rx() sets the flag and reopens the channels so that they get the queue, but it ignores the return value of mlx5e_safe_reopen_channels(). If the reopen fails, mlx5e_safe_switch_params() keeps the old channels, which have no async ICOSQ, while NETIF_F_HW_TLS_RX is still reported as enabled. The next offloaded RX connection then dereferences the NULL c->async_icosq in post_rx_param_wqes(). Enabling the feature again does not help, as the flag is already set and the reopen is skipped. Propagate the error, clear the flag and destroy the accel TCP flow tables again, so that the feature stays disabled and the next attempt retries the reopen. Fixes: abed42f ("net/mlx5e: Conditionally create async ICOSQ") Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20261110101709.2589088-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
No extack reasons were given to unsupported TC actions. Set a reason on the default path before falling back, and drop the now-redundant initializer of `reason`, so the compiler warns on any future path that uses it without assigning one. Fixes: 8eb9e75 ("net: dsa: yt921x: Add ACL support") Signed-off-by: David Yang <mmyangfl@gmail.com> Link: https://patch.msgid.link/20261110104930.223598-2-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
The hardware resolves one forward decision per ACL rule, but the translation accumulated every action, so a later action silently changed the verdict of the ones before it: an `action drop action trap` filter with skip_sw trapped packets to the CPU instead of dropping them. Resolve the list against its first terminal action, and ask for software assistance if any action follows the redirect action. Fixes: 8eb9e75 ("net: dsa: yt921x: Add ACL support") Signed-off-by: David Yang <mmyangfl@gmail.com> Link: https://patch.msgid.link/20261110104930.223598-3-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
A flower filter on a block shared across ports is offloaded as one hardware rule per port, all carrying the same classifier cookie. Deletion looked a rule up by cookie alone and could take another port's copy: with skip_sw, a filter silently stopped being enforced on a still-bound port, while the detached port kept enforcing it. Delete the rule matching the port being unbound instead. Fixes: 8eb9e75 ("net: dsa: yt921x: Add ACL support") Signed-off-by: David Yang <mmyangfl@gmail.com> Link: https://patch.msgid.link/20261110104930.223598-4-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
David Yang says: ==================== net: dsa: motorcomm: ACL fixup Various ACL defects. Found by LLM and manually verified (on YT9215). ==================== Link: https://patch.msgid.link/20261110104930.223598-1-mmyangfl@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
With IPv6 enabled, sk_saddr_any() checks sk_v6_rcv_saddr also for AF_INET sockets, where it is always zero. An IPv4 tunnel socket bound to a specific address (e.g. fou or geneve with "local") ends up in the GRO lookup fast path, although another socket may bind the same port on a different address: GRO then hands that socket's packets to the tunnel's gro_receive. Check the IPv6 address only for AF_INET6 sockets. Fixes: a36283e ("udp_tunnel: create a fastpath GRO lookup.") Signed-off-by: Antonio Quartulli <antonio@mandelbit.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20261110113306.3698438-1-antonio@mandelbit.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
When firmware reports a function as not LAG capable (lag_master=0 or num_lag_ports < 2), mlx5_lag_add_mdev() creates no LAG object for it. Enabling multiport E-Switch on such a device returns 0 from mlx5_lag_mpesw_queue_work(), so "devlink dev param set ... esw_multiport value true" reports success although nothing was enabled, and a following "devlink dev param show" still reports false. Return -EOPNOTSUPP instead. mlx5_lag_mpesw_disable() ignores the return value, so disabling keeps its current behavior. Fixes: a32327a ("net/mlx5: Lag, Control MultiPort E-Switch single FDB mode") Signed-off-by: Uri Dar <udar@nvidia.com> Reviewed-by: Shay Drori <shayd@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Daniel Machon <daniel.machon@microchip.com> Link: https://patch.msgid.link/20261110114350.2639891-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
…/linux/kernel/git/brgl/linux Pull power sequencing fixes from Bartosz Golaszewski: - fix a use-after-free bug and a serdev reference leak in pwrseq-pcie-m2 - increase WCN7850 power-up delay in pwrseq-qcom-wcn - make the API contract for pwrseq descriptor serialization clearer * tag 'pwrseq-fixes-for-v7.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: power: sequencing: pcie-m2: fix serdev controller reference leak power: sequencing: pcie-m2: use devm_mutex_init() power: sequencing: pcie-m2: fix use-after-free in pwrseq_pcie_m2_vregs_enable() power: sequencing: core: add a note on descriptor serialization power: sequencing: qcom-wcn: increase WCN7850 power-up delay
netif_close() must be called with RTNL held in addition to the netdev instance lock: __dev_close_many() asserts it, and the NETDEV_GOING_DOWN and NETDEV_DOWN notifier chains it runs rely on it for serialization. Commit 004b500 ("eth: bnxt: remove most dependencies on RTNL") replaced rtnl_lock() with netdev_lock() in bnxt_fw_reset_task() and bnxt_fw_reset(). That is sufficient for the paths that only tear the NIC down internally with __bnxt_close_nic(), but the abort paths close the netdev via bnxt_fw_reset_abort() -> netif_close(), and the error path in bnxt_fw_reset() calls netif_close() directly. Those now run without RTNL and trigger a WARN_ONCE() cascade when a firmware reset is aborted: RTNL: assertion failed at net/core/dev.c (1740) WARNING: net/core/dev.c:1740 at __dev_close_many+0x1be/0x1f0 Workqueue: bnxt_pf_wq bnxt_fw_reset_task [bnxt_en] Call Trace: netif_close_many+0xb5/0x190 netif_close+0xa2/0xd0 bnxt_fw_reset_task.cold+0x8d/0x213 [bnxt_en] process_one_work+0x19d/0x3a0 worker_thread+0x1af/0x320 kthread+0xe3/0x120 followed by the same assertion from call_netdevice_notifiers_info(), fib_rules_event(), inetdev_event(), rtnl_fill_ifinfo(), devlink_compat_phys_port_name_get() and ip_mc_down(). This was observed on a machine in real use with a BCM57504 (4 PFs, FW 236.1.153.0) running v7.1.6: the firmware crashed, announced a "Fatal firmware reset event" and then failed to come back within the advertised max wait, so bnxt_fw_reset_task() aborted the reset on all ports: bnxt_en 0000:c1:00.1 eno16905np1: Firmware reset aborted bnxt_en 0000:c1:00.1 eno16905np1: fw_health_status 0x448100 Take RTNL (before the netdev instance lock, matching the OPENING state which already uses rtnl_trylock()) in the fw_reset_abort path of bnxt_fw_reset_task() and route the POLL_VF abort through that same path. In bnxt_fw_reset(), only a PF can reach the bnxt_get_registered_vfs() error path that calls netif_close(), so take RTNL up front via bnxt_rtnl_lock_sp() when BNXT_PF(bp) is true and keep bnxt_lock_sp() on VFs. That avoids dropping the instance lock mid-reset (which would expose a transient BNXT_STATE_IN_FW_RESET and let a concurrent devlink health recover set BNXT_STATE_IN_SP_TASK), avoids racing with bnxt_sriov_configure() updating active_vfs outside RTNL, and keeps VFs from contending on RTNL during recovery while PFs already run on the single-threaded bnxt_pf_wq. The bug was found by inspecting the kernel log of the affected machine and the driver source; the fix was prepared with the help of an AI coding assistant (Gemini based) and reviewed by the submitter. It is build tested (allmodconfig with W=1, plus the same change on top of v7.1.6 built as a module for the affected BCM57504 host). The aborted reset path itself only runs when the firmware fails to return from a reset, which could not be reproduced on demand. Fixes: 004b500 ("eth: bnxt: remove most dependencies on RTNL") Cc: stable@vger.kernel.org Signed-off-by: Bryan Cochrane <bcochrane@google.com> Link: https://patch.msgid.link/20261110044235.204386-1-bcochrane@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
If userspace tries to update the GCS mode as part of signal return then we update the thread state but don't update GCSCRE0_EL1, meaning the change does not take effect. We may also get issues for other tasks on context switch since we suppress writes of the register if the two tasks have the same mode. Since no currently known userspace tries to use this functionality close this by ignoring any attempt to change the mode through signal return. The GCS mode for the current thread can be changed using the prctl() interface and will be preserved on signal return, allowing updates to the mode from the signal handler. Reported-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/as-8IqsbMbOBo5Oq@arm.com Suggested-by: Catalin Marinas <catalin.marinas@arm.com> Fixes: 16f47bb ("arm64/signal: Expose GCS state in signal frames") Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
virtio_net_hdr_tnl_from_skb() builds a wrong header for VLAN tagged UDP tunnel GSO packets. 1) When the skb carries a hwaccel VLAN tag, tun_put_user() inserts the 802.1Q header in the frame it copies to user space or vhost-net, and passes vlan_hlen = VLAN_HLEN. virtio_net_hdr_from_skb() adds vlan_hlen to csum_start, but inner_nh_offset and outer_th_offset do not account for it, and are 4 bytes short of the real inner L3 and outer UDP headers in the emitted frame. tun advertises NETIF_F_HW_VLAN_CTAG_TX and NETIF_F_HW_VLAN_STAG_TX in hw_enc_features, and its vlan_features keep the UDP tunnel GSO features, so this happens for example with a VLAN filtering bridge with a tagged port, or with a vlan device on top of a tap. 2) The outer family comes from skb->protocol, which is ETH_P_8021Q or ETH_P_8021AD when the VLAN tag is in the packet data, so a packet with an outer IPv6 header is reported as VIRTIO_NET_HDR_GSO_UDP_TUNNEL_IPV4. This happens when __vlan_hwaccel_push_inside() inserted the tag because the device does not offload it: virtio_net never offloads VLAN insertion but keeps UDP tunnel GSO in its vlan_features, and tun does the same with VLAN TX offload disabled, or with QinQ (outer tag offloaded, inner tag in the data). The receiver sets inner_network_header and transport_header from these offsets, and checks them with the wrong outer family. A forwarded packet that gets segmented again uses the wrong inner headers, and a receiver checking the outer headers against the virtio header drops the packet. Add vlan_hlen to both offsets like csum_start, and take the outer family from vlan_get_protocol(), which skips VLAN tags in the data. Fixes: a2fb4bc ("net: implement virtio helpers to handle UDP GSO tunneling.") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/netdev/179421814766.994134.3669228181251158303@kernel.org/ Closes: https://lore.kernel.org/netdev/179433950084.994134.15100186606737698605@kernel.org/ Signed-off-by: Eric Dumazet <edumazet@kernel.org> Link: https://patch.msgid.link/20261110213628.3476051-2-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
With IFF_NAPI_FRAGS, tun_napi_alloc_frags() gets its skb from napi_get_frags(). If GRO merged the previous frame with GRO_MERGED_FREE, that skb was recycled by napi_reuse_skb(), which does not reset skb->protocol set by napi_frags_skb() for the previous frame. tun_get_user() calls tun_vnet_hdr_tnl_to_skb() before eth_type_trans(), so the virtio header checks see the protocol of the previous frame: GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are dissected with the wrong protocol. A following change checks the outer protocol of UDP tunnel GSO packets, which would then reject a valid frame when the two ethertypes differ. This needs GRO to hold packets across writes, and IFF_NAPI_FRAGS needs CAP_NET_ADMIN. Clear skb->protocol in tun_napi_alloc_frags(), like skbs allocated by tun_alloc_skb() or build_skb(). eth_type_trans() sets it later. Fixes: 90e33d4 ("tun: enable napi_gro_frags() for TUN/TAP driver") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/netdev/179386753589.488856.11455181721004759454@kernel.org/ Suggested-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Eric Dumazet <edumazet@kernel.org> Link: https://patch.msgid.link/20261110213628.3476051-3-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
virtio_net_hdr_tnl_to_skb() trusts the virtio header to describe a UDP tunnel over IPv4 or IPv6, but never checks that the frame actually carries such outer headers. Because VIRTIO_NET_HDR_F_NEEDS_CSUM is mandatory for tunnel GSO, __virtio_net_hdr_to_skb() skips the flow dissector, so virtio_net_hdr_match_proto() is never applied either. A guest (or a tap writer) can then inject a frame with an arbitrary outer ethertype, for example ETH_P_NSH, with SKB_GSO_UDP_TUNNEL set. The GSO stack then runs nsh_gso_segment() on top of the UDP tunnel segmentation, which assumes a different header layout. The result is segments with skb->data before skb->head, and a host crash in skb_under_panic() as soon as a later layer pushes a header: skbuff: skb_under_panic: ... put:4 ... dev:gretap1 kernel BUG at net/core/skbuff.c:215! skb_push __gre_xmit gre_tap_xmit ... tun_get_user Validate the outer headers with the parsing helpers from Michael's series "net: resolve uncommon partial checksums at ingress": - locate the L3 header: Ethernet with optional VLAN tags, or the network header set by the caller. skb->protocol is not trusted when it disagrees with the frame. - require the outer L3 protocol to match the declared tunnel type. - require the outer UDP header exactly at outer_th_offset, after IPv4 options or IPv6 extension headers, and reject fragments. Unlike the original helpers: - the callers tell whether the frame starts with an Ethernet header, with a new has_eth argument of virtio_net_hdr_tnl_to_skb(), instead of using the device type. tun frames packets from its IFF_TAP and IFF_TUN flags, and TUNSETLINK can set the device type to any value. virtio_net and tun_xdp_one() always pass true, tun_get_user() passes whether the device is IFF_TAP. - ipv6_find_hdr() stops at an AH header, as Willem suggested in the review of that series. Fixes: a2fb4bc ("net: implement virtio helpers to handle UDP GSO tunneling.") Reported-by: Hassan Sultan <hassansultan@google.com> Suggested-by: Willem de Bruijn <willemb@google.com> Link: https://lore.kernel.org/netdev/93d0e37c99711bebdf60c120af03010455c2f2e2.1793276116.git.mst@redhat.com/ Co-developed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Eric Dumazet <edumazet@kernel.org> Link: https://patch.msgid.link/20261110213628.3476051-4-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
…ckets' Eric Dumazet says: ==================== net: virtio: validate outer protocol of UDP tunnel GSO packets virtio_net_hdr_tnl_to_skb() does not check that a UDP tunnel GSO packet really has outer IPv4/IPv6 and UDP headers matching the declared tunnel type. A guest, or any tap writer, can send a frame with another outer ethertype (NSH in the report), and the GSO stack then builds segments with skb->data before skb->head. The host crashes in skb_under_panic() as soon as a header is pushed. Patch 1 fixes the producer side, virtio_net_hdr_tnl_from_skb(), for VLAN tagged packets: - the tunnel offsets did not account for the VLAN tag tun inserts in the frame, and were 4 bytes short. - the outer family came from skb->protocol, which is the VLAN protocol when the tag is in the packet data, so an outer IPv6 header was reported as IPv4. Without it, patch 3 would drop such packets. Kernels without this fix still send such headers, so it should go to stable along with patch 3. Patch 2 clears a stale skb->protocol left on recycled NAPI frags skbs, which could make the checks of patch 3 reject valid frames. Patch 3 validates the outer headers, using the parsing helpers from Michael's series "net: resolve uncommon partial checksums at ingress", as Willem suggested. The callers tell whether frames start with an Ethernet header, as the device type of a tun device can be changed with TUNSETLINK. The rest of Michael's series (checksum validation and completion) is left to him. The selftests of v3 will follow in a separate series, with the fixes Sashiko found in them. ==================== Link: https://patch.msgid.link/20261110213628.3476051-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
NiceHCK Octave is an OEM of TTGK TT39039F01-PROMAX[1] and supports DSD64/ DSD128/DSD256/DSD512[2]. It advertises the UAC2 RAW_DATA format on altsetting 4 of its playback interface, but without the DSD_RAW quirk flag the driver exposes it only as a SPECIAL format that cannot be used. Add QUIRK_FLAG_DSD_RAW for the device (USB ID 3302:39c3), so the altsetting is exposed as DSD_U32_BE, enabling native DSD playback. [1] https://www.audiosciencereview.com/forum/index.php?threads/nicehck-octave-dongle-dac.65535/post-2390027 [2] https://szttgk.com/product/HIFIAUDIOMODULE/846.html Signed-off-by: Shengyu Qu <wiagn@4d2.org> Link: https://patch.msgid.link/20261112173131.86655-1-wiagn@4d2.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Add the active email address for Hangbin Liu and map the old or rarely-used addresses to it. This prevents get_maintainer.pl from listing not actively used addresses as patch recipients. Signed-off-by: Hangbin Liu <liuhangbin@kylinos.cn> Link: https://patch.msgid.link/20261111-mailmap-v1-1-8ab349555808@kylinos.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
…ck_req().
When connection migration happens in tcp_v[46]_rcv(), a new
listener is passed to tcp_check_req().
When either of the following is true,
* the new listener queue is full and
net.ipv4.tcp_abort_on_overflow is set
* the packet has RST or (not stripped) SYN
tcp_check_req() sends RST and calls inet_csk_reqsk_queue_drop().
Here, the new listener is passed, and its qlen is decremented
wrongly while reqsk is tied to the old listener.
Once qlen underflows, inet_csk_reqsk_queue_is_full() always
return true, and the new listener stops serving.
Without the patch, this script times out while waiting for SYN+ACK
since the new listener drops SYN, but with the patch, 3WHS completes.
0 `sysctl -q net.ipv4.tcp_migrate_req=1`
+0 `sysctl -q net.ipv4.tcp_syncookies=0`
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
+0 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0
+0 bind(4, ..., ...) = 0
+0 listen(4, 128) = 0
+0 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 listen(3, 128) = 0
+0 close(4) = 0
+.01 < R 1:1(0) win 0
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0 listen(5, 1) = 0
+.01 < S 0:0(0) win 32792 <mss 1000>
+0 > S. 0:0(0) ack 1 <...>
+0 < . 1:1(0) ack 1 win 32792
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 accept(3, ..., ...) = 6
Let's pass req->rsk_listener instead.
Fixes: d4f2c86 ("tcp: Migrate TCP_NEW_SYN_RECV requests at receiving the final ACK.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261111020304.1532064-2-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
When SO_INQ is enabled on a listening AF_UNIX SOCK_STREAM socket, accepted sockets created by unix_stream_connect() do not inherit u->recvmsg_inq from the listener, unlike TCP_INQ, AF_VSOCK SO_INQ, and AF_UNIX SO_RIGHTS_NOTRUNC. As a result, recvmsg() on the accepted socket never puts an SCM_INQ control message unless SO_INQ is set again after accept(). Copy otheru->recvmsg_inq to newu->recvmsg_inq in unix_stream_connect() using READ_ONCE() to pair with the lockless WRITE_ONCE() in unix_setsockopt(). Found during LLM-assisted code review of unix_stream_connect() while comparing option inheritance between SO_INQ and SO_RIGHTS_NOTRUNC. Confirmed on UML (x86_64) by enabling SO_INQ on a listening AF_UNIX SOCK_STREAM socket before listen() and accept(), sending data from a connected client, and observing that recvmsg() on the accepted socket returned no SCM_INQ control message. Tested on UML (x86_64) against the reproducer, verifying that recvmsg() on the accepted socket now returns the expected SCM_INQ control message, and ran the tools/testing/selftests/net/af_unix/scm_inq selftest (all 6 test cases passed). Fixes: df30285 ("af_unix: Introduce SO_INQ.") Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20261111023222.77227-1-sunwenbo@cmss.chinamobile.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
In amt_mldv1_leave_handler(), which handles IPv6 MLDv1 Done (ICMPV6_MGM_REDUCTION) messages, the source address is mistakenly extracted via ip_hdr(skb)->saddr into host.ip4 instead of copying the IPv6 source address from ipv6_hdr(skb)->saddr into host.ip6 as amt_mldv1_report_handler() does. Because amt_lookup_group() compares the full union amt_addr for v6 groups, looking up the group with a 32-bit IPv4 header slice fails to match the group entry created by amt_mldv1_report_handler(). As a result, amt_del_group() is not called when an MLDv1 listener leaves, and the AMT relay continues forwarding multicast traffic until the group timer expires. Use ipv6_hdr(skb) and copy ip6h->saddr into host.ip6 so that MLDv1 Done messages properly match and delete the corresponding IPv6 group. This issue was found via LLM-assisted code review, confirmed by reproducing the stale group forwarding in a User-Mode Linux (ARCH=um) environment, and verified in UML by testing that AMT relay multicast forwarding stops immediately after receiving an MLDv1 Done message. Fixes: b75f709 ("amt: add mld report message handler") Signed-off-by: Wenbo Sun <sunwenbo@cmss.chinamobile.com> Link: https://patch.msgid.link/20261111031147.105834-1-sunwenbo@cmss.chinamobile.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
A syzkaller reproducer assigning INT_MAX as a peer nsid triggers an idr_get_next() warning during netns cleanup. With panic_on_warn, this panics the kernel. alloc_netid() also overflows reqid + 1 for this nsid. Use idr_alloc_u32() for requested IDs and idr_get_next_ul() for cleanup so the cursor can advance past INT_MAX. QEMU/KVM reproduced the warning without kernel changes or fault injection. The same reproducer ran without warnings after this change. Kernel selftests were not run. Fixes: 7acee67 ("netns: optimize netns cleaning by batching unhash_nsid calls") Cc: stable@vger.kernel.org Signed-off-by: Zhao Gongyi <zhaogongyi@bytedance.com> Link: https://patch.msgid.link/20261111033525.65828-1-zhaogongyi@bytedance.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
cdc_ncm_ndp16() and cdc_ncm_ndp32() verify that the new NDP and the
datagram fit into the NTB with an unsigned subtraction:
if ((ctx->tx_curr_size - skb->len - reserve) < ctx->max_ndp_size)
return NULL;
Nothing guarantees that skb->len plus the reserve stays below
tx_curr_size, and when it does not the subtraction wraps around to a
huge value, the check passes, and the skb_put_zero() of max_ndp_size
bytes that follows overruns the NTB:
skbuff: skb_over_panic: text:ffff80000db33558 len:428 put:172
head:ffff0000c2c66100 tail:0x1ac end:0x140
kernel BUG at net/core/skbuff.c:200
skb_put_zero include/linux/skbuff.h:2595 [inline]
cdc_ncm_ndp16 drivers/net/usb/cdc_ncm.c:1132 [inline]
cdc_ncm_fill_tx_frame+0xdf0/0x30e0 drivers/net/usb/cdc_ncm.c:1309
Here tx_curr_size is 0x140 = 320, skb->len is already 256 and the
skb_put_zero() wants another 172 bytes.
Two device controlled settings make this reachable:
- dwNtbOutMaxSize = 320 caps tx_max at 320. The lower bound computed
in cdc_ncm_check_tx_max() is max_datagram_size + max_ndp_size + the
NTH header, but cdc_ncm_setup() clamps tx_max before
cdc_ncm_set_dgram_size() runs, so max_datagram_size is still 0 and
the bound is only max_ndp_size + the NTH header. It does not
reserve room for one datagram plus one NDP.
- wNdpOutAlignment = 256 is accepted by cdc_ncm_fix_modulus() as long
as it is smaller than tx_max, and cdc_ncm_align_tail() then pads the
12 byte NTH header up to 256 bytes right before this check.
An NDP can also be added to an NTB that already holds datagrams through
cdc_mbim_tx_fixup(), which uses a different signature per MBIM session.
On plain cdc_ncm the chain lookup in cdc_ncm_ndp16() returns the
existing NDP for the single signature, so there the create path is
normally reached for the first datagram of each NTB.
Rewrite the test as an addition, which cannot underflow and gives the
same answer whenever the original subtraction did not wrap.
Fixes: c78b7c5 ("net: cdc_ncm: refactoring for tx multiplexing")
Fixes: 0fa81b3 ("cdc_ncm: Implement the 32-bit version of NCM Transfer Block")
Reported-by: syzbot+1994e2ecf323ed90f255@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1994e2ecf323ed90f255
Signed-off-by: Jiahao Xu <xujiahao@cmss.chinamobile.com>
Link: https://patch.msgid.link/20261111124156.637661-1-xujiahao@cmss.chinamobile.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Commit e3d95ad ("inet: avoid fastopen lock for regular accept()") made inet_csk_accept() check tfo_listener before taking fastopenq.lock to avoid taking the lock for connections that did not use Fast Open. reqsk_fastopen_remove() clears tfo_listener while holding fastopenq.lock, then reads req->sk. If inet_csk_accept() concurrently observes tfo_listener after it has been cleared, it skips fastopenq.lock and drops the last reference to the request_sock. This can free the request_sock while reqsk_fastopen_remove() is still using it. If the freed memory is reused for a new request_sock with req->sk == NULL, the reset path in reqsk_fastopen_remove() can append the new request_sock to the original listener's list of requests that caused an RST. After the new request_sock is freed, the next append writes through the stale rskq_rst_tail into freed memory. KASAN reported the following use-after-free when writing fastopenq->rskq_rst_tail->dl_next = req: BUG: KASAN: slab-use-after-free in reqsk_fastopen_remove+0x142/0x210 Write of size 8 at addr ffff888108230688 by task swapper/5/0 ... Call Trace: <IRQ> ... reqsk_fastopen_remove+0x142/0x210 tcp_check_req+0x96f/0xdd0 ... tcp_rcv_state_process+0x19c/0x26b0 ... tcp_v4_do_rcv+0x16e/0x490 tcp_v4_rcv+0x14a0/0x1af0 ... ip_protocol_deliver_rcu+0x39/0x1e0 ip_local_deliver_finish+0x124/0x1e0 ip_local_deliver+0xfb/0x1e0 ... </IRQ> To widen the race windows, mdelay(5) was added after newsk = req->sk, mdelay(20) after the if (req) reqsk_put(req) block, and mdelay(100) after tcp_rsk(req)->tfo_listener = false. The KASAN report above was reproduced with this kernel. For the lockless check, use tcp_sk(newsk)->syn_fastopen_child instead of tfo_listener, which reqsk_fastopen_remove() clears. syn_fastopen_child is a field of the Fast Open child TCP socket referenced by newsk, not of the request_sock. It is set before the child socket is added to the accept queue. The paths that call reqsk_fastopen_remove() in response to a remote ACK or RST do not clear this field. inet_csk_accept() uses this field to take fastopenq.lock only for Fast Open child sockets and rechecks tfo_listener while holding the lock. Connections that did not use Fast Open continue to avoid the lock. Fixes: e3d95ad ("inet: avoid fastopen lock for regular accept()") Cc: stable@vger.kernel.org Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/avQKA_YTAThtbsYU@v4bel Signed-off-by: Jakub Kicinski <kuba@kernel.org>
The mentioned commit introduced support for upper protocol selectors (protocol & ports) to mlx5 IPsec offload. In crypto offload mode this causes offloaded TX SAs to stop matching traffic. In tx_add_rule(), setup_fte_upper_proto_match() is called for all offload types and programs a match on the upper protocol (TCP/UDP) and ports. For crypto offload, setup_fte_esp() is then called and sets ip_protocol to ESP. The resulting rule requires both ESP as the IP protocol and TCP/UDP ports, which no packet can satisfy, so TX crypto offload silently stops working for such SAs. In crypto offload mode the stack builds the ESP packet and the HW only encrypts it, so the SA rule should only match on the SPI. Move the setup_fte_upper_proto_match() call under the XFRM_DEV_OFFLOAD_PACKET case, where the rule matches the plaintext packet and upper protocol selectors apply. The other three callers are unaffected: rx_add_rule_sa_selector() is already only invoked for packet offload, and tx_add_policy() / rx_add_policy() are only reachable in packet offload mode, since xfrm policy offload is exclusively of type XFRM_DEV_OFFLOAD_PACKET. Fixes: a738518 ("net/mlx5e: IPsec, support upper protocol selector field offload") Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20261111081337.3129580-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
gntdev_ioctl_map_grant_ref() calls copy_to_user() with priv->lock held. A fault in that copy takes mmap_lock, while gntdev_mmap() is called with mmap_lock held and takes priv->lock, so lockdep reports a circular dependency, and a thread mapping grants can deadlock against another thread of the same process mmapping the same gntdev fd. Read the index under the lock, take an extra reference on the map, and copy after unlocking. If the copy fails, take the map off the list only if an unmap ioctl has not already done so, then drop both references. Fixes: 45ca1af ("xen/gntdev: fix error handling in ioctl") Signed-off-by: Kavi <kavi@edera.dev>
xen_pgd_alloc() keeps the user pgd of a 64-bit PV mm in page->private of the kernel pgd page, and xen_pgd_free() frees it without clearing the pointer. page->private shares its slot with ptdesc->ptl, so when split ptlocks are allocated separately (lock debugging, PREEMPT_RT), pagetable_dtor() hands the freed user pgd to kmem_cache_free() as a ptlock. With SLUB consistency checks this warns "virt_to_cache: Object is not a Slab page!" on every mm teardown; without them it corrupts the slab. Clear page->private once the user pgd is freed. Signed-off-by: Kavi <kavi@edera.dev>
gntdev_ioctl_grant_copy() resets nr_ops and nr_pages on the batch it takes but not writeable, and a batch fresh from kmalloc() holds whatever was in that memory. If the first segment fails before gntdev_grant_copy_seg() sets writeable, gntdev_put_pages() loads the uninitialised bool, which UBSAN reports as an invalid load. No pages are pinned at that point, so nothing is unpinned with the wrong flag. Reset writeable with the counters. Signed-off-by: Kavi <kavi@edera.dev>
Since a6aa4eb ("xen/x86: add extra pages to unpopulated-alloc if available"), a domU built below its maximum hands the rest of its physmap to the unpopulated allocator at boot, so its balloon stays empty until the toolstack first resizes it. balloon_oom_notify() only deflates pages already on the balloon, so a freshly built domU kills a task instead of growing toward its maximum. When the balloon is empty, park one 2 MiB block from the unpopulated allocator on it and deflate that, as dom0's balloon does when it grows. The allocator allocates memory with its lock held, so the OOM path only tries the lock, through a new xen_try_alloc_unpopulated_blocks(). Signed-off-by: Kavi <kavi@edera.dev>
Send each pull request from a branch in this repository to edera-dev/linux-qa, which builds the change's kernels, boots them under Xen and reports back as the linux-qa commit status. Without LXQA_DISPATCH_TOKEN this does nothing.
gcc built with -fcf-protection, the default on Ubuntu and Fedora, starts its nested-function trampolines with endbr64, or endbr32 for 32-bit code. The EMUTRAMP matchers compare the bytes at the faulting address against trampolines that start with a mov, so none of these match and the task is killed with SIGSEGV. Skip a leading endbr before matching. The only relative target, the 32-bit jmp, is computed from the address after it. Signed-off-by: Kavi <kavi@edera.dev>
pcistub_device_release() frees dev_data and clears drvdata before calling xen_pcibk_config_free_dyn_fields() and xen_pcibk_config_free_dev(). Both look the fields up through drvdata, find NULL and return, so every release from pciback leaks the device's config field entries and their data. kmemleak reports them after the device is released. Free the fields first. Fixes: cd9db80 ("xen/pciback: Support pci_reset_function, aka FLR or D3 support.") Signed-off-by: Kavi <kavi@edera.dev>
…per-V The Hyper-V-on-Xen series translates GPADLs, SynIC pages, hypercall arguments and netvsc buffers to the machine (L1-physical) frames the L0 host expects, but hv_balloon was never taught about nested mode. It hands L0 page_to_pfn() ranges straight from dom0's pseudo-physical address space, in balloon responses, free-page reports and hot-add requests, and L0 reads each of those numbers as a Xen machine frame. On a PV dom0 nested on Hyper-V the device autoloads from the VMBus offer, Xen proxies POST_MESSAGE and SIGNAL_EVENT, and the dynamic memory protocol runs end to end. A DM_BALLOON_REQUEST from the host then has L0 reclaim whichever machine frames dom0's PFNs happen to name: Xen's own memory, another domain's, or unrelated dom0 memory, with no error anywhere. A hot-add does the reverse and calls add_memory() on a host range that dom0's physmap does not back, so dom0 oopses on first touch. Translating the ranges would not make this correct either. A PV dom0 does not own the machine memory it runs on, Xen does, and the memory an L1 VM returns to or takes from L0 has to be accounted for in Xen's heap, not handed over behind its back by one of its domains. Dynamic memory for the L1 VM is a job for Xen itself. Refuse the probe when nested on Xen, so the offer stays unbound and dom0 does not speak the protocol at all. Nothing changes when not nested: hyperv_nested_on_xen is a build-time false without CONFIG_XEN_PV. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
…t be bound hyperv_xen_vpci_root_domain() frees the named fwnode when creating the irq domain fails, but not when cpuhp_setup_state() fails afterwards: irq_domain_remove() does not free the fwnode its domain was created with, so that path leaked it. Free it there too. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
MPROTECT is enforced in map_deny_write_exec(), which mmap_region() and mprotect() call, but the brk path never does. do_brk_flags() ORs in VMA_DATA_DEFAULT_FLAGS, which carries VM_EXEC whenever the task's personality has READ_IMPLIES_EXEC, and personality(2) lets any task set that for itself: the ELF loader only clears it at exec. So under MPROTECT, where mmap(PROT_READ|PROT_WRITE) with READ_IMPLIES_EXEC is correctly refused, two syscalls still hand out a fresh writable and executable mapping: personality(READ_IMPLIES_EXEC); brk(cur + len); /* new RWX VMA; it does not merge with the RW heap */ Write code there and jump to it. The same path makes the bss tail of an executable PT_LOAD segment RWX, via vm_brk_flags(..., prot & PROT_EXEC) in the ELF loader, for the binary and its interpreter. Original PaX masked VM_EXEC and VM_MAYEXEC in do_brk() for exactly this reason. Do the same in do_brk_flags() when the mm runs under MPROTECT: strip the execute bits rather than fail, so brk(2) keeps working for such tasks and extensions still merge with the existing heap. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
The trampoline emulator was hooked at the top of do_user_addr_fault(), before the VMA lookup, and openpax_fault_is_trampoline() treats any instruction fetch fault as a candidate. So in every PAGEEXEC+EMUTRAMP task every instruction fetch fault, including each demand-paged, NUMA hinted or userfaultfd fetch of legitimate text, first did up to seven get_user() reads of the faulting code, and if that text happened to match one of the patterns it was emulated instead of being faulted in. PaX only ran the emulator from the bad-area path, for a fault that was otherwise about to kill the task. Move the hook to __bad_area_nosemaphore(), after the user-mode and X86_PF_USER checks and with interrupts enabled, so it runs only for an access the task's mappings do not permit: a fetch from non-executable memory. A fetch from executable memory that merely needs its page brought in is handled as an ordinary fault and never reaches it. A fetch from a non-executable page that is not yet populated now takes two faults, one to bring the page in and one to be emulated, instead of being emulated straight from the first; the result is the same. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
With OPENPAX_EMUTRAMP_DEFAULT the ELF loader sets PAXF_EMUTRAMP on every task. The emulator then lets any task with a write primitive into some readable memory and control of the instruction pointer load chosen values into two registers and jump to a chosen address, from the stack, the heap, .rodata or a noexec-mount file mapping, without any of that memory being executable; a bad target just faults again, so such sequences chain. That weakens PAGEEXEC and MPROTECT for every program on the system to help the few that still use stack or heap trampolines. PaX recommends enabling emulation per binary for this reason. Default the option to n and say so in its help text; the programs that need emulation get it with paxmark -E, through the user.pax.flags xattr. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
Commit 1b82771 ("iommu/dma: Don't reserve PCI windows under a paravirtual IOMMU") skips iova_reserve_pci_windows() for every device the Xen IOMMU driver owns, because the windows a guest sees are invented: pcifront hands out iomem_resource itself and a PVH guest with no host-bridge _CRS gets Linux's catch-all default. That holds for a guest. Dom0 sees the real host bridges, and their windows route to the real BARs of the devices behind them. A PVH dom0 device gets a translated DMA domain, and dma-iommu hands out IOVAs top-down below 4 GiB. The driver reserves only the MSI range, so once the space above it is used, IOVAs land inside the host-bridge window where sibling devices' BARs live. On a root port or switch without ACS a DMA to such an address is decoded as peer-to-peer and delivered to the sibling's BAR: it never reaches the IOMMU, so the transfer is lost and the sibling's registers are written. Xen enables ACS where it can, which redirects such requests upstream, but that is defence in depth, not a reason to skip the reservation. Have xen_iommu_manages_iova() answer false in the initial domain, so dom0 reserves its windows as on bare metal. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
… when modular include/xen/pci.h declares pcifront_machine_sbdf() as a real function whenever CONFIG_XEN_PCIDEV_FRONTEND is defined, which it is for =m as well as =y. XEN_IOMMU is a bool and calls it from built-in code, so XEN_IOMMU=y with XEN_PCIDEV_FRONTEND=m fails to link vmlinux. Declare the function only when pcifront is built in and give built-in callers the -ENODEV stub otherwise. The IOMMU driver with that stub would silently use a pcifront device's guest BDF, which means nothing to Xen, so also keep XEN_IOMMU from being configured with a modular pcifront rather than let it build into a driver that cannot name the devices it manages. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
xen_9pfs_front_ctl() answers a backend Rlerror with -(int)ecode, and the ecode is the backend's to choose. An ecode of 0 came back as 0 and any ecode above INT_MAX came back positive, and the function's contract is "reply length or negative errno", so a caller took either for a good reply of that length. xen_9pfs_front_suspend() then read total and next from beyond the short error reply and computed the chunk length from the bogus "reply length": an ecode of 0xfff00000 had it copy about 1 MiB of uninitialised buffer into a session chunk and later hand it to the backend in Tsession_restore, and 0x80000010 had it memcpy() some 2 GiB past the reply buffer. Take only a plausible errno from an Rlerror, 1..MAX_ERRNO, and answer anything else with -EPROTO, so a control request can only ever return a negative errno or a reply that carries the id and body it asked for. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
The Connected handler replays the fids saved at suspend from xenwatch, after do_suspend() has returned and processes run again. It checked priv->client once and then read priv->client->msize for every chunk, each of which waits up to 5 s on the backend. Meanwhile a umount or a fresh mount blocked on the still-disconnected frontend can be killed: p9_client_destroy() then runs p9_xen_close(), which clears priv->client with no lock the replay holds, and frees the client. The next chunk dereferences NULL, or the freed client, and xenwatch oopses, which stops all xenbus processing for the guest. Record the owning client and its msize when the session is saved, with userspace frozen and the client known to be alive, and have the replay use those. It compares priv->client with the owner by address only, before starting and before each chunk, and gives up if they differ: a client destroyed in between does not want its fids back, and nothing is dereferenced that could have gone away. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
xen_9pfs_front_suspend() freed the session saved by the previous suspend first thing, before checking whether the frontend is connected. A guest suspended again before the backend had reconnected it, which is what happens when a restore is retried or a saved domain is forked more than once, thus lost the fids it was carrying, and the eventual restore reset the session instead of replaying them. Only free the old session once there is a connected client whose fids replace it. A frontend the backend has not reconnected since the last suspend has nothing newer to save, and the Connected handler frees the session once it has been replayed, so what is kept is never stale. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
… page's xen_9pfs_front_free_rings() took the data pages' ring_order and grant refs from the intf page, which is shared with the backend and writable by it. Upstream only freed rings from remove(), with the backend gone; since the frontend reconnects after a restore it also frees them from xen_9pfs_front_disconnect() on every resume, while a backend that still serves the old rings may be running. A backend that rewrote ref[] had the frontend end foreign access on grant refs that belong to other devices, and one that rewrote ring_order had it walk past the array or free the wrong number of pages. Keep the refs in the ring as they are granted and use those, with the order the frontend chose, to tear the ring down. Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
xen_9pfs_front_ctl() stores the reply buffer and its capacity, then sets ctl_pending with a plain WRITE_ONCE(), and the response worker tests the flag with READ_ONCE() before copying into the buffer. Nothing orders the two, so on a weakly ordered machine the worker can see ctl_pending set while ctl_reply still names the previous call's buffer, a stack array or kvmalloc()ed memory that has been freed, and copy the reply into that. Publish the buffer with smp_store_release() and test the flag with smp_load_acquire(). Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
edera-rebase-app
Bot
requested review from
antoineco,
azenla,
bleggett,
kaniini,
sveith and
tycho
as code owners
November 16, 2026 04:59
commented
Nov 17, 2026
Author
|
Superseded by #115. |
edera-rebase-app
Bot
deleted the
rebase/edera-mainline/20261116-7ad1695c933c-aebb72744764
branch
November 17, 2026 07:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nightly rebase of
edera/mainline(7ad1695c933c) ontomaster(aebb72744764), driven by Claude. Not pushed automatically because the checker found drift. Run log.Important
Do not use the merge button: this branch replaces
edera/mainlinerather than merging into it. Approve the pull request to land it; the land workflow force-pushesedera/mainlineto the approved head, pinned to7ad1695c933c, and keeps a backup.Independent checks
Builds: success (x86_64 vmlinux on the Edera host config and arm64 vmlinux, both with the Edera features built in; per-build results in the run).
7ad1695c933c869894ed802f864c07de0c7daebb72744764Commits whose hunk context moved (own +/- lines identical)
ea62ac9f1b0f iommu/xen: Add Xen PV-IOMMU driver→a20af3d54049d8221bf28f22 x86/CPU/AMD: avoid printing reset reasons on Xen domU→fd39cf398901bd1c0dba57c3 sysctl: wire up PaX softmode setting→925eb0f90e07849ed61740ea use maximum supported mmap rnd entropy by default→c0f584052b2a5b1ff5bbc8cb 9p/xen: carry the 9P session across a restore→4e9d6c73e8d985e1da02b838 9p/xen: end foreign access on the grant refs we granted, not the intf page's→61c7017e0f57Commits lost, added, or whose own +/- lines changed
f492e4d0cb26 9p/xen: reconnect to the backend on resumeadcc9f630c88 9p/xen: reconnect to the backend on resume3f7ca89e3d70 xen/gntdev: don't copy to user space under priv->lock (#79)e07250c5de2e xen/gntdev: don't copy to user space under priv->lock (#79)Drift (changed lines: upstream delta vs. actual change)
Claude's report
Claude left no report (rebase step: success).