Skip to content

Rebase edera/mainline onto master @ f66469d9905b - #93

Closed
edera-rebase-app[bot] wants to merge 10000 commits into
edera/mainlinefrom
rebase/edera-mainline/20261106-a85e73be200d-f66469d9905b
Closed

edera-rebase-app[bot] wants to merge 10000 commits into
edera/mainlinefrom
rebase/edera-mainline/20261106-a85e73be200d-f66469d9905b

Conversation

@edera-rebase-app

Copy link
Copy Markdown

Nightly rebase of edera/mainline (a85e73be200d) onto master (f66469d9905b), driven by Claude. Not pushed automatically because the checker found drift and Claude's report asks for a decision. Run log.

Important

Do not use the merge button: this branch replaces edera/mainline rather than merging into it. Approve the pull request to land it; the land workflow force-pushes edera/mainline to the approved head, pinned to a85e73be200d, 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).

Old tip a85e73be200d
New tip 507313410801
Old upstream base 864c07de0c7d
New upstream base f66469d9905b
  • New branch is based on the upstream tip.
  • Downstream series is linear.
  • Downstream commit set changed: 114 before, 114 after; 1 commit(s) lost, added, or with different +/- lines.
  • Downstream drift: the tree changed by more than the upstream delta.
Commits whose hunk context moved (own +/- lines identical)
  • ea62ac9f1b0f iommu/xen: Add Xen PV-IOMMU driver → 9b8b760273e0
  • bd1c0dba57c3 sysctl: wire up PaX softmode setting → 179f09220c93
  • 849ed61740ea use maximum supported mmap rnd entropy by default → bd8e593f9e27
  • 5b1ff5bbc8cb 9p/xen: carry the 9P session across a restore → 938695f7423d
Commits lost, added, or whose own +/- lines changed
Before After
f492e4d0cb26 9p/xen: reconnect to the backend on resume 3ae732cbf631 9p/xen: reconnect to the backend on resume
Drift (changed lines: upstream delta vs. actual change)
--- upstream-lines
+++ actual-lines
@@ -856127,6 +856127,18 @@
 +	return ret;
 +}
 +
