Repository navigation
Rebase edera/mainline onto master @ 6628e7d4c6b2 - #74
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
I/O to backing files requires support for iter based read/write, so check for that upfront instead of dereferencing a NULL pointer later. Fixes: eb0570c ("block: new zoned loop block device driver") Reported-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20261029150353.2503201-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Switch both loops to the standard list_for_each_entry_safe() pattern and remove the explanatory comment. Signed-off-by: Anvik Loitongbam <permissiontogallop@gmail.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Link: https://patch.msgid.link/20261029144745.23792-1-permissiontogallop@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
table_size() checks ALIGN(sizeof(struct table_header) + len * el_size, 8) in size_t, where @len is td_lolen, a u32 user-provided value from the policy blob. On 32 bit kernels both operations can overflow. Triggering this bug allows to: - overflow a 16 byte allocation with up to 4GiB of policy data - store the table header at address ZERO_SIZE_PTR (kvzalloc(0)) However, this bug requires CAP_MAC_ADMIN, only affects 32 bit kernels, and the copy runs until the machine is destroyed, so it gives no controllable primitive and is therefore not a security issue. Compute the size with the checked helpers and return 0 when the result is not representable, so the callers can reject the table. A valid table is never 0 bytes, the header alone is 12. 64 bit kernels cannot overflow (these structs are 32 bit), and are hence not affected. Fixes: e06f75a ("AppArmor: dfa match engine") Signed-off-by: Maxime Bélair <maxime.belair@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
For historical reasons several matchers duplicate the dfa character transition instead of using match_char(). This is because aa_dfa_match_until() and aa_dfa_matchn_until() were written on a branch that did not yet have match_char(), and copied code from aa_dfa_match(). leftmatch_fb() used the same pattern. When match_char() added support for diff-encoded states, the change was never ported to these copies. match_char() resolves a diff encoded state by using def[state] and retrying the same character, until it reaches a state with a valid transition. The copies instead do a simple `state = def[state];` after the character is consumed, so on a diff encoded state one byte is dropped and the walk continues from the diff parent in the wrong state. This makes an unnamed px/Px/cx/Cx transition resolve to no profile, and exec fails with apparmor="DENIED" operation="exec" info="profile transition not found" Convert the three copies to match_char(). For a dfa with no diff encoded state this is a no-op. This bug is latent until the kernel advertises policy/diff-encode. Closes: https://gitlab.com/apparmor/apparmor/-/work_items/663 Fixes: 21f6066 ("apparmor: improve overlapping domain attachment resolution") Fixes: 031dcc8 ("apparmor: dfa add support for state differential encoding") Signed-off-by: Maxime Bélair <maxime.belair@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
split_token_from_name() returns ERR_PTR(-EINVAL) for malformed input, but its kernel-doc describes NULL as the failure result. NULL is instead a successful result when the name following the token is empty. Document all three results: the name, NULL for an empty name, and an error pointer for malformed input. Assisted-by: LLM Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
aa_lookup_condperms() returns perms[index + 1] when an accept entry has ACCEPT_FLAG_OWNER set and the subject uid does not match the file uid, so such an entry consumes two slots in the perms table. But verify_dfa_accept_index() only checks that index is within the perms table, so a policy that sets the owner flag on the last entry is accepted, and the runtime lookup then reads perms[index + 1] one entry past the end of the table. The perms table is allocated by unpack_perms_table() with a u16 size read from the policy blob, so a crafted policy can place the owner flag at index size - 1 to reach the out-of-bounds read. Check that index + 1 is also in bounds when the owner flag is set. Fixes: 6f442d4 ("apparmor: fix profile verification and enable it") Cc: stable@vger.kernel.org Signed-off-by: Guanglei Zhu <zhugl3@xiaopeng.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
When the namespace already exists, the reference taken by aa_get_ns() is overwritten with ERR_PTR(-EEXIST) without being released. The caller in apparmorfs.c clears ns on IS_ERR() and so cannot drop it either, leaking the reference on raced mkdir of an existing namespace. Release the reference before returning -EEXIST. Fixes: 73688d1 ("apparmor: refactor prepare_ns() and make usable from different views") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Signed-off-by: John Johansen <john.johansen@canonical.com>
aa_lookupn_ns() takes a reference on the namespace it finds with aa_get_ns(), which is kref_get() on the reference count that the namespace is released through, without checking whether the namespace is still in use. A concurrent removal of a ":"-prefixed namespace looks the same namespace up and only then takes the parent lock to remove it, so the last reference can be dropped between the lookup and the aa_get_ns() call: the reference count then reports the increment on a zero count and the kernel classifies the following use of the object as a use-after-free. A user with CAP_MAC_ADMIN can trigger this by writing a ":<name>" removal and a ":<name>/<profile>" removal to /sys/kernel/security/apparmor/.remove concurrently. refcount_t: addition on 0; use-after-free. WARNING: lib/refcount.c:25 at refcount_warn_saturate+0xc0/0xe0, CPU#6 Call Trace: <TASK> aa_lookupn_ns+0xa9/0xc0 aa_remove_profiles+0x4fb/0x730 ? __kvmalloc_node_noprof+0x219/0x5c0 ? __pfx_aa_remove_profiles+0x10/0x10 ? aa_loaddata_alloc+0x65/0x1f0 ? _copy_from_user+0x2d/0x80 ? aa_loaddata_alloc+0x111/0x1f0 profile_remove+0x2ee/0x4a0 vfs_write+0x21e/0xcf0 ? rcu_core+0x29c/0x1740 ? timerqueue_linked_add+0x1f4/0x3d0 ? __pfx_vfs_write+0x10/0x10 ? mutex_lock+0x81/0xe0 ? __pfx_mutex_lock+0x10/0x10 ? __pfx_rcu_core+0x10/0x10 ? __pfx_hrtimer_update_next_event+0x10/0x10 ? mutex_unlock+0x7b/0xd0 ? fdget_pos+0x24d/0x4b0 ksys_write+0xf7/0x1c0 ? __pfx_ksys_write+0x10/0x10 ? restore_fpregs_from_fpstate+0x37/0xc0 do_syscall_64+0xf9/0x540 entry_SYSCALL_64_after_hwframe+0x77/0x7f </TASK> Fix by rejecting a namespace whose reference count is zero. Fixes: 3664268 ("apparmor: add namespace lookup fns()") Cc: stable@vger.kernel.org Signed-off-by: Binbin Deng <18983559317@163.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
SCTP can start an association through sendmsg() or CONNECTX. These paths call the SCTP-specific sctp_bind_connect hook instead of the normal socket connect hook, but AppArmor does not register it. As a result, a profile can deny connect and allow send or setopt, yet a task can still create an SCTP association. Register the SCTP hook. Ask for connect permission when SENDMSG_CONNECT or CONNECTX creates an association. Fixes: 56974a6 ("apparmor: add base infastructure for socket mediation") Assisted-by: LLM Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> Signed-off-by: John Johansen <john.johansen@canonical.com>
netdev_wait_allrefs_any() re-sends NETDEV_UNREGISTER every second while it waits for the last references on a device to be dropped. By then netdev_run_todo() has already marked the device NETREG_UNREGISTERED and RTNL has been dropped at least once since the initial notification sent by unregister_netdevice_many_notify(). netdev_genl_netdevice_event() does not tell these rebroadcasts apart from the initial notification and sends a NETDEV_CMD_DEV_DEL_NTF multicast for each of them. At best this spams NETDEV_NLGRP_MGMT listeners with duplicate notifications; at worst the pernet state of the netns the device belongs to is already gone and the handler dereferences a NULL pointer. default_device_exit_batch() only unregisters the devices still listed in the exiting netns; it does not wait for in-flight unregistrations of devices that were already unlisted (the barrier doing that was removed by commit 8a4fc54 ("net: get rid of rtnl_lock_unregistering()")). So when a device is unregistered by something other than the cleanup_net() of its own netns while references on it are still held, e.g. a veth whose peer in another netns gets deleted, and that netns exits while the device is stuck in netdev_wait_allrefs_any(), the remaining pernet exit handlers run and genl_pernet_exit() sets net->genl_sock to NULL. The next rebroadcast then crashes in genl_has_listeners(): BUG: KASAN: null-ptr-deref in netlink_has_listeners+0x3d/0x3f0 net/netlink/af_netlink.c:1388 Read of size 8 at addr 0000000000000578 by task syz.0.0/5325 Call Trace: <TASK> netlink_has_listeners+0x3d/0x3f0 net/netlink/af_netlink.c:1388 genl_has_listeners include/net/genetlink.h:644 [inline] netdev_genl_dev_notify+0x161/0x450 net/core/netdev-genl.c:93 netdev_genl_netdevice_event+0x98/0x3c0 net/core/netdev-genl.c:1491 notifier_call_chain+0x1a5/0x3d0 kernel/notifier.c:85 netdev_wait_allrefs_any net/core/dev.c:11690 [inline] netdev_run_todo+0x731/0x1060 net/core/dev.c:11808 rtnl_unlock net/core/rtnetlink.c:157 [inline] rtnl_dellink+0x68f/0x810 net/core/rtnetlink.c:3707 syzbot hit this by moving one end of a veth pair into a short-lived netns while netdevsim's deferred FIB event processing still held a reference on it, and then deleting the other end (repro [1]). While the source of this bug is netdevsim deferring FIB processing for and holding onto the device reference for O(seconds) which is being fixed separately [2], any driver may introduce such a delay and trigger the null-ptr-deref. Skip the rebroadcasts, which are the only NETDEV_UNREGISTER events delivered with reg_state == NETREG_UNREGISTERED. The notifications sent by unregister_netdevice_many_notify() and, for a device leaving a netns, by __dev_change_net_namespace() are issued under RTNL in the same critical section that unlists the device, before its netns can be torn down, and keep being handled. This mirrors what ip6_route_dev_notify() already does to cope with the rebroadcasts. This change should not break the UAPI spec as it defines dev-del-ntf as a "Notification about device disappearing." which is a single event. The rebroadcast in netdev_wait_allrefs_any() exists to re-kick in-kernel subsystems holding references; netdev-genl happens to be on the notifier chain and forwards it. [1] https://gist.github.com/NamanGulati/2d1b49b8757f9a88b0bd6e55018c02ae [2] https://lore.kernel.org/r/20261023191517.607834-1-kuniyu@google.com Fixes: d3d854f ("netdev-genl: create a simple family for netdev stuff") Reported-by: syzbot+1269fe6cc2016008124e@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/6adf9f64.6200f071.51519.0ed1.GAE@google.com/ Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Naman Gulati <namangulati@google.com> Link: https://patch.msgid.link/20261026221306.3151025-1-namangulati@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
io_timeout_cancel() posts the cancelled timeout's -ECANCELED CQE without
advancing ctx->cq_timeouts. io_timeout_fn() and io_kill_timeout()
advance it for every timeout CQE they post, and io_flush_timeouts()
computes the number of non-timeout completions as
seq = cached_cq_tail - cq_timeouts
to compare against each off timeout's target_seq. The cancelled
timeout's CQE is therefore counted as a regular completion, so every
cancellation makes an already armed off timeout fire one completion
early.
A ring with a keep-alive timeout of off=4 completes it after two NOPs
when one off=100 victim is cancelled through IORING_OP_ASYNC_CANCEL, and
before any NOP when two victims are cancelled. The cancel CQE should
count, but the cancelled timeouts' -ECANCELED CQEs must not: the
expected counts are three and two NOPs respectively.
Advance cq_timeouts when io_timeout_extract() succeeds, under
timeout_lock and before the -ECANCELED completion is queued, matching
io_timeout_fn() and io_kill_timeout(). The -ENOENT and -EALREADY paths
post no new timeout CQE and keep their accounting. Both the
ASYNC_CANCEL and the TIMEOUT_REMOVE path go through io_timeout_cancel().
Fixes: bfe68a2 ("io_uring: off timeouts based only on completions")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
Link: https://patch.msgid.link/179328314078.648427.13761781546953594668@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
bnxt_rx_pkt() tries to return the aggregation buffers of a packet to the ring when the copybreak allocation fails, but the same logic is missing on the rx_skb_func() failure path. The agg BDs consumed by the device are then never posted again. The agg ring is only refilled one-for-one as completions consume its buffers, so each such failure permanently shrinks it. Under sustained memory pressure the ring drains completely, and the queue stops receiving anything that does not fit into the head buffer, even once memory is available again. Only re-creating the rings (e.g. ifdown / ifup) recovers it. Commit 296d5b5 ("bnxt_en: Fix aggregation buffer leak under OOM condition.") fixed the copybreak path only. Recently commit bd3beb5 ("eth: bnxt: disable rx-copybreak by default") made the non-copybreak path the default, re-surfacing the issue. With XDP, the agg buffers are attached to the xdp_buff as frags by this point. Their agg ring slots have already been refilled. We need to keep the original head page (and therefore shinfo) around until the xdp_buff cleanup. Note the odd split of ownership here: rx_skb_func() only deals with the head buffer, the agg buffers stay with the caller in whatever state they are in, still on the ring without XDP, or frags of the xdp_buff with XDP. This complicates rx_skb_func() cleaning up all the buffers (head and frags), which would be more intuitive. Discovered in production, severe packet loss would persist after a transient OOM event. Tested on a BCM57504 by failing the head buffer allocations in bnxt_rx_skb() (bpftrace override() of should_failslab() and should_fail_alloc_page()) while receiving 1400B ICMPv6 echo requests. 341k packets were dropped on that queue, enough to drain its 8188 entry agg ring 40 times over, and the queue kept receiving large frames afterwards with no loss and no new HW drops. With a frags-capable XDP_PASS program at MTU 9000, receiving 8000B ICMPv6 echo requests while napi_build_skb() called from bnxt_rx_multi_page_skb() failed, 9.2k packets were dropped, the page pools' inflight count stayed flat and there were no KASAN or DEBUG_PAGEALLOC splats. Fixes: c0c050c ("bnxt_en: New Broadcom ethernet driver.") Fixes: 4c6c123 ("bnxt: adding bnxt_rx_agg_pages_xdp for aggregated xdp") Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20261027234940.1267225-2-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Since rx-copybreak became configurable, bnxt_set_ring_params() sizes the head buffers to fit at least rx_copybreak bytes, and the copybreak path in bnxt_copy_data() syncs rx_copybreak bytes of the head buffer. bnxt_set_tunable() however only updates bp->rx_copybreak, and nothing on the open path recalculates the ring parameters. After raising rx-copybreak the head buffers keep their old size until some other setting changes, and bnxt_copy_data() syncs past their end, into the next buffer in the page or past the end of the page: DMA-API: bnxt_en 0000:01:00.0: device driver tries to sync DMA memory it has not allocated [device address=0x00000002aa210c40] [size=1024 bytes] WARNING: kernel/dma/debug.c:1162 at check_sync+0x577/0x1eb0, CPU#22: swapper/22/0 Call Trace: <IRQ> debug_dma_sync_single_for_cpu+0x66/0x90 bnxt_copy_data+0x12f/0x290 bnxt_rx_pkt+0x24ea/0x50f0 __bnxt_poll_work+0x42c/0xc00 bnxt_poll_p5+0x579/0x17a0 __napi_poll+0x8b/0x2c0 net_rx_action+0x58f/0xbb0 Here the head buffers were still sized for the 640B HDS threshold, four 1kB buffers per page, while rx-copybreak was raised to 1024. Without coherent DMA or with swiotlb the oversized sync can corrupt a neighboring buffer owned by the device or by an skb. The device must be down for rx-copybreak to change, so recalculate the ring parameters right away, like bnxt_set_ringparam() does. Hit while testing patch 1, tested on BCM57504 - boot; set rx-copybreak to 1024 with the link down (CONFIG_DMA_API_DEBUG); ifup. Fixes: 152f4da ("bnxt_en: add support for rx-copybreak ethtool command") Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20261027234940.1267225-3-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
If a replacement agg buffer can't be allocated for a packet received with XDP attached, bnxt_rx_pkt() drops the packet without returning its head buffer to the ring. The head buffer leaks, and since rx_prod still advances, the device gets a BD with a stale DMA address which points at a buffer the driver no longer owns. When that BD completes the driver finds no buffer in the slot. The agg buffers consumed before the failing one have already been replaced on the agg ring, they are referenced only by the frags of the xdp_buff, which nobody frees. bnxt_xdp_buff_frags_free() would skip them since the frags flag is set only on success, so set it upfront. Pointed out in LLM review of the first patch of the series. Tested on a BCM57504 at MTU 9000 with a frags-capable XDP_PASS program, receiving 8000B ICMPv6 echo requests (a head and two agg buffers each) while page_pool_alloc_netmems() called from bnxt_rx_agg_netmems_xdp() failed half of the time (bpftrace override()). 44.7k packets were dropped, the page pools' inflight count stayed flat and there were no KASAN or DEBUG_PAGEALLOC splats. Fixes: 4c6c123 ("bnxt: adding bnxt_rx_agg_pages_xdp for aggregated xdp") Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20261027234940.1267225-4-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
When xdp_do_redirect() fails bnxt_rx_xdp() recycles the head page but not the frags of a multi-buffer frame. Their agg ring slots have already been refilled, so the pages leak, and the page pool can't be destroyed until they are returned, which will never happen. Redirect to an AF_XDP socket in copy mode fails this way with -ENOMEM whenever the socket's fill ring runs out of buffers. A socket bound without XDP_USE_SG also fails with -ENOSPC for every frame that doesn't fit in a single chunk. All the other drop paths in this function free the frags. Pointed out in LLM review of the first patch of the series. Tested on a BCM57504 at MTU 9000 by redirecting 60k 8000B ICMPv6 echo requests (a head and two agg buffers each) to lo, which can't transmit XDP frames. The page pools' inflight count stayed flat rather than growing by two pages per frame. Fixes: a7559bc ("bnxt: support transmit and free of aggregation buffers") Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20261027234940.1267225-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
With a multi-buffer XDP program attached, a packet only has agg buffers if it filled its head buffer, which in page mode holds most of a page. The program can still move the start of the packet forward with bpf_xdp_adjust_head() and leave at most rx_copybreak bytes in the head. bnxt_rx_pkt() then copies the head into a new skb, puts the head page back on the ring, and calls bnxt_xdp_build_skb() on the copy. bnxt_xdp_build_skb() only sets nr_frags and the skb's length accounting, because it expects an skb built around the head page, sharing its shinfo with the xdp_buff. The copy ends up with nr_frags set but no frag descriptors, and the stack later reads and releases whatever its frags array happens to contain. The real frags leak. Copy the frag descriptors to the new skb in bnxt_copy_xdp(), so that bnxt_xdp_build_skb() finds the frags where it expects them. The frags now belong to the skb, and the head page goes back on the ring as before. Pointed out in LLM review of the first patch of the series. Confirmed by reading the code, the unfixed kernel was not run with the reproducer below. Tested on a BCM57504 at MTU 9000 with rx-copybreak raised to 1024 and a frags-capable XDP program moving the start of multi-buffer frames 3000B forward with bpf_xdp_adjust_head(), receiving 8000B ICMPv6 echo requests (a head and two agg buffers each). All 60k frames took the copybreak path with frags attached, the sampled skbs reached GRO with len=4998 data_len=4492 nr_frags=2, and were freed by the stack with the page pools' inflight count staying flat, no KASAN or DEBUG_PAGEALLOC splats. Fixes: 1dc4c55 ("bnxt: adding bnxt_xdp_build_skb to build skb from multibuffer xdp_buff") Reviewed-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20261027234940.1267225-6-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
io_recv_finish() debits sr->mshot_total_len with min_t(int, sel->val, sr->mshot_total_len). sel->val is the cumulative byte count of the request: on a bundle retry the receive path adds sr->done_io back to the return value, and the bundle branch in io_recv_finish() recovers the new bytes with this_ret = sel->val - sr->done_io. The debit therefore uses the wrong value after a bundle retry, and the int cast truncates a limit above INT_MAX. For an IORING_OP_RECV multishot request with optlen above INT_MAX, the limit becomes negative when cast to int, so the first completion debits the entire limit and ends the multishot with IORING_RECV_MSHOT_DONE while the socket still holds data that covers the limit. With 120 bytes queued, a 64-byte buffer and optlen 0x80000000, the first 64-byte CQE lacks IORING_CQE_F_MORE and 56 bytes remain unread; the same setup with optlen 0x7fffffff posts 64 and 56 bytes with F_MORE. After a bundle retry, the bytes already debited for the previous attempts are debited again, so the limit is exhausted early. With 1400 bytes queued, optlen 1000 and buffers of 600, 100, 100, 50, 50 and 200 bytes, the first attempt delivers 700 bytes and retries; the second delivers 200 more, but the debit accounts for 900 and finishes the request with a terminal 900-byte CQE while 500 bytes remain unread. The limit could have been reached. Debit only the bytes received by this invocation, sel->val - sr->done_io, and compare as unsigned so a limit above INT_MAX is accounted correctly. Non-bundle multishot requests keep sr->done_io at zero, so their accounting is unchanged. Fixes: 0ebc9a7 ("io_uring/net: Support multishot receive len cap") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Cheng Yongkang <teel4res@gmail.com> Link: https://patch.msgid.link/179328314078.648427.10086632105828535293@gmail.com [axboe: fix-up near-by incorrect comment while in there] Signed-off-by: Jens Axboe <axboe@kernel.dk>
Jakub Kicinski says: ==================== eth: bnxt: fix Rx buffer leaks under OOM Commit bd3beb5 ("eth: bnxt: disable rx-copybreak by default") changed the defaults putting users on buggy(ier) driver paths. Fix various ways bnxt may leak buffers under OOM. The first patch fixes the real bug that was hit in production. Second patch fixes an issue I hit while testing the first one. The next 3 patches fix other Rx buffer leaks pointed out by an LLM during review. ==================== Link: https://patch.msgid.link/20261027234940.1267225-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tpacket_fill_skb() adds the full non-linear payload length to skb->truesize and sk_wmem_alloc before checking MAX_SKB_FRAGS. With PACKET_VNET_HDR, userspace can submit a ring-sized frame even when it greatly exceeds the device MTU. A near-INT_MAX frame can saturate sk_wmem_alloc before the fragment loop rejects it. A subsequent refcount_add(0x40000001) can temporarily turn REFCOUNT_SATURATED into 1. A concurrent TX completion can then drop that apparent last reference and free the still-live packet socket before refcount_warn_saturate() restores the counter. Check that the remaining payload fits in MAX_SKB_FRAGS pages before accounting it. Include the initial page offset in the calculation, and move the existing -EFAULT handling out of the fragment loop. This preserves the accepted packet sizes and error code while preventing an invalid frame from injecting an oversized byte charge. Fixes: 69e3c75 ("net: TX_RING and packet mmap") Cc: stable@vger.kernel.org Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com> Signed-off-by: Kyle Zeng <kylebot@openai.com> [edumazet: use net_warn_ratelimited() instead of pr_err(), add a Fixes: tag] Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261028181450.2221013-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tcp_gro_receive() excludes empty non-GSO packets with the unsigned len - 1 check, but its GSO branch only checks that gso_size matches the held packet's MSS. A trusted TCP GSO skb can reach GRO again with no payload after TC pedit increases its TCP data offset. If the skb is fully linear, skb_gro_receive() then enters its fragment transfer path with nr_frags == 0. The do-while loop copies skb_frag_t entries backwards beyond both fragment arrays. An unprivileged process using its own user and network namespaces can trigger a KASAN slab-out-of-bounds write and panic through veth, pedit and GRE. More generally, the payload of such a packet can be shrunk to any value, making it inconsistent with its gso_segs, and a GSO packet with gso_segs == 0 contributes no segment to the GRO packet. Do not aggregate GSO packets with gso_segs == 0, and require the payload of GSO packets to be consistent with gso_segs and gso_size, the last segment being allowed to be short. This rejects the empty skb before either TCP merge helper, and covers both IPv4 and IPv6. Fixes: 5eddb24 ("gro: add support of (hw)gro packets to gro stack") Signed-off-by: Kyle Zeng <kylebot@openai.com> [edumazet: check payload against gso_segs, refuse gso_segs == 0] Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261028171350.2205175-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
When mapping a fragment fails, bgmac_dma_tx_add() unwinds with the wrong slots. It passes the failed fragment's slot->dma_addr, which holds the mapping error, to dma_unmap_single() for the head. The fragment loop indexes from ring->end instead of ring->end + 1, so it unmaps the head a second time as a page and leaves the last mapped fragment mapped. None of the affected slots get their dma_addr cleared either, which includes the head slot when mapping the head fails. bgmac_dma_tx_ring_free() unmaps every slot with a non-zero dma_addr, so tearing down the ring unmaps these addresses again. It also frees the skbs of pending TX slots but leaves slot->skb and slot->dma_addr set. The slots survive a down/up cycle, and bgmac_dma_tx_add() only sets slot->skb on the last slot of a packet. If a slot with a stale pointer is later used for the head or a fragment of a scatter/gather packet, bgmac_dma_tx_free() frees the old skb a second time when that slot completes. bgmac_dma_tx_ring_free() also picks dma_unmap_single() or dma_unmap_page() by looking at slot->skb, which is set on the last slot of a packet, while the head was mapped with dma_map_single() and the fragments with skb_frag_dma_map(). In the error path, unmap the head and each mapped fragment from their own slots, and clear dma_addr on every slot the failed packet touched. In bgmac_dma_tx_ring_free(), choose the unmap function by the SOF flag of the descriptor like bgmac_dma_tx_free() does, unmap every slot before freeing any skb, since a packet can wrap around the end of the ring with its skb on the last slot, and clear both fields. This was found through code inspection by an LLM while hitting other bugs on an Asus RT-N16. It did not hit these ones specifically. Fixes: 9cde945 ("bgmac: implement scatter/gather support") Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://patch.msgid.link/20261028164839.28605-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tcp_abort() checks for TCP_CLOSE while only owning the socket lock, then grabs the BH lock before calling tcp_done_with_error(). For a child still sitting in a listener accept queue (which can be reached via SOCK_DESTROY or bpf_sock_destroy()), inet_csk_listen_stop() can run in this window: it only holds the child BH lock, and calls inet_child_forget(), which disconnects, orphans and destroys the child. tcp_abort() then calls tcp_done_with_error() -> tcp_done(), which sees SOCK_DEAD and calls inet_csk_destroy_sock() a second time, leading to a double sock_put() and a use-after-free. Recheck TCP_CLOSE after acquiring the BH lock, unless we just closed a listener ourselves, in which case tcp_done_with_error() must still run to report the error. Note that the WARN_ON(sock_owned_by_user(child)) in inet_csk_listen_stop() can still trigger in this window. Fixes: bac76cf ("tcp: fix forever orphan socket caused by tcp_abort") Signed-off-by: Kyle Zeng <kylebot@openai.com> [edumazet: recheck TCP_CLOSE under the BH lock instead of moving the test, smaller diff] Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20261028160847.2170959-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
SCTP mediation of bind is not being checked correctly because bind permission needs to be checked in the sctp_bind_connect() hook. Require for bind permissions when CTP_SET_PEER_PRIMARY_ADDR, and SCTP_SOCKOPT_BINDX_ADD are asked for. The peer initialized ASCONF cases (SCTP_PARAM_ADD_IP and SCTP_PARAM_SET_PRIMARY) are processed in softirq context and are not mediated atm. SCTP_PRIMATEY_ADDR, and SCTP_SET_PEER_PRIMARY_ADDR only select among address already in the association. Fixes: 56974a6 ("apparmor: add base infastructure for socket mediation") Signed-off-by: John Johansen <john.johansen@canonical.com>
Commit efb8763 ("net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes") widened size_needed and the MSS multiplication, but tp->reordering + 1 is still evaluated as u32. RTAX_REORDERING accepts an unrestricted u32, and tcp_init_metrics() can install U32_MAX. In that case the extra-data requirement becomes zero. A write queue with probe_size - 1 data bytes and a FIN satisfies the sequence-space check. The coalescing walk can pass the queue head to tcp_skb_can_collapse(), and tcp_clone_payload() can produce an skb whose advertised payload exceeds the data in its fragments. Local delivery followed by TCP_ZEROCOPY_RECEIVE can then walk beyond the fragment array. KASAN reports a slab-out-of-bounds read in can_map_frag(). Cast reordering before incrementing it so the arithmetic handles the entire u32 metric range. For U32_MAX, the required size exceeds the 32-bit queue and window limits, so the existing checks skip the probe. The calculation is unchanged for all other reordering values. Fixes: efb8763 ("net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes") Cc: stable@vger.kernel.org Cc: Wyatt Feng <bronzed_45_vested@icloud.com> Cc: Ren Wei <n05ec@lzu.edu.cn> Signed-off-by: Kyle Zeng <kylebot@openai.com> Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev> Link: https://patch.msgid.link/20261028160226.2170244-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
IPv4 passive opens on a dual-stack listener go through tcp_v4_syn_recv_sock() with tcp_v6_mapped_child_init() as the optional initializer. The callback currently runs after the output route lookup. If that lookup fails, tcp_done() destroys a clone whose pinet6 and ipv6_fl_list still refer to the listener's state. With the flowlabel list head in inet_sock, fl6_free_socklist() walks the clone's list and RCU-frees its nodes without unlinking them from the live listener. Subsequent flowlabel operations can use or free the nodes again. Commit 858d2a4 ("tcp: fix potential race in tcp_v6_syn_recv_sock()") moved the initializer before ehash insertion, but did not cover this error path. Invoke the existing initializer after the IPv4 fields it consumes have been set, but before route lookup can fail. It needs neither the destination nor sk_setup_caps(), and all later disposal paths remain covered. Fixes: 1c17f43 ("ipv6: Move ipv6_fl_list from ipv6_pinfo to inet_sock.") Signed-off-by: Kyle Zeng <kylebot@openai.com> Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20261028154101.2153360-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
eth_type_trans() assumes ETH_HLEN bytes are present in skb->head. NIC drivers always provide this, and they should keep using the fast version. Devices looping skbs from their transmit path back to their receive path get skbs built by the stack instead. Their link-layer header might have been popped by tc actions (act_vlan pop_eth, act_ife decode) or OVS actions (pop_eth + pop_mpls / pop_nsh), leaving fewer than ETH_HLEN bytes in the linear part. eth_type_trans() then hits the BUG() in __skb_pull(). Add eth_type_trans_careful(), which first pulls the Ethernet header, and returns a drop reason on failure, so that the few devices exposed to this can drop such packets. Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Aaron Conole <aconole@redhat.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Tested-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261028122703.2093730-2-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tc egress actions can leave an skb with fewer than ETH_HLEN bytes in
its linear part. loopback_xmit() then crashes in eth_type_trans():
tc qdisc add dev lo clsact
tc filter add dev lo egress matchall action vlan pop_eth
# AF_PACKET SOCK_RAW: eth / eth / 8192 bytes of payload
kernel BUG at include/linux/skbuff.h:2839!
RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163)
Call Trace:
loopback_xmit (drivers/net/loopback.c:87)
dev_hard_start_xmit (include/linux/netdevice.h:5455 include/linux/netdevice.h:5464 net/core/dev.c:4057 net/core/dev.c:4073)
__dev_queue_xmit (net/core/dev.c:5066)
packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189)
The same happens with "action ife decode" on lo egress.
Use eth_type_trans_careful(), and drop the packet if the Ethernet
header can not be pulled.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Vega <vega@nebusec.ai>
Link: https://lore.kernel.org/netdev/20261005052249.1914367-2-weir@nebusec.ai/
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20261028122703.2093730-3-edumazet@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
A tc egress BPF program can push a tiny link-layer header with bpf_skb_change_head() on an skb whose head is almost empty, then redirect it to an Ethernet device ingress. __bpf_redirect_common() only checks mac_header < network_header, and __dev_forward_skb2() crashes in eth_type_trans(): tc filter add dev lo egress pref 1 matchall action vlan pop_eth continue tc filter add dev lo egress pref 2 bpf da obj prog.o # prog: bpf_skb_change_head(skb, 1, 0); # return bpf_redirect(veth1_ifindex, BPF_F_INGRESS); # AF_PACKET SOCK_RAW on lo: eth / eth / 8192 bytes of payload kernel BUG at include/linux/skbuff.h:2839! RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163) Call Trace: __dev_forward_skb2 (net/core/dev.c:2507) dev_forward_skb_nomtu (net/core/dev.c:2546) __dev_queue_xmit (net/core/dev.c:4738 net/core/dev.c:4998) packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189) Use eth_type_trans_careful(), and drop the packet if the Ethernet header can not be pulled. This also covers other dev_forward_skb() users (veth, macvlan, ipvlan, netdevsim, l2tp_eth). Update the empty_skb BPF selftest: at lwt_xmit, BPF_PROG_TEST_RUN strips the Ethernet header, so the "veth ETH_HLEN+1" packet is a 1-byte skb. Redirecting it to veth ingress used to read the Ethernet header past skb->tail and deliver a 1-byte frame; it is now dropped with NET_RX_DROP, as veth_xmit() already does at egress. Fixes: 3a0af8f ("bpf: BPF for lightweight tunnel infrastructure") Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Tested-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261028122703.2093730-4-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
OVS actions like pop_eth followed by pop_mpls(ETH_P_TEB) or pop_nsh can expose an inner Ethernet header which is not in the linear part of the skb. Output to an internal port then crashes in eth_type_trans(): flow: in_port(0),eth(),eth_type(0x8847),mpls(lse=0x00010140) actions: pop_eth,pop_mpls(0x6558),0 # AF_PACKET SOCK_RAW on dp0: eth / mpls / eth / 4096 bytes of payload kernel BUG at include/linux/skbuff.h:2839! RIP: 0010:eth_type_trans (include/linux/etherdevice.h:635 net/ethernet/eth.c:163) Call Trace: internal_dev_recv (net/openvswitch/vport-internal_dev.c:202) openvswitch do_execute_actions (net/openvswitch/actions.c:1296) openvswitch ovs_execute_actions (net/openvswitch/actions.c:1606) openvswitch ovs_dp_process_packet (net/openvswitch/datapath.c:310) openvswitch ovs_vport_receive (net/openvswitch/vport.c:448) openvswitch internal_dev_xmit (net/openvswitch/vport-internal_dev.c:42) openvswitch dev_hard_start_xmit (include/linux/netdevice.h:5455 include/linux/netdevice.h:5464 net/core/dev.c:4057 net/core/dev.c:4073) __dev_queue_xmit (net/core/dev.c:5066) packet_sendmsg (net/packet/af_packet.c:3157 net/packet/af_packet.c:3189) Use eth_type_trans_careful(), and drop the packet if the Ethernet header can not be pulled. This covers all OVS actions at the consumer, instead of fixing each producer. Fixes: b2d0f5d ("openvswitch: enable NSH support") Fixes: f66b53f ("openvswitch: New MPLS actions for layer 2 tunnelling") Signed-off-by: Eric Dumazet <edumazet@kernel.org> Reviewed-by: Aaron Conole <aconole@redhat.com> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Tested-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20261028122703.2093730-5-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
The issue: tcf_ife_decode() unconditionally calls eth_type_trans(), which pulls ETH_HLEN. On egress this consumes the inner Ethernet header, and the device receives an skb whose data points to the L3 header: - loopback_xmit() parses L3 data as Ethernet: the "ethertype" comes from the inner IPv4 source address, and the decapsulated packet is dropped or misparsed. - a real NIC transmits the frame without its Ethernet header. (The __skb_pull() BUG this used to trigger in loopback_xmit() when the remaining linear area was short is handled by "loopback: use eth_type_trans_careful()".) The Fix: Parse the inner Ethernet header with eth_type_trans() in both directions, then restore the egress data position and MAC length. On ingress the existing behavior is unchanged. On egress, push the inner Ethernet header back after parsing so the xmit path sees the original frame and later actions see a consistent network header. Conditions to recreate the bug: - egress tc filter on lo: action ife decode pipe; - AF_PACKET SOCK_RAW frame: outer Ethernet with ETH_P_IFE, IFE metadata, inner Ethernet + a valid IPv4 ICMP echo request to a local address; - before this patch, no echo is received; after it, the echo is delivered and answered. Fixes: ef6980b ("introduce IFE action") Cc: stable@vger.kernel.org Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> [edumazet: reworded changelog, the crash is now handled in loopback] Signed-off-by: Eric Dumazet <edumazet@kernel.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261028122703.2093730-6-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
edera/6.18-lts proposes a backport of each pull request merged into edera/mainline, driven by its own workflows. Add a workflow here whose only job is to dispatch that, skipping pull requests labelled no-backport and the nightly's rebase pull requests.
xen-pciback seizes a hidden device in an fs_initcall, but the Xen IOMMU registered from a device_initcall. Registering probes every PCI device that already exists, so a hidden device was found with a driver bound and the IOMMU core warned about a late probe at driver bind. Register from subsys_initcall_sync instead, so the IOMMU is in place before pciback binds anything. Signed-off-by: Alex Zenla <alex@edera.dev>
Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
All of the extra memory Linux reserves at boot goes to the mapping pool, so dom0's balloon starts empty. Growing dom0 at runtime then means memory hotplug, which places the new range at the first free physical address: on PVH that is the host's own map, where nothing guarantees the range is not a device's MMIO window. Keep the part of the extra memory dom0 may grow into on the balloon instead. Xen's ceiling for dom0 (dom0_mem=...,max:) sizes that part, so a host booted without a max: keeps today's behaviour. Every region gives up the same fraction, which spreads the growth over the NUMA nodes on PVH and leaves each node's mapping pool its share, and the last memory section stays with the pool so that early grant mappings never fall back to holes in the physical map. Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
A request that does not fit in its ring sleeps in io_wait_event_killable() until the backend frees space, but the event handler wakes the ring with wake_up_interruptible(), which only wakes TASK_INTERRUPTIBLE sleepers. A TASK_KILLABLE waiter therefore sleeps until it is killed, which hangs a guest that has enough large requests in flight to fill a ring. Wake the ring with wake_up() so killable waiters see the freed space. Fixes: 9523fea ("net/9p: Switch to wait_event_killable()") Signed-off-by: Alex Zenla <alex@edera.dev>
The frontend's resume handler only warned that suspend and resume are unsupported. After a restore its rings, grant references and event channels are gone, yet the mounted client kept writing requests into them, so every request on the mount hung. The next InitWait from the backend then allocated a second frontend instance for the same device, which no client used. On resume, collect any replies the backend left in the rings, free the rings, fail the requests that are still unanswered with -EIO, and publish Initialising so that a backend which still serves the old rings starts over. When the backend reaches InitWait, allocate and publish new rings for the existing frontend, keeping its clients. Requests that arrive while the frontend is not connected wait until it is, and a rw_semaphore keeps them off the rings while a resume replaces them. Signed-off-by: Alex Zenla <alex@edera.dev>
A forked, restored or imported domain resumes against a new backend whose fid table is empty, while the guest's 9P clients still hold the fids of the session they were suspended with. With the transport reconnected every request on those fids still fails, so even an idle mount comes back unusable. When the backend advertises feature-session-transfer, wait at suspend for the requests in flight to be answered, then ask the backend for its fid table with Tsession_save and keep the pages in guest memory, where they survive into whatever domain the guest resumes in. Once a restored frontend's new backend connects, replay the pages with Tsession_restore before any request can use the rings. The pages are opaque to the frontend; the backend validates every entry as it would a walk or open. Signed-off-by: Alex Zenla <alex@edera.dev>
The toolstack has to know whether a guest can carry its 9P session into a new backend before it exports the domain, because a guest that cannot comes back with every open file on its mounts unusable. Until now only the backend advertised the feature, and the frontend's support was invisible from dom0. Publish feature-session-transfer = 1 in the frontend's own xenstore directory, next to version and num-rings. Signed-off-by: Alex Zenla <alex@edera.dev>
arch/x86/xen/enlighten.c includes xen/interface/memory.h for XENMEM_maximum_reservation, but memory.h uses xen_ulong_t, domid_t and GUEST_HANDLE without including where they are defined, xen/interface/xen.h. Other configurations reach those through an earlier include. The zone-tiny configuration does not, and fails to build with CONFIG_WERROR=y: include/xen/interface/physdev.h:41:5: error: unknown type name 'xen_ulong_t' Include xen/interface/xen.h first, as arch/arm/xen/enlighten.c does. Signed-off-by: Alex Zenla <alex@edera.dev>
A node whose pool is short called fill_list() even when other nodes still held free pages. fill_list() takes new address space from iomem_resource, which on a PVH dom0 can overlap MMIO that Xen has identity mapped. A later grant map onto such a gfn makes Xen refuse the p2m change and crash dom0. Carve a new region only when every node's pool is short, and otherwise take pages from the preferred node first, then the others. Return pages to the pool of their own node when the PV p2m allocation fails.
…ode variant Borrowing across nodes made xen_alloc_unpopulated_pages_node() best effort, so a caller that asked for a node could get pages of another. The node variant now takes pages only from the requested node's pool and fails with -ENOMEM when it is short. It no longer carves a region. xen_alloc_unpopulated_pages() has no node requirement: it prefers the local pool, borrows from other nodes, and carves a region only when every pool is short. xenbus falls back to it when the node's pool is short, and gnttab_alloc_pages_node() uses it for NUMA_NO_NODE.
GitHub starts no workflow for a review of a pull request it cannot compute a merge ref for, and a rebase often conflicts with the tree it replaces: approving #48 started nothing, and it had to be landed by hand. The land workflow can now also be run with a pull request number. It then reads the head, branch and base from the pull request, requires the same rebase/edera-mainline/... branch into edera/mainline, and lands on the most recent approval of the current head from a reviewer whose latest review is still an approval. Everything after that, the write-access check, the tip check, the backup and the leased push, is unchanged.
When a backport pull request merges into edera/6.18-lts, delete its branch and retry the mainline pull requests waiting for it. A backport/edera-6.18-lts/pr-<N> branch is the automation's own and is of no use once its pull request has merged, but delete_branch_on_merge stays off so feature branches survive, and the merged ones pile up. It is deleted only if it still points at the commit that merged. The retry was meant to happen already, from lts-backport-merged.yml on edera/6.18-lts, but that has never run: pull_request_target always takes the workflow from the default branch. This copy of that path lives on edera/mainline and runs edera/6.18-lts's retry-backports.sh.
edera/6.18-lts audits itself for Edera commits from edera/mainline that it lacks (kernel-nightly.yml with audit=true), but scheduled workflows run only from the default branch. Add a workflow here whose only job is to dispatch that audit every Monday.
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>
3 of 4 tasks
Author
|
Superseded by #86. |
edera-rebase-app
Bot
deleted the
rebase/edera-mainline/20261103-6990bf0bee64-6628e7d4c6b2
branch
November 4, 2026 05:17
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(6990bf0bee64) ontomaster(6628e7d4c6b2), 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/mainlinerather than merging into it. Approve the pull request to land it; the land workflow force-pushesedera/mainlineto the approved head, pinned to6990bf0bee64, 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).
6990bf0bee64c2409fc72c46864c07de0c7d6628e7d4c6b2Commits whose hunk context moved (own +/- lines identical)
ea62ac9f1b0f iommu/xen: Add Xen PV-IOMMU driver→3d17f52db513bd1c0dba57c3 sysctl: wire up PaX softmode setting→692285d6572b849ed61740ea use maximum supported mmap rnd entropy by default→c1bae0d26b9bDrift (changed lines: upstream delta vs. actual change)
Claude's report
Summary
edera/mainline(6990bf0bee64) rebased onto torvalds master6628e7d4c6b2(v7.2-rc5-41402-g6628e7d4c6b2) from the old base864c07de0c7d(v7.2-rc5-26646-g864c07de0c7d): 13964 upstream commits (merge window). All 105 downstream commits were replayed in order ontorebase-result(new tipc2409fc72c46). Two conflicts were resolved, both in OpenPaX commits, both by moving the downstream hunk to where upstream moved the surrounding code. No commit was dropped or went empty, and no build fixes were needed. x86_64 and arm64vmlinuxboth build.verify-upstream-rebase.shpasses the base, linearity and commit-count checks. It fails the drift check, and that is expected: the only drift is thekernel/sysctl.crelocation from conflict 1, explained below. One upstream change reaches the Hyper-V-nested-on-Xen feature without touching its lines. It is raised under Needs a decision.Needs a decision
228e21764b38 Drivers: hv: Run VMBus kexec cleanup from syscore shutdownnow runs the VMBus kexec teardown on a Xen PV dom0 nested under Hyper-V. Before this change, on x86hv_kexec_handler()was only reached throughhv_machine_shutdown(). That hook is installed byms_hyperv_init_platform()and so only exists whenx86_hyper_type == X86_HYPER_MS_HYPERV. The nested dom0 isXEN_PV, so it never ran the handler. Upstream now calls the handler fromhv_vmbus_syscore's.shutdowncallback, whichhv_acpi_init()registers. On the nested path that registration happens becausehv_is_hyperv_initialized()returns true whenhyperv_nested_on_xenis set. On a kexec from that dom0, the kernel will now callvmbus_initiate_unload(false)and thencpuhp_remove_state(hyperv_cpuhp_online). That sends CHANNELMSG_UNLOAD and waits for the reply over the Xen VIRQ bridge, then tears down the SynIC on each CPU through Xen-proxied MSRs. The handler does not callhyperv_remove_xen_vmbus_irq().hv_vmbus_syscore_shutdown()returns early whenhyperv_nested_on_xen), or the downstream VMBus-via-Xen-VIRQ commit should add the bridge teardown.syscore_shutdown()runs at all) should decide.Conflicts resolved
bd1c0dba57c3 sysctl: wire up PaX softmode setting→692285d6572b. File:kernel/sysctl.c. Collided with443bea2f71c5 sysctl: consolidate CONFIG_SYSCTL into a single block in kernel/sysctl.c(withacd19f2c56f2before it). Upstream movedsysctl_subsys_table[]andsysctl_init_bases()up into the first#ifdef CONFIG_SYSCTLblock. It left only aproc_do_static_key()stub in the#elsebranch, where the downstream hunk used to apply. I kept upstream's layout exactly and the#elsebranch as upstream has it. I re-applied the downstream hunks unchanged at the table's new location: theCONFIG_OPENPAX_SOFTMODEpax_table[]just beforesysctl_subsys_table[], and theregister_sysctl_init("kernel/pax", pax_table)call insysctl_init_bases(). The commit's own +/- lines are identical to the original. It is still insideCONFIG_SYSCTL, as before. This relocation is the entire drift the checker reports.849ed61740ea use maximum supported mmap rnd entropy by default→c1bae0d26b9b. File:arch/Kconfig. Collided with8cdae75cebe0 arch/Kconfig: fix dead conditions by removing dead options. Upstream deletedARCH_MMAP_RND_BITS_DEFAULTandARCH_MMAP_RND_COMPAT_BITS_DEFAULTand theirdefault X if Xlines. Those lines were dead: an int symbol used as a condition is always false, and no arch selected them. I kept upstream's removal and applied the downstream change (default ..._MIN→default ..._MAXfor both symbols). Behaviour matches the old tree, because the removed line never applied. The checker reports this commit as context-only, with no drift.Dropped downstream commits
None.
Build fixes
None.
Upstream commits that meet the series
65 upstream commits touch a file the series also touches (23 shared files). Fixes (Fixes:/stable tags; there are no CVE references) and my reading of the final tree:
278b2abf660a init/bootconfig: pass init arguments in documented order(Fixes, Cc stable). Intact ininit/main.c: extra init args are parsed beforeafter_dashes. The downstream changes to this file (pax_softmode, near the top) are far from the hunk.51e766bcd35e init/main: fix false-positive kernel panic on environment variable overwrite(Fixes). Intact: thestrncmpbreak comes before theMAX_INIT_ENVSpanic check.b82ed0e3a1da init/main: fix off-by-one in argv_init cleanup(Fixes). Intact: both loops arei <= MAX_INIT_ARGS.0f4a9e682f7f xattr: always invoke cap_convert_nscap() for security.capability writes(Fixes). Intact invfs_setxattr(). The downstreampax_getxattr()is a read path through__vfs_getxattr()and is not affected.1c8f6308e557 iommu/dma: Catch scatterlist length overflows(Fixes). Intact: bothoverflows_type()andcheck_add_overflow()are iniommu_dma_map_sg(). The downstream change todma-iommu.c(skip PCI window reservation under the Xen PV-IOMMU) is iniova_reserve_iommu_regions().dd57772e36f7 Drivers: hv: vmbus: Check ACPI companion before use(Fixes). Intact invmbus_acpi_add(). The downstream VMBus-via-Xen-VIRQ hunks are invmbus_bus_init()andvmbus_exit().228e21764b38 Drivers: hv: Run VMBus kexec cleanup from syscore shutdown(Fixes). Applied intact. It reaches the nested-on-Xen path; see Needs a decision.7135a05838e8 mm/vma: avoid spurious write locks when mm->mm_lock_seq overflows(Fixes, Cc stable). Intact. The downstreampax_flagsfield inmm_structand thetools/testing/vmastubs are separate hunks.68cb098eadda mm/vma: avoid broken uffd merge on mremap(Fixes, Cc stable). The test stub is intact next to the downstreamget_random_u32()stub.799203afd298,e3e7a85730a4,681f3b68f435,5728d3523f12: documentation-only changes inkernel-parameters.txt. Intact, with the downstreampax_softmode=entry alongside.Non-fix commits I checked for semantic effect on the series:
6eecb67b69af xen/grant-table: stop setting PG_private on pages for grant mapping: the downstreamgnttab_alloc_pages_node()still goes throughgnttab_pages_set_private(), and nothing downstream testsPagePrivate()on grant pages (greppeddrivers/xen,arch/x86/xen,include/xen). No effect.1ae140d0f272 iommu: Make iommu-dma helpers private: the Xen PV-IOMMU uses neitheriommu_get_dma_domain()noriommu_deferred_attach(). No effect.aa416fa911ad iommu: Finalize deferred attachments when mapping MSI pages(not in a shared file) is also a no-op for it: the driver has nois_attach_deferred, and it reserves MSI asIOMMU_RESV_MSI, notSW_MSI.2690d4156b51 iommu/hyperv: Add para-virtualized IOMMU support for Hyper-V guest: only hooked fromhyperv_init(), which the nested-on-Xen path (hyperv_init_nested_on_xen()) does not call. Its new Kconfig entry is whyea62ac9f1b0f iommu/xen: Add Xen PV-IOMMU driverreplays with moved context.118bdac10546 Drivers: hv: Add logical device ID registry for vPCI devices: a software rhashtable with no hypercall. It does not interact with the nested-on-Xenpci-hyperv.cchanges.d0ec95a8a4e7 hv_netvsc: Advertise the SR-IOV capability for CoCo VMs: SR-IOV was already advertised on the nested path, becausehv_is_isolation_supported()is false there. The downstream DMA-map hunks are untouched.242bac52294e,d08ab285b096,2bfbb09b505c(sysctl handler rework):pax_tableis a singleintwithproc_dointvec. No effect.9cae38dc11daand the other mm/vma refactors:map_deny_write_exec()(which the OpenPaX MPROTECT hunk extends) still has the same two callers, inmm/mprotect.candmm/vma.c.Full list:
Builds
kernel-build.sh x86_64, Edera host.config from edera-dev/linux-kernel-oci@6865daedf8cc; every forced option survivedolddefconfig).kernel-build.sh arm64, defconfig plus the common downstream options).