++#ifdef CONFIG_OPENPAX_SOFTMODE
++static const struct ctl_table pax_table[] = {
++	{
++		.procname       = "softmode",
++		.data           = &pax_softmode,
++		.maxlen         = sizeof(int),
++		.mode           = 0600,
++		.proc_handler   = proc_dointvec,
++	},
++};
++#endif
++
 +static const struct ctl_table sysctl_subsys_table[] = {
 +	{
 +		.procname	= "sysctl_writes_strict",
@@ -856174,6 +856186,9 @@
 +int __init sysctl_init_bases(void)
 +{
 +	register_sysctl_init("kernel", sysctl_subsys_table);
++#ifdef CONFIG_OPENPAX_SOFTMODE
++	register_sysctl_init("kernel/pax", pax_table);
++#endif
 +
 +	return 0;
 +}
@@ -856207,6 +856222,18 @@
 -	mutex_unlock(&static_key_mutex);
 -	return ret;
 +	return -ENOSYS;
+-#ifdef CONFIG_OPENPAX_SOFTMODE
+-static const struct ctl_table pax_table[] = {
+-	{
+-		.procname       = "softmode",
+-		.data           = &pax_softmode,
+-		.maxlen         = sizeof(int),
+-		.mode           = 0600,
+-		.proc_handler   = proc_dointvec,
+-	},
+-};
+-#endif
+-
 -static const struct ctl_table sysctl_subsys_table[] = {
 -#ifdef CONFIG_SYSCTL
 -	{
@@ -856256,6 +856283,9 @@
 -int __init sysctl_init_bases(void)
 -{
 -	register_sysctl_init("kernel", sysctl_subsys_table);
+-#ifdef CONFIG_OPENPAX_SOFTMODE
+-	register_sysctl_init("kernel/pax", pax_table);
+-#endif
 -
 -	return 0;
 -}
@@ -890611,64 +890641,15 @@
 +
 +			if (req)
 +				p9_req_put(priv->client, req);
--	if (priv->rings) {
--		for (i = 0; i < XEN_9PFS_NUM_RINGS; i++) {
--			struct xen_9pfs_dataring *ring = &priv->rings[i];
-+	for (i = 0; i < XEN_9PFS_NUM_RINGS; i++) {
-+		struct xen_9pfs_dataring *ring = &priv->rings[i];
--			cancel_work_sync(&ring->work);
-+		if (!ring->intf)
-+			break;
-+		if (ring->irq >= 0) {
-+			unbind_from_irqhandler(ring->irq, ring);
-+			ring->irq = -1;
-+		}
+-		cancel_work_sync(&ring->work);
+-
 +		cancel_work_sync(&ring->work);
--			if (!ring->intf)
--				break;
--			if (ring->irq >= 0) {
--				unbind_from_irqhandler(ring->irq, ring);
--				ring->irq = -1;
--			}
--			if (ring->data.in) {
--				for (j = 0; j < (1 << ring->intf->ring_order);
--				     j++) {
--					grant_ref_t ref;
--
--					ref = ring->intf->ref[j];
--					gnttab_end_foreign_access(ref, NULL);
--					ring->intf->ref[j] = INVALID_GRANT_REF;
--				}
--				free_pages_exact(ring->data.in,
--						 1UL << (ring->intf->ring_order +
--							 XEN_PAGE_SHIFT));
--				ring->data.in = NULL;
--				ring->data.out = NULL;
--			}
--			if (ring->ref != INVALID_GRANT_REF) {
--				gnttab_end_foreign_access(ring->ref, NULL);
--				ring->ref = INVALID_GRANT_REF;
-+		if (ring->data.in) {
-+			for (j = 0; j < (1 << ring->intf->ring_order); j++) {
-+				grant_ref_t ref;
-+
-+				ref = ring->intf->ref[j];
-+				gnttab_end_foreign_access(ref, NULL);
-+				ring->intf->ref[j] = INVALID_GRANT_REF;
--			free_page((unsigned long)ring->intf);
--			ring->intf = NULL;
-+			free_pages_exact(ring->data.in,
-+					 1UL << (ring->intf->ring_order +
-+						 XEN_PAGE_SHIFT));
-+			ring->data.in = NULL;
-+			ring->data.out = NULL;
++
+-	if (priv->rings) {
+-		xen_9pfs_front_free_rings(priv);
 -		kfree(priv->rings);
-+		if (ring->ref != INVALID_GRANT_REF) {
-+			gnttab_end_foreign_access(ring->ref, NULL);
-+			ring->ref = INVALID_GRANT_REF;
-+		}
-+		free_page((unsigned long)ring->intf);
-+		ring->intf = NULL;
+-	}
++	xen_9pfs_front_free_rings(priv);
 -	priv->rings = kzalloc_objs(*priv->rings, XEN_9PFS_NUM_RINGS);
 -	if (!priv->rings) {
 -		kfree(priv);

Claude's report

Summary

Rebased edera/mainline (a85e73be200d) onto upstream f66469d9905b (v7.2-rc5-41938-gf66469d9905b). The old merge base was 864c07de0c7d (v7.2-rc5-26646-g864c07de0c7d), so the upstream range is 14461 non-merge commits. All 114 downstream commits were replayed onto rebase-result (tip 507313410801). None were dropped, squashed, reordered or reworded, and nothing was added. Four commits conflicted and I resolved each one by hand (details below). Both x86_64 and arm64 vmlinux build. I expect verify-upstream-rebase.sh to fail, because the resolutions show up as drift. It reports one commit whose own +/- lines changed (9p/xen: reconnect to the backend on resume) and drift in kernel/sysctl.c and net/9p/trans_xen.c. Each of these comes from a resolution listed under "Conflicts resolved". The arch/Kconfig resolution produces no drift.

Needs a decision

  • UNSURE: upstream 228e21764b38 ("Drivers: hv: Run VMBus kexec cleanup from syscore shutdown") changes what kexec does on the Hyper-V-nested-on-Xen path, although the replay touched none of the same lines.
    • Before: the VMBus kexec cleanup (hv_kexec_handler) ran only through hv_machine_shutdown, which is installed only for X86_HYPER_MS_HYPERV. It therefore never ran in a nested-on-Xen PV dom0.
    • Now: hv_vmbus_syscore is registered in vmbus_bus_init() (drivers/hv/vmbus_drv.c:3041) on every path, nested-on-Xen included. On kexec it now runs vmbus_initiate_unload() and the SynIC cpuhp teardown there.
    • What is not torn down: the downstream Xen VIRQ bridge (arch/x86/xen/hyperv.c, hyperv_remove_xen_vmbus_irq()) and the hypercall/GUEST_OS_ID state.
    • Reading 1: this is an improvement. The unload reply still arrives over the bridge, which stays bound, and leaving the bridge in place matches the native path, which also keeps its handler on kexec.
    • Reading 2: the nested path should also tear down the Xen bridge on kexec, which would need a downstream follow-up.
    • What I committed: nothing. The upstream behaviour is kept as is, and nested-on-Xen kexec has not been tested.

Conflicts resolved

  • sysctl: wire up PaX softmode setting, kernel/sysctl.c, colliding with upstream 443bea2f71c5 ("sysctl: consolidate CONFIG_SYSCTL into a single block in kernel/sysctl.c").
    • Upstream moved sysctl_subsys_table[] and sysctl_init_bases() into the single #ifdef CONFIG_SYSCTL block and dropped the inner #ifdef CONFIG_SYSCTL.
    • I kept upstream's layout and re-applied the downstream change at the new location: the #ifdef CONFIG_OPENPAX_SOFTMODE pax_table[] just before sysctl_subsys_table[], and the register_sysctl_init("kernel/pax", pax_table) call in sysctl_init_bases(). The added lines are byte-identical.
    • Drift: the same 15 lines appear at a different place in the file.
  • use maximum supported mmap rnd entropy by default, arch/Kconfig, colliding with upstream 8cdae75cebe0 ("arch/Kconfig: fix dead conditions by removing dead options").
    • Upstream removed ARCH_MMAP_RND_BITS_DEFAULT and ARCH_MMAP_RND_COMPAT_BITS_DEFAULT and their default X if X lines. Those options were dead because an int symbol is always false as a condition. Nothing else in the tree defines or uses them.
    • I kept the removal and applied only the downstream change: default ARCH_MMAP_RND_BITS_MIN becomes ..._MAX, for both the native and compat symbols. The commit's own +/- lines are unchanged.
  • 9p/xen: reconnect to the backend on resume, net/9p/trans_xen.c, colliding with upstream b3d07d64832c ("9p/xen: Use array for data rings") and 7b6f2e3c29fb ("9p/xen: drain response work after unbinding IRQ", Fixes: + Cc: stable).
    • Ring storage: upstream replaced the kzalloc'd priv->rings pointer with the fixed array rings[XEN_9PFS_NUM_RINGS]. The downstream commit only carried the pointer along and does not need it, because it rebuilds the rings in place. I kept the array. That means no kzalloc_objs/kfree(priv->rings) and no if (priv->rings) guard: xen_9pfs_front_free() now just calls xen_9pfs_front_free_rings().
    • Teardown order (upstream fix): in the new xen_9pfs_front_free_rings() I kept the fix's order: if (!ring->intf) break;, then unbind_from_irqhandler(), then cancel_work_sync(). The downstream commit had moved the old order (cancel first) into that function.
    • I added ring_order, rings_sem and connected to the struct, plus priv->ring_order/init_rwsem() in xen_9pfs_front_init(), exactly as the downstream commit had them.
    • This is the one commit the checker lists with changed own +/- lines: it no longer removes or adds the pointer-guarded free and allocation, and its cancel_work_sync() sits after the unbind.
  • 9p/xen: carry the 9P session across a restore, net/9p/trans_xen.c, colliding with upstream 9b4cf60c6b73 ("9p/xen: validate the response size from the backend", Fixes: + Cc: stable) and again with b3d07d64832c.
    • Size check vs control-reply intercept: in p9_xen_response(), upstream's h.size range check and downstream's P9_NOTAG control-reply intercept were inserted at the same spot. I put the upstream check first, because the intercept also advances cons by the backend-supplied h.size, so it must be covered by the fix.
    • Effect on a malformed control reply: one with h.size < sizeof(h), or larger than what was queued, now hits the break instead of being consumed. xen_9pfs_front_ctl() then fails through its existing wait_for_completion_timeout() instead of hanging.
    • Array storage, as above: I added only INIT_LIST_HEAD(&priv->session)/init_completion(&priv->ctl_done) to init, with no ring allocation. xen_9pfs_front_free() calls xen_9pfs_front_free_rings() and then the new xen_9pfs_front_session_free().
    • ring == priv->rings and XEN_9PFS_RING_SIZE(priv->rings) still mean ring 0, because the array decays to &rings[0].
    • The commit's own +/- lines are unchanged; only its context moved.

Dropped downstream commits

None.

Build fixes

None.

Upstream commits that meet the series

The upstream fixes in these files survive intact in the final tree:

  • 9p/xen: 4d183e6f1532, 7b6f2e3c29fb and 9b4cf60c6b73.
  • 9p: 241d46901226 (net/9p/client.c:490), 2acd800de882 (fs/9p/v9fs.c:637) and 7fb9bd365905 (fs/9p/v9fs.c:420).
  • 0f4a9e682f7f in fs/xattr.c:335.
  • 51e766bcd35e and b82ed0e3a1da in init/main.c.
  • 1c8f6308e557 in drivers/iommu/dma-iommu.c.
  • ef694e2d2101 in fork.
  • The mm VMA-flag fixes.

No symbol that upstream removed or renamed is used or brought back downstream: VM_SPECIAL, VMA_SPECIAL_FLAGS, is_vm_hugetlb_page, hugetlb_inline.h, file_doesnt_need_get, hv_setup_kexec_handler/hv_remove_kexec_handler, hv_call_deposit_pages, dma_opt_mapping_size, kho_scratch, ARCH_MMAP_RND_*_DEFAULT.

  • 9p/xen (net/9p/trans_xen.c):
    • 4d183e6f1532 9p/xen: fix refcount leak in p9_xen_response() on wrong tag: fix. p9_req_put() on a wrong tag is intact.
    • 7b6f2e3c29fb 9p/xen: drain response work after unbinding IRQ: fix. Kept in xen_9pfs_front_free_rings(), which also covers the downstream resume/disconnect path, because that path frees through the same function.
    • 9b4cf60c6b73 9p/xen: validate the response size from the backend: fix. Intact, and it now also guards the downstream control-reply intercept (see Conflicts).
    • b3d07d64832c 9p/xen: Use array for data rings: kept (see Conflicts).
  • 9p, other files:
    • 241d46901226 9p: reject RERROR/RLERROR with zero errcode: fix, intact. The downstream shared-client code does not rely on errcode 0.
    • 2acd800de882 9p: fix caches_show() out-of-bounds write: fix, intact.
    • 7fb9bd365905 9p: fix privport option setting wrong RDMA field: fix, intact.
    • 9eb9b583ea35 9p: remove duplicated assignment in v9fs_fill_super(): no interaction.
    • 8bb0279930cc 9p: skip intermediate directory entry name copy in p9dirent_read(): no interaction.
    • 33625427a382 net/9p: add vsock transport: no interaction. vsock is not a shared-client transport, and the new trans_opts member does not overlap the downstream fields in include/net/9p/client.h.
    • 5852cdf0006f net/9p: fix typos in comments: no interaction.
  • xattr:
    • 0f4a9e682f7f xattr: always invoke cap_convert_nscap() for security.capability writes: fix, intact. The downstream PaX xattr read path is separate.
  • sysctl:
    • 443bea2f71c5 sysctl: consolidate CONFIG_SYSCTL into a single block in kernel/sysctl.c: conflict, resolved above.
    • acd19f2c56f2, 242bac52294e, d08ab285b096, 2bfbb09b505c: sysctl internals. No interaction; the downstream pax_table uses plain proc_dointvec.
  • arch/Kconfig:
    • 8cdae75cebe0 arch/Kconfig: fix dead conditions by removing dead options: conflict, resolved above.
    • 35e340a47888 mm: userland pgtable freeing is RCU-safe now, remove leftover bits: no interaction.
    • 2e83e2ce34ff arch, mm: promote DEBUG_WX to CHECK_WX: no interaction. OpenPaX does not reference DEBUG_WX.
    • 28d5df7b7274, 537ec2b15fdd, 681f3b68f435: KVM Kconfig/docs. No interaction.
  • mm, where OpenPaX meets it (mm_types.h, mm/mmap.c, mm/util.c, mm/vma.h, mm/vma_internal.h, tools/testing/vma):
    • Fixes 4c2dec1dce36, c386d799f423, 13fc99f46399, 8146c6478224, ef694e2d2101, 68cb098eadda, 7135a05838e8: intact. OpenPaX keeps pax_flags as a separate unsigned long in mm_struct, so the atomic VMA-flag fixes do not apply to it. ef694e2d2101 now copies pax_flags/brk under the parent's mmap_lock.
    • dc0b17144d62, 14a5c975b138, 38564710f443, 6a9ef02c60bf, 72a993449cb0, 44debd840ec9, c911e7ebebf5, 94c86564538e, 88d77002e1a1, 9201d0f5b9d5, 7fdbc26b69c0, b7b4d8f37a4f, 4852f3421456, 86a779c53204, f85eb0656c40, c2d4ccfbba3f, e59c9a971a9f, 4b019e056f6c, 47e725702b0b, 69d38c792c53, 5728d3523f12: no interaction.
    • 9cae38dc11da mm: consistently validate VMA state after mmap[_prepare] hooks: no interaction. The downstream MPROTECT gate in map_deny_write_exec() still runs at the start of mmap_region() and in mprotect.
    • 47e725702b0b mm: make per-VMA locks available universally: no interaction. The EMUTRAMP hook in arch/x86/mm/fault.c sits before lock_vma_under_rcu.
  • init and kernel-parameters.txt:
    • Fixes 51e766bcd35e init/main: fix false-positive kernel panic on environment variable overwrite and b82ed0e3a1da init/main: fix off-by-one in argv_init cleanup: intact.
    • 278b2abf660a, aabe6e1b36ce, 677f83795fdf, 958c01049e0a: no interaction. pax_softmode= is a __setup, not an early param.
    • f000a06da2a5, 084100a1b579, 10823ced2f18, 8ebd2eb87f50, 264d8fd2794f, abaa0835b4f3: doc text near the pax_softmode= entry only.
  • IOMMU/DMA:
    • 1c8f6308e557 iommu/dma: Catch scatterlist length overflows: fix, intact. The downstream edit is only in iova_reserve_iommu_regions.
    • fdd81f15fc43 iommu/dma: Clean up redundant MSI cookie check: no interaction. The Xen PV-IOMMU uses no MSI cookie.
    • 1ae140d0f272 iommu: Make iommu-dma helpers private: no interaction; xen-iommu.c uses neither moved helper. Cosmetic side effect: this commit and downstream iommu/dma: Don't reserve PCI windows under a paravirtual IOMMU both add #include "iommu-priv.h" to drivers/iommu/dma-iommu.c, so it is now included twice (lines 33 and 42). This is harmless (include guard); I left it, because removing it would be a downstream edit.
    • 0bf031ba8c49, 42eed9bb9ca4, 641a9b9cc697, 95d2fec40c48: no interaction.
  • Xen grant table:
    • 6eecb67b69af xen/grant-table: stop setting PG_private on pages for grant mapping: no interaction. Downstream gnttab_alloc_pages_node() goes through the upstream helper, and nothing downstream sets or tests PG_private.
    • bbe5d3b3d402: comments only.
  • Hyper-V:
    • 228e21764b38 Drivers: hv: Run VMBus kexec cleanup from syscore shutdown: fix. It now reaches the nested-on-Xen path; see Needs a decision.
    • 2690d4156b51 iommu/hyperv: Add para-virtualized IOMMU support for Hyper-V guest: no interaction today. hv_iommu_init is wired up only in hyperv_init(), not in hyperv_init_nested_on_xen(). Latent: it gates on hv_is_hyperv_initialized(), which downstream makes true for nested-on-Xen.
    • 118bdac10546 Drivers: hv: Add logical device ID registry for vPCI devices: works with the nested path; hv_common_init() is called there.
    • 56fb075b77f8, dd57772e36f7, d0ec95a8a4e7: no interaction.
  • Not shared files: 799203afd298 and e3e7a85730a4 turned up only because they touch kernel-parameters.txt. No interaction.

Builds

Separately, not caused by this rebase: drivers/hv/vmbus_drv.c:1548,3069 call hyperv_remove_xen_vmbus_irq(). That function is declared only in arch/x86/include/asm/mshyperv.h. include/asm-generic/mshyperv.h defines hyperv_nested_on_xen as false but has no prototype or stub for the function, so an arm64 build with CONFIG_HYPERV would probably fail with an implicit declaration. arm64 defconfig does not enable CONFIG_HYPERV, so neither build exercises this. The same code is on the old tip.

Bart Van Assche and others added 30 commits November 3, 2026 09:57
If netdev_alloc_skb() fails, mctp_i3c_read() jumps to a label that
unlocks mi->lock although that mutex has not been locked yet. Fix this
by returning -ENOMEM directly. This bug has been detected by the Clang
thread-safety analyzer.

Cc: Leo Yang <Leo-Yang@quantatw.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: netdev@vger.kernel.org
Fixes: 2d2d4f6 ("mctp i3c: fix MCTP I3C driver multi-thread issue")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Matt Johnston <matt@codeconstruct.com.au>
Link: https://patch.msgid.link/71e0a880ffe7a83237e501b07884bf54343e76ca.1793296780.git.bvanassche@acm.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
fbnic reports queue 0 to XDP on all RX queues. The XDP RX queue is
registered with the header buffer queue index, which is always 0,
instead of the completion queue index, which is the netdev queue id.

Any XDP program that reads rx_queue_index gets 0 on every queue, so a
program that uses the queue id uses the wrong queue. AF_XDP has the
same problem: XSKMAP finds the wrong socket, and redirect to a socket
on another queue fails.

Triggered on fbnic hardware (50G, firmware 25.08.05-004) with AF_XDP
zero-copy: sockets on queues other than 0 got no packets. With this
fix, a socket on queue 43, and sockets on four queues at once, get
their packets. On the QEMU model with two queues, a kprobe shows 0 and
0 before the fix, and 0 and 1 after it.

Fixes: 894d4a4 ("eth: fbnic: move xdp_rxq_info_reg() to resource alloc")
Signed-off-by: Björn Töpel <bjorn@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261030141452.1173282-1-bjorn@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
reuseport_select_sock() and reuseport_migrate_sock() read
reuse->num_socks and reuse->socks[] locklessly under RCU, while
writers holding reuseport_lock can change them.

Readers snapshot num_socks once, then index socks[] with it.
Meanwhile, writers can perform several operations, storing into
slots below the reader's stale count:

- __reuseport_detach_sock() moves the last socket into slot i.
- __reuseport_add_sock() then writes the new socket at the
  (now smaller) num_socks index.
- reuseport_stop_listen_sock() calls __reuseport_detach_sock()
  then __reuseport_add_closed_sock(), which writes slot
  max_socks - num_closed_socks - 1. This can be the slot a reader
  still considers part of the listener region when the array is full.
- __reuseport_detach_closed_sock() can then rewrite that slot.

All pointers stored in socks[] remain valid for the RCU grace period,
but without annotations the compiler is allowed to tear or reload
these accesses. For instance, reuseport_select_sock_by_hash() could
reload reuse->socks[i] between the sk_state/sk_incoming_cpu checks
and the return, returning a socket that did not pass them.

Use WRITE_ONCE() for all socks[] stores done while the array is
visible to readers, and for num_socks updates (readers already use
READ_ONCE()). Use READ_ONCE() in the two lockless readers.

Fixes: ef45614 ("soreuseport: define reuseport groups")
Link: https://lore.kernel.org/netdev/20260902071900.395567-1-ruanjinjie@huawei.com/
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20261030120956.3026324-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
qfq_change_class() snapshots the current aggregate settings while
holding the qdisc tree lock, but drops the lock before selecting the
destination aggregate. During that gap, qfq_enqueue() can move the
class to an aggregate matching the requested settings.

When qfq_change_class() resumes, qfq_find_agg() then returns cl->agg.
If it is a singleton, qfq_deact_rm_from_agg() frees the aggregate
before qfq_add_to_agg() immediately accesses the same pointer, causing
a use-after-free.

While holding the tree lock, skip the replacement when the destination
is already the current aggregate. Any estimator replacement has already
completed, so the class change can finish normally.

Fixes: 462dbc9 ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
Link: https://lore.kernel.org/netdev/20260731140533.566493-1-david.lee@trailofbits.com/
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Co-developed-by: David Lee <david.lee@trailofbits.com>
Signed-off-by: David Lee <david.lee@trailofbits.com>
Link: https://patch.msgid.link/20261029180957.43015-1-david.lee@trailofbits.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
The misaligned I/O fallback copies the full bounce scatterlist to the
request buffer during completion.  If a data-in command transfers less
than requested, part of a newly allocated bounce page can remain unwritten.

Allocate bounce pages with __GFP_ZERO so all bytes copied during completion
have a defined value.  This path is already the slow fallback for
misaligned I/O, so the added initialization cost is acceptable.

Found during an LLM-assisted source audit and validated with a QEMU/KVM
vhost-scsi target using misaligned data-in commands.

Fixes: 5ced58b ("vhost-scsi: Fix alignment handling with windows")
Cc: stable@vger.kernel.org
Assisted-by: LLM (OpenAI Codex, gpt-5.6-sol)
Signed-off-by: Shubham Antil <shubham@octane.security>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261020105503.75904-1-shubham@octane.security>
vhost_add_used_n_in_order() advances start by nheads[i] but wraps it
with a single subtraction.  If start + nheads[i] >= 2 * vq->num, start
can remain outside the ring.

With used-ring logging enabled, start > vq->num makes (vq->num - start)
underflow.  log_write() then sets bits beyond the dirty-log bitmap,
potentially corrupting adjacent userspace memory.  This is reachable on
the vhost-net TX path with VIRTIO_F_IN_ORDER: done_idx can reach
VHOST_NET_BATCH (64), triggering the issue with a 32-entry ring.

Wrap start with a mask to keep it within the ring.  VHOST_SET_VRING_NUM
enforces a nonzero power-of-two ring size, allowing start to be wrapped
using & (vq->num - 1).

Fixes: 67a873d ("vhost: basic in order support")
Cc: stable@vger.kernel.org
Reviewed-by: Weibin Liu <liuwb@xiaopeng.com>
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261020232956.99970-1-fangxy@xiaopeng.com>
viommu_probe() marks the device DRIVER_OK before populating the event
virtqueue and registering the IOMMU device in sysfs.  viommu_fill_evtq()
hands the device a set of device-writable buffers through
virtqueue_add_inbuf(), so from that point on the device may write into
them and into the rings.

If either step fails, the error path deletes the virtqueues without
resetting the device first.  The event buffers are allocated with
devm_kmalloc_array() and are released as probe unwinds, so the device can
go on writing to memory that has been freed.

Reset the device before deleting the virtqueues, the way viommu_remove()
already does.

Fixes: edcd69a ("iommu: Add virtio-iommu driver")
Cc: stable@vger.kernel.org
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261004182218.177343-1-oss.patchbox@gmail.com>
snet_send_ctrl_msg() reads the error code the DPU reports when it ACKs
a control message, but then overwrites it with the return value of
snet_wait_for_dpu_completion(). As a result, a DESTROY, SUSPEND or
RESUME that the DPU rejects is reported to the caller as a success as
long as the DPU clears the opcode register in time.

For SUSPEND this means vhost-vdpa marks the device as suspended and
lets userspace reprogram the vrings while the DPU is still running
them; for DESTROY, snet_reset_dev() never even sees that the device
failed to stop.

Return the error from the saved ACK value once the completion wait
itself has succeeded.

Fixes: 3f3a167 ("vdpa/snet: support getting and setting VQ state")
Cc: stable@vger.kernel.org
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261005044915.264532-1-oss.patchbox@gmail.com>
vhost_scsi_handle_vq() moves pi_bytesout or pi_bytesin into the
protection sgl and subtracts those bytes from exp_data_len.  The length
passed to TCM is still exp_data_len + prot_bytes.

prot_bytes comes from virtio_scsi_cmd_req_pi.  With
VIRTIO_SCSI_F_T10_PI negotiated, vhost reads that header and does not
check that the CDB is a READ or WRITE.  sbc_check_prot() replaces
data_length from the CDB only when the protect field is non-zero.
target_cmd_size_check() leaves a write's data_length unchanged when the
CDB size is smaller, so a command that does not get that replacement
keeps a data_length larger than the data sgl.

The KASAN report is a MODE SELECT whose header had pi_bytesout set.
The data sgl held only the parameter list.  spc_emulate_modeselect()
walked data_length and read the next physical page.

Pass the data sgl length.  Protected READ and WRITE still take their
length from the CDB in sbc_check_prot().

KASAN reports:

  BUG: KASAN: use-after-free in spc_emulate_modeselect+0x145/0x380 [target_core_mod]
  Read of size 1

  spc_emulate_modeselect
  __target_execute_cmd
  target_execute_cmd
  vhost_scsi_write_pending
  transport_generic_new_cmd
  __target_submit
  target_queued_submit_work
  process_one_work
  worker_thread
  kthread
  ret_from_fork
  ret_from_fork_asm

Fixes: 9f977ef ("vhost-scsi: Include prot_bytes into expected data transfer length")
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261012103954.136698-1-physicalmtea@gmail.com>
syzbot reported a memory leak of the received skb (and its sec_path
extension) in the IP-TFS receive path.

__input_process_payload() parses the inner packets of an IP-TFS payload
and queues them on @sublist, which is only sent after the parsing loop.
Three error paths inside the loop (skb_copy_seq_read() failure, invalid
inner IPv4 header length, unknown IP version) jump to the "done" label,
which is placed after the code sending @sublist.

Any skb already queued on @sublist is then neither delivered nor freed.
This includes skbs added by iptfs_reassem_cont() before the call, newly
allocated inner packets, and, since the received skb can be reused for
the first inner packet, the received skb itself.

Move the "done" label before the trim/send code, so that inner packets
parsed before the error are delivered as on the normal exit path. The
received skb is then still freed (or consumed) as before when it was
not reused.

Fixes: 6c82d24 ("xfrm: iptfs: add basic receive packet (tunnel egress) handling")
Reported-by: syzbot+a3f21220cbbb6e14ee2e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6ae4102e.9c6421ad.36baac.0005.GAE@google.com/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Link: https://patch.msgid.link/20261030083358.2653599-1-edumazet@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
"LLM-driven-developers" are not including the info about discovery
method we want to see in commit messages. Try to add more forceful
language to make agents ask for it. claude and codex seem to load
maintainer-netdev.rst already.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20261029153459.2257998-1-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
…kernel/git/bluetooth/bluetooth

Luiz Augusto von Dentz says:

====================
bluetooth pull request for net:

Core:

 - hci_core: Initialize IRK before publication
 - hci_core: Initialize link key before publication
 - hci_core: Initialize LTK before publication
 - hci_core: Fix queuing rx_work while workqueue is drained
 - hci_core: Keep link-key filtering inside RCU
 - hci_core: Initialize advertising RPA work only once
 - hci_sync: Fix invalid Supervision_Timeout in LE Set Default Rate
 - hci_sync: re-enable legacy advertising on resume
 - hci_sync: pause advertising for the scan address update
 - hci_sync: Update the CIS host feature when enabling LE
 - hci_sync: Copy the LE accept list under hdev->lock
 - hci_sync: Protect resolving-list lookups
 - hci_sync: Copy the resolving-list IRK under RCU
 - hci_event: Clear explicit connect state on LE connection
 - L2CAP: Hold incoming data until encryption key size is known
 - L2CAP: Ignore connection responses with wrong ident
 - SMP: Protect link keys during LTK derivation
 - SMP: Protect LTK encryption with RCU
 - MGMT: Return RFKILLED for Set Powered on a blocked controller
 - MGMT: Clear disabled connection parameters when loading none
 - MGMT: Fix discovery stuck after a failed Stop Discovery
 - validate retained LE Create CIS command length
 - validate retained LE Set CIG Parameters command length

Drivers:

 - btintel: fix buffer over-read in fw payload
 - btmtk: drop zero-length ISO packets from endpoint padding
 - btmtk: bound the ISO payload length by the controller's MTU
 - btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD
 - btmtk: fix error handling in btmtk_usb_isointf_init()
 - qca: Fix the WCN3950 NVM baud rate offset

* tag 'for-net-2026-11-02' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: (30 commits)
  Bluetooth: MGMT: Fix discovery stuck after a failed Stop Discovery
  Bluetooth: validate retained LE Set CIG Parameters command length
  Bluetooth: validate retained LE Create CIS command length
  Bluetooth: hci_core: Initialize advertising RPA work only once
  Bluetooth: L2CAP: Ignore connection responses with wrong ident
  Bluetooth: MGMT: Clear disabled connection parameters when loading none
  Bluetooth: hci_sync: Copy the resolving-list IRK under RCU
  Bluetooth: SMP: Protect LTK encryption with RCU
  Bluetooth: SMP: Protect link keys during LTK derivation
  Bluetooth: hci_core: Keep link-key filtering inside RCU
  Bluetooth: btmtk: fix error handling in btmtk_usb_isointf_init()
  Bluetooth: qca: Fix the WCN3950 NVM baud rate offset
  Bluetooth: MGMT: Return RFKILLED for Set Powered on a blocked controller
  Bluetooth: hci_sync: Protect resolving-list lookups
  Bluetooth: hci_sync: Copy the LE accept list under hdev->lock
  Bluetooth: btmtk: derive the firmware ISO setting from MTK_ISO_THRESHOLD
  Bluetooth: btmtk: bound the ISO payload length by the controller's MTU
  Bluetooth: btmtk: drop zero-length ISO packets from endpoint padding
  Bluetooth: hci_sync: Update the CIS host feature when enabling LE
  Bluetooth: L2CAP: Hold incoming data until encryption key size is known
  ...
====================

Link: https://patch.msgid.link/20261102222018.2610820-1-luiz.dentz@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
…rnel/git/klassert/ipsec

Steffen Klassert says:

====================
pull request (net): ipsec 2026-11-02

1) xfrm: retry inexact policy lookup after node reinsertion
   Detect a concurrent change of the inexact policy tree while it is
   searched and retry the lookup, so an insertion can't make it return
   the wrong policy.

2) xfrm: interface: validate the IP header on xmit
   Validate the IP header in xfrmi_xmit() like the IP receive path
   does, so packets injected into an xfrm interface can't reach the
   output path with a malformed header.

3) xfrm: zero-initialise km_event in the replay-notify path
   Zero-initialise the replay event so the netlink header of a
   kernel-originated replay notification no longer carries
   uninitialised stack values.

4) xfrm: espintcp: reorder operations within espintcp_init_sk
   Publish the ESP-in-TCP context before installing the socket
   callbacks, so an early callback can't dereference a context that
   isn't set up yet.

5) xfrm: state: reject mark with bits outside its mask on add
   Reject a mark with bits outside its mask on state insert instead
   of silently truncating it, so a lookup can't be given a mark that
   never matches.

6) xfrm: state: reject mark with bits outside its mask on ALLOCSPI
   Apply the same mark validation to ALLOCSPI, keeping the state and
   policy insert paths consistent.

7) xfrm: policy: reject mark with bits outside its mask on add
   Apply the same mark validation to policy insert, so a policy can't
   be stored with a mark that never matches.

8) xfrm: state: exact mark/mask match for SPI-keyed control-plane SA lookups
   Match mark and mask exactly in the SPI-keyed netlink SA lookups, so
   a catch-all SA can no longer shadow a more specific one.

9) xfrm: fix use-after-free of migrated state in xfrm_do_migrate_state()
   Hold the cloned state for the whole migration, so a concurrent
   delete can't free it while it is still in use.

10) xfrm: fix hw offload state leak on xfrm_do_migrate_state() error path
    Remove the hardware offload of the cloned state on the migration
    error path, so the offloaded SA entry isn't leaked.

11) xfrm: include mark in MIGRATE_STATE SA collision check
    Include the mark in the SA collision check, so a migration that
    only changes the mark can't install a duplicate SA tuple.

12) xfrm: pass extack through to xfrm_init_replay() from xfrm_init_state()
    Pass the extack to xfrm_init_replay(), so replay window errors can
    be reported to userspace.

13) docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple
    Document the mark as part of the EEXIST tuple of the SA migration
    request.

14) xfrm4: use a full socket for local errors
    Resolve the socket owner with skb_to_full_sk() in the IPv4 local
    error path, so a TCP request socket isn't used as a full socket.

Please pull or let me know if there are problems.

ipsec-2026-11-02

* tag 'ipsec-2026-11-02' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec:
  xfrm4: use a full socket for local errors
  docs: xfrm: include mark in XFRM_MSG_MIGRATE_STATE EEXIST tuple
  xfrm: pass extack through to xfrm_init_replay() from xfrm_init_state()
  xfrm: include mark in MIGRATE_STATE SA collision check
  xfrm: fix hw offload state leak on xfrm_do_migrate_state() error path
  xfrm: fix use-after-free of migrated state in xfrm_do_migrate_state()
  xfrm: state: exact mark/mask match for SPI-keyed control-plane SA lookups
  xfrm: policy: reject mark with bits outside its mask on add
  xfrm: state: reject mark with bits outside its mask on ALLOCSPI
  xfrm: state: reject mark with bits outside its mask on add
  xfrm: espintcp: reorder operations within espintcp_init_sk
  xfrm: zero-initialise km_event in the replay-notify path
  xfrm: interface: validate the IP header on xmit
  xfrm: retry inexact policy lookup after node reinsertion
====================

Link: https://patch.msgid.link/20261102100451.2505200-1-steffen.klassert@secunet.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
vhost_get_vq_desc() returns the number of device readable (output) and
device writable (input) iovec segments. A guest can submit an eventq
descriptor chain that fills vq->iov with output segments, setting out
to ARRAY_SIZE(vq->iov) and in to zero.

When the host later queues a vhost-scsi event, vhost_scsi_do_evt_work()
uses out as the index of the first input segment. This accesses one element
beyond vq->iov and triggers an array-index-out-of-bounds report. With
panic_on_warn enabled, the report panics the host.

The event queue accepts device writable buffers only. Reject chains that
contain output segments or lack an input segment before using out as an
index. The input check prevents the out-of-bounds access, while the output
check validates the eventq descriptor direction.

I found the descriptor direction issue myself, though the patch was
written with AI assistance.  The out-of-bounds read with an
output-only chain was separately reported by Jia Jia.

Fixes: a6c9af8 ("tcm_vhost: Add hotplug/hotunplug support")
Reported-by: Jia Jia <physicalmtea@gmail.com>
Assisted-by: OpenAI-Codex:GPT-5
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Message-ID: <20261009-fix-arrary-index-out-of-bounds-in-vhost_scsi_complete_events-v2-1-1f7689a54735@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Split virtqueues save descriptor flags and next indexes in desc_extra
before publishing descriptors to the device. The detach path uses the
shadow next index, but decides whether to continue by rereading the NEXT
flag from the shared descriptor.

Use the shadow flags for the continuation decision as well. This keeps
all detach metadata in the same driver-owned snapshot and avoids an
unnecessary shared-ring read.

Fixes: 72b5e89 ("virtio-ring: store DMA metadata in desc_extra for split virtqueue")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Assisted-by: LLM
Signed-off-by: sungbyeongchan <tjdqudcks0424@naver.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261008050423.32221-1-tjdqudcks0424@naver.com>
vhost_scsi_set_endpoint() allocates command pools only for I/O
virtqueues that are already set up, but publishes the backend for every
virtqueue. Userspace can complete a skipped queue after attaching the
endpoint, then kick it with scsi_tags uninitialized and trigger the
alloc_hint warning in sbitmap_get().

Delayed virtqueue setup is not supported. Leave skipped I/O virtqueues
inactive and reject changes to the vring size or addresses while an
endpoint is attached. Userspace must clear the endpoint before changing
the vring configuration.

I found this bug myself, though the patch was written with AI assistance.

Fixes: 25b98b6 ("vhost scsi: alloc cmds per vq instead of session")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261010-fix-warning-in-sbitmap_get-v3-1-33de562d1359@gmail.com>
Enabling a backend without VHOST_SET_VRING_KICK dereferences a NULL
vq->kick in vhost_poll_start(). Reject the request with -EINVAL.

Fixes: 264ee5a ("tools/virtio: Add --reset")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261011-fix-null-pointer-in-vhost_test_set_backend-v1-1-60b2f12d64c6@gmail.com>
Initialize the completion and as hash buckets before cdev_device_add()
makes the device accessible.

Fixes: 4c8cf31 ("vhost: introduce vDPA-based backend")
Assisted-by: OpenAI-Codex:GPT-5.6
Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261011-fix-null-pointer-in-vhost_vdpa_release-v2-1-66ba929971ce@gmail.com>
Several headers related to virtio, vDPA, VDUSE and vhost were not
covered by any specific MAINTAINERS entry and fell through to the
catch-all THE REST section:

- include/linux/device-id/virtio.h: not matched by the existing
  "include/linux/virtio*.h" glob, which only matches files directly
  under include/linux/ and does not recurse into subdirectories.

- include/uapi/linux/vdpa.h: the in-kernel include/linux/vdpa.h was
  listed under VIRTIO CORE but its UAPI companion was missing; the
  "include/uapi/linux/virtio_*.h" pattern does not match it because
  the filename lacks the "virtio_" prefix.

- include/uapi/linux/vduse.h: there is no dedicated VDUSE section in
  MAINTAINERS; the driver lives under drivers/vdpa/ which is already
  covered by VIRTIO CORE, so the UAPI header belongs there too.

- include/uapi/linux/vhost_types.h: the VIRTIO HOST (VHOST) section
  explicitly lists include/uapi/linux/vhost.h but omits its companion
  types header.

Assisted-by: claude-sonnet 4.6
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261015094049.107999-1-eperezma@redhat.com>
Since c578123 ("virtio_balloon: Treat stats requests as wakeup
events") the stats_request() virtqueue callback takes vb->wakeup_lock
via start_wakeup_event().  init_vqs() registers that callback and even
primes and kicks the stats queue, so the lock is reachable from irq
context as soon as init_vqs() returns, long before the driver sets
DRIVER_OK: vring_interrupt() dispatches to the callback without any
DRIVER_OK check unless CONFIG_VIRTIO_HARDEN_NOTIFICATION is set, and
that option depends on BROKEN.  syzbot hit it from a threaded irq:

  INFO: trying to register non-static key in stats_request
  ...
  assign_lock_key
  register_lock_class
  lock_acquire
  rt_spin_lock
  start_wakeup_event drivers/virtio/virtio_balloon.c:150 [inline]
  stats_request drivers/virtio/virtio_balloon.c:435

The lock is only initialized near the end of virtballoon_probe(),
after init_vqs() and several steps that can still fail and unwind
through del_vqs(), where a racing interrupt still finds the callback
registered.  Until then it is whatever kzalloc() left in vb: lockdep
complains about the unregistered lock class, and wakeup_signal_mask
and processing_wakeup_event get updated from irq context while probe
is still running.

The rt_spin_lock() in the report is just spin_lock() on PREEMPT_RT;
any PROVE_LOCKING build takes the same path.

stop_update_lock(), which the same callback also acquires, is already
initialized before init_vqs(); do the same for wakeup_lock.

Fixes: c578123 ("virtio_balloon: Treat stats requests as wakeup events")
Reported-by: syzbot+13df72e0dc4be5c62215@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=13df72e0dc4be5c62215
Signed-off-by: Mingbing Zhai <zhaimingbing@cmss.chinamobile.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261016025429.901-1-zhaimingbing@cmss.chinamobile.com>
Use virtqueue consistently in the notify function comments
across the MMIO and PCI transports.

Assisted-by: LLM

Signed-off-by: Wei-Shuo Chen <tavhadia@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261016072318.24015-1-tavhadia@gmail.com>
remove_common() frees the driver data during freeze, but does not clear
vdev->priv, which points to freed memory. If probe_common() then fails
during restore, a later remove or freeze can dereference the dangling
pointer.

Clear vdev->priv on the probe_common() error cleanup path and before
freeing the driver data in remove_common(). Also reset the device and
return early from remove_common() if vdev->priv is already NULL for a
safe teardown after a failed restore.

Fixes: 08e53fb ("virtio-rng: support multiple virtio-rng devices")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <blum@kernel.org>
Reviewed-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261016103640.4989-2-blum@kernel.org>
vduse_domain_get_coherent_page() assumes that iotlb entries above
bounce_size were installed by vduse_domain_alloc_coherent(), so it
treats map->addr as a physical address. But vduse registers with
use_va = true, and when the device is bound to vhost_vdpa,
vhost_vdpa_va_map() stores a userspace virtual address in map->addr,
which vduse_domain_set_map() then copies into the same iotlb. A
process holding the domain file descriptor across a rebind can
therefore fault in an arbitrary physical page with read/write
access, ignoring the entry permissions.

Additionally, since the domain file mmap lacks VM_IO, the domain
file itself can be mapped and passed to vhost_vdpa_va_map(),
producing self-referential entries that bypass the coherent path
check.

To fix, only translate entries whose backing file is the domain
file itself in vduse_domain_get_coherent_page(), reject such
entries in vduse_domain_set_map() since only external mappings
should be imported, and set VM_IO on the domain file mmap so
vhost_vdpa_va_map() refuses to map it in the first place.

Fixes: 8c773d5 ("vduse: Implement an MMU-based software IOTLB")
Cc: Xie Yongji <xieyongji@bytedance.com>
Cc: stable@vger.kernel.org
Reported-by: chenglong.ma <longpareto@gmail.com>
Signed-off-by: chenglong.ma <longpareto@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
iov_iter_get_pages2() returns a byte count that excludes the offset into
the first page, but also returns a reference to that page in pages[].

On the misaligned-I/O fallback, vhost_scsi_revert_map_iov_to_sgl() puts
pages already added to the SG list. The cleanup loop starts at
pages[npages], but accounts for its first page as PAGE_SIZE bytes
rather than PAGE_SIZE - offset. If the remaining data starts at a
non-zero offset, it can finish one page early and leave a page reference
behind.

Use PAGE_SIZE - offset for the first remaining page and clear offset for
later pages, as in the mapping loop. Without this, each affected request
leaks one page reference.

Fixes: bca939d ("vhost-scsi: Dynamically allocate scatterlists")
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Jia Jia <physicalmtea@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261023104035.6686-1-physicalmtea@gmail.com>
The virtqueue_add_indirect_packed() function fills an indirect
descriptor table with addr, len, and flags for each entry, but does
not initialize the id field of struct vring_packed_desc. The table is
allocated via kmalloc() (not kzalloc) and then DMA-mapped with
DMA_TO_DEVICE, making the uninitialized 2-byte id field of each
descriptor readable by the device.

This leaks kernel heap memory to the device for every packed indirect
descriptor entry. A malicious or compromised device could extract heap
contents by reading the id fields from the DMA-mapped indirect
descriptor tables. This affects all virtio devices that use packed
virtqueues with indirect descriptors, which is the common configuration
for modern virtio devices.

Fix this by explicitly initializing desc[i].id to zero in the
descriptor filling loop. The id field is unused in indirect descriptor
table entries per the virtio specification (only the head descriptor in
the main ring uses id for buffer identification), so setting it to zero
is semantically correct.

This matches the split ring path where all four fields of struct
vring_desc (addr, len, flags, next) are explicitly written in
virtqueue_add_desc_split().

Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261029072511.851-1-zhangjiao2@cmss.chinamobile.com>
Lockdep reports the following circular locking dependency when a virtio-net
device is probed with lockdep enabled on a system whose devices sit behind
an IOMMU:

    ======================================================
    WARNING: possible circular locking dependency detected
    7.3.0-rc1+ #84 Not tainted
    ------------------------------------------------------
    kworker/u34:0/57 is trying to acquire lock:
    ffff800104f83ee8 (&md->mutex){+.+.}-{4:4}, at: msi_domain_get_virq+0xf0/0x118

    but task is already holding lock:
    ffffc00081edd930 (cpu_hotplug_lock){++++}-{0:0}, at: cpus_read_lock+0x10/0x1c

    which lock already depends on the new lock.

    Chain exists of:
      &md->mutex --> &group->mutex --> cpu_hotplug_lock

The cycle is composed of three dependencies:

* cpu_hotplug_lock -> &md->mutex (which triggers the splat). virtio_net's
  init_vqs() calls cpus_read_lock() around virtnet_set_affinity(), which
  reaches vp_set_vq_affinity(). That calls pci_irq_vector(), which takes
  the per-device MSI mutex (&dev->msi.data->mutex) via
  msi_domain_get_virq().

* &md->mutex -> &domain->mutex -> &group->mutex.  MSI-X allocation of any
  device behind the IOMMU holds the MSI mutex while allocating interrupts
  through the IRQ domain hierarchy. The MSI parent domain (GICv2m, or ITS
  likewise) calls iommu_dma_prepare_msi() from its .alloc() to map the MSI
  doorbell, which takes the IOMMU group mutex.

* &group->mutex -> cpu_hotplug_lock. bus_iommu_probe() calls
  iommu_setup_dma_ops() under the group mutex; initializing the IOVA
  rcaches registers a cpuhp instance, which takes cpu_hotplug_lock.

The cycle only became complete since commit 288683c ("iommu: Make
iommu_dma_prepare_msi() into a generic operation"), where
iommu_dma_prepare_msi() switched to use the group mutex.

pci_irq_vector() is a pure lookup of a vector that is bound to the
queue for the whole lifetime of the queue, so there is no reason to
take the MSI mutex for it from cpu hotplug locked contexts.

Cache the IRQ number in virtio_pci_vq_info {} at vector binding time and
make vp_set_vq_affinity() use the cached value.

This also covers the CPU hotplug callbacks
(virtnet_cpu_online/virtnet_cpu_dead), which call virtnet_set_affinity()
with cpu_hotplug_lock already held.

Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20261029121648.22155-1-zenghui.yu@linux.dev>
The timeval validation checks tv_usec < USEC_PER_SEC but not
tv_usec >= 0, so a negative tv_usec makes the timeout computation
wrap into a bogus value, later tripping "schedule_timeout: wrong
timeout value" instead of being rejected.

Fixes: d021c34 ("VSOCK: Introduce VM Sockets")
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20261030064428.73930-1-phind.uet@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
TCP established ehash lookups are lockless. The socket caches involved
use SLAB_TYPESAFE_BY_RCU, so memory can be reused before an RCU reader
that retained its old address has finished.

After a tuple match, __inet_lookup_established() and
__inet6_lookup_established() acquire a reference and repeat the tuple
check. They do not check whether the new object is hashed. If the
address is reused for a socket with the same tuple, the lookup can
acquire a reference to the new object and return it while its nulls node
is unhashed.

A PoC that drives reuse with a SYN cookie request socket reproduced the
crash. The new request socket is unhashed and has a NULL rsk_listener.
A lookup that had loaded the address of the old request socket acquired
the reference published by tcp_get_cookie_sock() and returned the new
object. tcp_v4_rcv() then read sk_state through the NULL listener.

The resulting crash was:

  BUG: kernel NULL pointer dereference, address: 0000000000000012
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  ...
  Oops: Oops: 0000 [#1] SMP NOPTI
  CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 7.3.0-00591-g0e135910deec #1 PREEMPT(lazy)
  ...
  RIP: 0010:tcp_v4_rcv+0x44e/0x1280
  ...
  R10: 0000000000000001 R11: 00000000024ca8c0 R12: 0000000000000000
  ...
  CR2: 0000000000000012 CR3: 0000000103d50004 CR4: 0000000000770ef0
  ...
  Call Trace:
   <IRQ>
   ? raw_local_deliver+0xae/0x240
   ip_protocol_deliver_rcu+0x2d/0x180
   ip_local_deliver_finish+0x84/0x100
   ip_sublist_rcv_finish+0x5f/0x70
   ip_sublist_rcv+0x12a/0x1d0
   ip_list_rcv+0xfd/0x130
   __netif_receive_skb_list_core+0x223/0x250
   netif_receive_skb_list_internal+0x1d2/0x2c0
   ? try_fill_recv+0x39/0x7b0
   napi_complete_done+0x74/0x170
   virtnet_poll+0x445/0x600
   __napi_poll+0x27/0x1e0
   net_rx_action+0x2fe/0x3b0
   handle_softirqs+0xc2/0x2c0
   __irq_exit_rcu+0x74/0xd0
   common_interrupt+0x7f/0x90
   </IRQ>
  ...
  Kernel panic - not syncing: Fatal exception in interrupt

After taking a reference, check whether the nulls node is unhashed in
both IPv4 and IPv6 established lookups. If it is unhashed or the tuple
no longer matches, drop the reference and restart the lookup.

Lookups racing with the TIME_WAIT hashdance, or with a request being
replaced by its child, now restart and find the new socket instead of
returning the old one.

Request sockets that were never inserted into ehash can have a nonzero
refcount, and a stale lookup can hold a transient reference. Therefore,
when SYN cookie, Fast Open, and request migration paths fail after
setting a nonzero refcount, release the references held by those paths
with reqsk_put() instead of freeing the request directly.

Fixes: 079096f ("tcp/dccp: install syn_recv requests into ehash table")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20261029214219.1035176-2-imv4bel@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Before commit fb041bb ("locking/refcount: Consolidate implementations
of refcount_t"), default builds implemented refcount_inc_not_zero() using
atomic_add_unless(), which provided full memory ordering on success. The
commit removed that ordering on weakly ordered architectures, allowing
accesses after a successful reference acquisition to be reordered before
it.

Use refcount_inc_not_zero_acquire() in the IPv4 and IPv6 established
lookups and in inet_twsk_purge(), where the socket is validated again
after taking a reference.

bpf_sk_assign() can receive a socket pointer obtained through BTF
without a reference. Use acquire ordering when it takes its own reference
for a refcounted socket.

Use refcount_set_release() when setting refcounts in the SYN cookie,
TCP Fast Open, request migration, and TIME_WAIT paths. Keep the existing
TIME_WAIT smp_wmb(), which separately orders the refcount store before
ehash publication.

Fixes: fb041bb ("locking/refcount: Consolidate implementations of refcount_t")
Fixes: 27e5203 ("bpf: Change bpf_sk_assign to accept ARG_PTR_TO_BTF_ID_SOCK_COMMON")
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/20261029214219.1035176-3-imv4bel@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Hyunwoo Kim says:

====================
inet: fix lockless ehash walk races

Fix two issues in lockless ehash walks. Reject unhashed sockets after
taking a reference in established lookups, and restore the acquire/release
ordering around refcount publication and acquisition.

v4: https://lore.kernel.org/r/20261026003804.61923-1-imv4bel@gmail.com
v3: https://lore.kernel.org/r/20261024053720.1147022-1-imv4bel@gmail.com
v2: https://lore.kernel.org/r/20261023052542.3505250-1-imv4bel@gmail.com
v1: https://lore.kernel.org/r/ath58Egc-oI6p3Jl@v4bel
====================

Link: https://patch.msgid.link/20261029214219.1035176-1-imv4bel@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Ariadne Conill and others added 20 commits November 6, 2026 03:43
The acceptance build judged x86_64 against defconfig with the Edera
options forced on, which is not the kernel we ship. Merge the latest
configs/x86_64/host.config from edera-dev/linux-kernel-oci over
defconfig first, the way linux-kernel-oci itself applies it (the file
is a fragment against x86_64_defconfig and omits SMP, NET and the rest
of what matches it), and log the commit it came from.

The Edera options are still forced on as built-ins afterwards: the host
config builds OpenPaX out and 9P/Xen, virtio-gpu and the Hyper-V
network drivers as modules, which a vmlinux build would never compile.
AGP joins that list on x86_64 because host.config has it as a module,
which caps DRM at m.

arm64 is unchanged.
A rebase whose independent build failed went straight to a pull request,
and in practice that was a run Claude never finished: the Bash tool's
two-minute default timeout cannot hold a kernel build, so the build went
to the background and the session ended "waiting for the x86 build"
(#47, and #35 before it). Nobody saw the error until a reviewer did.

Give the rebase step a 90-minute Bash timeout, and tell the skill to run
builds in the foreground and to keep fixing and rebuilding until both
pass rather than treat a failing build as an outcome to report.

If the independent build still fails, a new read-only fix job hands
Claude its branch and the build logs for one repair round, following a
new "Repairing a failed build" section of the skill. A repaired branch
is verified and built again from scratch before publish judges it; the
checker now runs on whichever branch is final. Publish takes the
repaired branch and report when there is one, says so in the pull
request, and keeps the repair round's report when it repaired nothing.

The build job moves to a reusable rebase-build.yml so the first build
and the rebuild are the same job, and it now keeps each build's log as
an artifact for the repair round to read.

A repair changes downstream commits, so a repaired branch still shows
drift and still goes to review rather than being pushed: what changes is
that the reviewer gets a branch that builds.
The previous commit moved the build job into rebase-build.yml and calls
it twice, but the file itself never made it into the commit: the
kernel's .gitignore ignores dot-directories, so it has to be added with
-f. Without it, upstream-rebase.yml calls a workflow that does not exist.
This reverts commit 0a2ac17.

Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
This reverts commit 8788269.

We no longer want to split the unpopulated boot-time space between
the dom0 balloon and grant and foreign mappings.

Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
This reverts commit 7498978.

Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
Consolidate existing duplicated code. No functional change.

Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
The boot-time unbacked address space reaches the unpopulated allocator
(page_list) one 4 KiB page at a time, with a lock round trip and a list
push for each page. On a large dom0 that is millions of round trips at
boot. page_list also is unaware of page contiguity, limiting dom0
balloon growth to 4 KiB updates.

Hand each extra memory region over whole, and keep its aligned 2 MiB
blocks on a list per node, linked through the first page of each
block as page_list links pages. The pages around the blocks, and a
block that a node boundary cuts, go on page_list.

Grants and foreign mappings still take pages from page_list only.
When page_list of a node is empty, one block moves onto it, so taking
a page stays a list pop. Pages given back go on page_list and do not
form a block again.
With no pages parked on the balloon, dom0 grows by hotplugging a
memory section at the first free physical address. That address space
can belong to a PCI device that has not claimed it yet, and Xen does
not stop dom0 from growing when dom0_mem sets no max:.

dom0's balloon needs room to grow into, and grows faster when Xen
populates a whole 2 MiB extent at a time. The unpopulated allocator
keeps that room, the boot-time unbacked address space. Grant and foreign
mappings and the balloon have to share it.

Feed the dom0 balloon from the allocator's 2 MiB blocks when it is
instructed to grow.
Add `info/room_kb` to the sysfs of the xen balloon driver, so user tools
can discover the amount of memory dom0 can grow by. Reported are only
complete 2MiB blocks in the unpopulated allocator.
The data pages of a ring are granted as the first page's frame plus the
page index. That holds for auto-translated guests, whose grant frames are
pseudo-physical. A PV guest grants machine frames, and alloc_pages_exact()
only promises pseudo-physical contiguity. When the pages are not
machine-contiguous the backend maps the frames that follow the first one.
Some of those are other pages of the guest, so requests read as garbage,
and some cannot be granted at all, so the mapping fails.

A freshly built PV guest is usually machine-contiguous within a 2 MiB
block, which hid this. A PV guest restored from a snapshot gets its frames
one page at a time, so its first request on ring 0 after the restore
arrives as a malformed frame and the mount hangs.

Look up the frame of each page instead.

Signed-off-by: Kavi Daula <kavi@edera.dev>
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>
@edera-rebase-app

ghost commented Nov 7, 2026

Copy link
Copy Markdown
Author

Superseded by #95.

@edera-rebase-app edera-rebase-app Bot closed this Nov 7, 2026
@edera-rebase-app
edera-rebase-app Bot deleted the rebase/edera-mainline/20261106-a85e73be200d-f66469d9905b branch November 7, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.