Skip to content

[rocky9_8] History Rebuild through kernel-5.14.0-687.30.1.el9_8 - #1480

Open
PlaidCat wants to merge 12 commits into
rocky9_8from
rocky9_8_rebuild
Open

[rocky9_8] History Rebuild through kernel-5.14.0-687.30.1.el9_8#1480
PlaidCat wants to merge 12 commits into
rocky9_8from
rocky9_8_rebuild

Conversation

@PlaidCat

@PlaidCat PlaidCat commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This is an automated kernel history rebuild using cron and internal tooling. It follows the same process used for previous history rebuilds:

  • Download all unprocessed src.rpm packages
  • For each src.rpm:
    • Identify all commits in the changelog up to the last known tag (5.14.0-687)
    • Replay commits in chronological order (oldest to newest in the changelog) using git cherry-pick
    • Replace the code in the branch with the output of rpmbuild -bp for the corresponding src.rpm
    • Tag the rebuild branch

JIRA Tickets

Rebuild Splat Inspection

kernel-5.14.0-687.30.1.el9_8

$ cat ciq/ciq_backports/kernel-5.14.0-687.30.1.el9_8/rebuild.details.txt
Rebuild_History BUILDABLE
Rebuilding Kernel from rpm changelog with Fuzz Limit: 87.50%
Number of commits in upstream range v5.14~1..kernel-mainline: 394115
Number of commits in rpm: 17
Number of commits matched with upstream: 11 (64.71%)
Number of commits in upstream but not in rpm: 394104
Number of commits NOT found in upstream: 6 (35.29%)

Rebuilding Kernel on Branch rocky9_8_rebuild_kernel-5.14.0-687.30.1.el9_8 for kernel-5.14.0-687.30.1.el9_8
Clean Cherry Picks: 10 (90.91%)
Empty Cherry Picks: 1 (9.09%)
_______________________________

__EMPTY COMMITS__________________________
ef057cbf825e03b63f6edf5980f96abf3c53089d KVM: x86/mmu: Ensure hugepage is in by slot before checking max mapping level

__CHANGES NOT IN UPSTREAM________________
Replace sbat with Rocky Linux sbat
Change bug tracker URL
Ensure appended release in sbat is removed'
KVM: nVMX: Hide shadow VMCS right after VMCLEAR
KVM: x86: Check for invalid/obsolete root *after* making MMU pages available
KVM: nVMX: Put vmcs12 pages if nested VM-Enter fails due to invalid guest state

BUILD

$ grep -E -B 5 -A 5 "\[TIMER\]|^Starting Build" $(ls -t kbuild* | head -n1)
/mnt/code/kernel-src-tree-build
Running make mrproper...
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config include/generated
[TIMER]{MRPROPER}: 5s
x86_64 architecture detected, copying config
'configs/kernel-x86_64-rhel.config' -> '.config'
Setting Local Version for build
CONFIG_LOCALVERSION="-rocky9_8_rebuild-f673b620c033"
Making olddefconfig
--
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
Starting Build
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
--
  BTF [M] sound/x86/snd-hdmi-lpe-audio.ko
  BTF [M] sound/virtio/virtio_snd.ko
  BTF [M] sound/usb/snd-usb-audio.ko
  BTF [M] sound/usb/usx2y/snd-usb-usx2y.ko
  BTF [M] sound/xen/snd_xen_front.ko
[TIMER]{BUILD}: 1573s
Making Modules
  INSTALL /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/arch/x86/crypto/blake2s-x86_64.ko
  INSTALL /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/arch/x86/crypto/blowfish-x86_64.ko
  INSTALL /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko
  INSTALL /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/arch/x86/crypto/camellia-aesni-avx2.ko
--
  SIGN    /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/sound/virtio/virtio_snd.ko
  SIGN    /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/sound/usb/usx2y/snd-usb-us144mkii.ko
  SIGN    /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/sound/usb/usx2y/snd-usb-usx2y.ko
  SIGN    /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033/kernel/sound/usb/snd-usb-audio.ko
  DEPMOD  /lib/modules/5.14.0-rocky9_8_rebuild-f673b620c033
[TIMER]{MODULES}: 9s
Making Install
sh ./arch/x86/boot/install.sh 5.14.0-rocky9_8_rebuild-f673b620c033 \
	arch/x86/boot/bzImage System.map "/boot"
[TIMER]{INSTALL}: 24s
Checking kABI
kABI check passed
Setting Default Kernel to /boot/vmlinuz-5.14.0-rocky9_8_rebuild-f673b620c033 and Index to 2
Hopefully Grub2.0 took everything ... rebooting after time metrices
[TIMER]{MRPROPER}: 5s
[TIMER]{BUILD}: 1573s
[TIMER]{MODULES}: 9s
[TIMER]{INSTALL}: 24s
[TIMER]{TOTAL} 1616s
Rebooting in 10 seconds

KSelfTests

$ get_kselftest_diff.sh
kselftest.5.14.0-rocky9_8_rebuild-770864b16f94.log
311
kselftest.5.14.0-rocky9_8_rebuild-6355f119d2a5.log
311
kselftest.5.14.0-rocky9_8_rebuild-921aa25079a5.log
311
kselftest.5.14.0-rocky9_8_rebuild-f673b620c033.log
311
Before: kselftest.5.14.0-rocky9_8_rebuild-921aa25079a5.log
After: kselftest.5.14.0-rocky9_8_rebuild-f673b620c033.log
Diff:
No differences found.

PlaidCat added 12 commits July 27, 2026 12:30
jira KERNEL-1385
cve CVE-2026-53059
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Junrui Luo <moonafterrain@outlook.com>
commit c20e36b

The local variable region_count in create_log_context() is declared as
unsigned int (32-bit), but dm_sector_div_up() returns sector_t (64-bit).
When a device-mapper target has a sufficiently large ti->len with a small
region_size, the division result can exceed UINT_MAX. The truncated
value is then used to calculate bitset_size, causing clean_bits,
sync_bits, and recovering_bits to be allocated far smaller than needed
for the actual number of regions.

Subsequent log operations (log_set_bit, log_clear_bit, log_test_bit) use
region indices derived from the full untruncated region space, causing
out-of-bounds writes to kernel heap memory allocated by vmalloc.

This can be reproduced by creating a mirror target whose region_count
overflows 32 bits:

  dmsetup create bigzero --table '0 8589934594 zero'
  dmsetup create mymirror --table '0 8589934594 mirror \
    core 2 2 nosync 2 /dev/mapper/bigzero 0 \
    /dev/mapper/bigzero 0'

The status output confirms the truncation (sync_count=1 instead of
4294967297, because 0x100000001 was truncated to 1):

  $ dmsetup status mymirror
  0 8589934594 mirror 2 254:1 254:1 1/4294967297 ...

This leads to a kernel crash in core_in_sync:

  BUG: scheduling while atomic: (udev-worker)/9150/0x00000000
  RIP: 0010:core_in_sync+0x14/0x30 [dm_log]
  CR2: 0000000000000008
  Fixing recursive fault but reboot is needed!

Fix by widening the local region_count to sector_t and adding an
explicit overflow check before the value is assigned to lc->region_count.

Fixes: 1da177e ("Linux-2.6.12-rc2")
	Reported-by: Yuhao Jiang <danisjiang@gmail.com>
	Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
	Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
(cherry picked from commit c20e36b)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-52976
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Shuicheng Lin <shuicheng.lin@intel.com>
commit 37c831f

Two error handling issues exist in xe_exec_queue_create_ioctl():

1. When xe_hw_engine_group_add_exec_queue() fails, the error path jumps
   to put_exec_queue which skips xe_exec_queue_kill(). If the VM is in
   preempt fence mode, xe_vm_add_compute_exec_queue() has already added
   the queue to the VM's compute exec queue list. Skipping the kill
   leaves the queue on that list, leading to a dangling pointer after
   the queue is freed.

2. When xa_alloc() fails after xe_hw_engine_group_add_exec_queue() has
   succeeded, the error path does not call
   xe_hw_engine_group_del_exec_queue() to remove the queue from the hw
   engine group list. The queue is then freed while still linked into
   the hw engine group, causing a use-after-free.

Fix both by:
- Changing the xe_hw_engine_group_add_exec_queue() failure path to jump
  to kill_exec_queue so that xe_exec_queue_kill() properly removes the
  queue from the VM's compute list.
- Adding a del_hw_engine_group label before kill_exec_queue for the
  xa_alloc() failure path, which removes the queue from the hw engine
  group before proceeding with the rest of the cleanup.

Fixes: 7970cb3 ("'drm/xe/hw_engine_group: Register hw engine group's exec queues")
	Cc: Francois Dugast <francois.dugast@intel.com>
	Cc: Matthew Brost <matthew.brost@intel.com>
	Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Assisted-by: Claude:claude-opus-4.6
	Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260408020647.3397933-1-shuicheng.lin@intel.com
	Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit 37c831f)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-53006
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Eric Dumazet <edumazet@google.com>
commit f996edd

Caching saddr and daddr before pskb_pull() is problematic
since skb->head can change.

Remove these temporary variables:

- We only access &ipv6_hdr(skb)->saddr and &ipv6_hdr(skb)->daddr
  when net_dbg_ratelimited() is called in the slow path.

- Avoid potential future misuse after pskb_pull() call.

Fixes: 4b3418f ("ipv6: icmp: include addresses in debug messages")
	Signed-off-by: Eric Dumazet <edumazet@google.com>
	Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>
	Reviewed-by: Joe Damato <joe@dama.to>
	Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260416103505.2380753-1-edumazet@google.com
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit f996edd)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-52950
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Shuicheng Lin <shuicheng.lin@intel.com>
commit a828eb1

When xe_dma_buf_init_obj() fails, the attachment from
dma_buf_dynamic_attach() is not detached. Add dma_buf_detach() before
returning the error. Note: we cannot use goto out_err here because
xe_dma_buf_init_obj() already frees bo on failure, and out_err would
double-free it.

Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs")
	Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4.6
	Reviewed-by: Mattheq Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260408175255.3402838-5-shuicheng.lin@intel.com
	Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit a828eb1)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-52950
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Shuicheng Lin <shuicheng.lin@intel.com>
commit 78a6c5f

When drm_gpuvm_resv_object_alloc() fails, the pre-allocated storage bo
is not freed. Add xe_bo_free(storage) before returning the error.

xe_dma_buf_init_obj() calls xe_bo_init_locked(), which frees the bo on
error. Therefore, xe_dma_buf_init_obj() must also free the bo on its own
error paths. Otherwise, since xe_gem_prime_import() cannot distinguish
whether the failure originated from xe_dma_buf_init_obj() or from
xe_bo_init_locked(), it cannot safely decide whether the bo should be
freed.

Add comments documenting the ownership semantics: on success, ownership
of storage is transferred to the returned drm_gem_object; on failure,
storage is freed before returning.

v2: Add comments to explain the free logic.

Fixes: eb289a5 ("drm/xe: Convert xe_dma_buf.c for exhaustive eviction")
	Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4.6
	Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260408175255.3402838-4-shuicheng.lin@intel.com
	Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
(cherry picked from commit 78a6c5f)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-52950
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Matthew Auld <matthew.auld@intel.com>
commit af1f2ad

There look to be some nasty races here when triggering the
invalidate_mappings hook:

1) We do xe_bo_alloc() followed by the attach, before the actual full bo
   init step in xe_dma_buf_init_obj(). However the bo is visible on the
   attachments list after the attach.  This is bad since exporter driver,
   say amdgpu, can at any time call back into our invalidate_mappings hook,
   with an empty/bogus bo, leading to potential bugs/crashes.

2) Similar to 1) but here we get a UAF, when the invalidate_mappings
   hook is triggered. For example, we get as far as xe_bo_init_locked()
   but this fails in some way. But here the bo will be freed on error, but
   we still have it attached from dma-buf pov, so if the
   invalidate_mappings is now triggered then the bo we access is gone and
   we trigger UAF and more bugs/crashes.

To fix this, move the attach step until after we actually have a fully
set up buffer object. Note that the bo is not published to userspace
until later, so not sure what the comment "Don't publish the bo
until we have a valid attachment", is referring to.

We have at least two different customers reporting hitting a NULL ptr
deref in evict_flags when importing something from amdgpu, followed by
triggering the evict flow. Hit rate is also pretty low, which would
hint at some kind of race, so something like 1) or 2) might explain
this.

v2:
  - Shuffle the order of the ops slightly (no functional change)
  - Improve the comment to better explain the ordering (Matt B)

Assisted-by: Gemini:gemini-3 #debug
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/7903
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/4055
Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs")
	Signed-off-by: Matthew Auld <matthew.auld@intel.com>
	Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
	Cc: Matthew Brost <matthew.brost@intel.com>
	Cc: <stable@vger.kernel.org> # v6.8+
	Reviewed-by: Matthew Brost <matthew.brost@intel.com>
	Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patch.msgid.link/20260508102635.149172-3-matthew.auld@intel.com
(cherry picked from commit af1f2ad)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2026-52950
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Matthew Auld <matthew.auld@intel.com>
commit 4796694

Retry doesn't work here, since bo will be freed on error, leading to
UAF. However, now that we do the alloc & init before the attach, we can
now combine this as one unit and have the init do the alloc for us. This
should make the retry safe.

Reported by Sashiko.

v2: Fix up the error unwind (CI)

Closes: https://sashiko.dev/#/patchset/20260506184332.86743-2-matthew.auld%40intel.com
Fixes: eb289a5 ("drm/xe: Convert xe_dma_buf.c for exhaustive eviction")
	Signed-off-by: Matthew Auld <matthew.auld@intel.com>
	Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
	Cc: Matthew Brost <matthew.brost@intel.com>
	Cc: <stable@vger.kernel.org> # v6.18+
	Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patch.msgid.link/20260508102635.149172-4-matthew.auld@intel.com
(cherry picked from commit 4796694)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
…t_queues

jira KERNEL-1385
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author David Jeffery <djeffery@redhat.com>
commit 7205b58

While a SCSI host is in a recovery state, scsi_mq_requeue_cmd() will not
set the requeue list for a requeued command to be kicked in the future.
The expectation is a call to scsi_run_host_queues() will kick all SCSI
devices once the recovery state is cleared.

However, scsi_run_host_queues() uses shost_for_each_device() which uses
scsi_device_get() and so will ignore devices in a partially removed
state like SDEV_CANCEL. But these devices may also have requeued
requests, leaving their requests stuck from not being kicked and causing
the removal process of the device to hang.

scsi_run_host_queues() needs to run against more devices than the macro
shost_for_each_device() allows. Instead of using the too limiting
scsi_device_get() state checks, only ignore devices in SDEV_DEL state or
when unable to acquire a reference. Attempt to run the queues for all
other devices when scsi_run_host_queues() is called.

Fixes: 8b566ed ("scsi: core: Only kick the requeue list if necessary")
	Signed-off-by: David Jeffery <djeffery@redhat.com>
	Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260515180941.9698-1-djeffery@redhat.com
	Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 7205b58)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
cve CVE-2025-40026
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Sean Christopherson <seanjc@google.com>
commit e750f85

When completing emulation of instruction that generated a userspace exit
for I/O, don't recheck L1 intercepts as KVM has already finished that
phase of instruction execution, i.e. has already committed to allowing L2
to perform I/O.  If L1 (or host userspace) modifies the I/O permission
bitmaps during the exit to userspace,  KVM will treat the access as being
intercepted despite already having emulated the I/O access.

Pivot on EMULTYPE_NO_DECODE to detect that KVM is completing emulation.
Of the three users of EMULTYPE_NO_DECODE, only complete_emulated_io() (the
intended "recipient") can reach the code in question.  gp_interception()'s
use is mutually exclusive with is_guest_mode(), and
complete_emulated_insn_gp() unconditionally pairs EMULTYPE_NO_DECODE with
EMULTYPE_SKIP.

The bad behavior was detected by a syzkaller program that toggles port I/O
interception during the userspace I/O exit, ultimately resulting in a WARN
on vcpu->arch.pio.count being non-zero due to KVM no completing emulation
of the I/O instruction.

  WARNING: CPU: 23 PID: 1083 at arch/x86/kvm/x86.c:8039 emulator_pio_in_out+0x154/0x170 [kvm]
  Modules linked in: kvm_intel kvm irqbypass
  CPU: 23 UID: 1000 PID: 1083 Comm: repro Not tainted 6.16.0-rc5-c1610d2d66b1-next-vm #74 NONE
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:emulator_pio_in_out+0x154/0x170 [kvm]
  PKRU: 55555554
  Call Trace:
   <TASK>
   kvm_fast_pio+0xd6/0x1d0 [kvm]
   vmx_handle_exit+0x149/0x610 [kvm_intel]
   kvm_arch_vcpu_ioctl_run+0xda8/0x1ac0 [kvm]
   kvm_vcpu_ioctl+0x244/0x8c0 [kvm]
   __x64_sys_ioctl+0x8a/0xd0
   do_syscall_64+0x5d/0xc60
   entry_SYSCALL_64_after_hwframe+0x4b/0x53
   </TASK>

	Reported-by: syzbot+cc2032ba16cc2018ca25@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/68790db4.a00a0220.3af5df.0020.GAE@google.com
Fixes: 8a76d7f ("KVM: x86: Add x86 callback for intercept check")
	Cc: stable@vger.kernel.org
	Cc: Jim Mattson <jmattson@google.com>
Link: https://lore.kernel.org/r/20250715190638.1899116-1-seanjc@google.com
	Signed-off-by: Sean Christopherson <seanjc@google.com>
(cherry picked from commit e750f85)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
jira KERNEL-1385
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Sean Christopherson <seanjc@google.com>
commit a629ef9

Add a helper to dedup unmapping the vmcs12 pages.  This will reduce the
amount of churn when a future patch refactors the kvm_vcpu_unmap() API.

No functional change intended.

	Tested-by: Alex Bennée <alex.bennee@linaro.org>
	Signed-off-by: Sean Christopherson <seanjc@google.com>
	Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
	Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20241010182427.1434605-26-seanjc@google.com>
(cherry picked from commit a629ef9)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>
…ng level

jira KERNEL-1385
cve CVE-2026-63807
Rebuild_History Non-Buildable kernel-5.14.0-687.30.1.el9_8
commit-author Sean Christopherson <seanjc@google.com>
commit ef057cb
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
Will be included in final tarball splat. Ref for failed cherry-pick at:
ciq/ciq_backports/kernel-5.14.0-687.30.1.el9_8/ef057cbf.failed

When recovering hugepages in the shadow MMU, verify that the base gfn of
the shadow page is actually contained within the target memslot, *before*
querying the max mapping level given the shadow page's gfn.  Failure to
pre-check the validity of the gfn can lead to an out-of-bounds access to
the slot's lpage_info (which typically manifests as a host #PF because the
lpage_info is vmalloc'd) if the guest creates a hugepage mapping (in its
PTEs) that extends "below" the bounds of a memslot.

When faulting in memory for a guest, and the size of the guest mapping is
greater than KVM's (current) max mapping, then KVM will create a "direct"
shadow page (direct in that there are no gPTEs to shadow, and so the target
gfn is a direct calculation given the base gfn of the shadow page).  The
hugepage recovery flow looks for such direct shadow pages, as forcing 4KiB
mappings when dirty logging generates the guest > host mapping size case.
When the 4KiB restriction is lifted, then KVM can replace the shadow page
with a hugepage.

But if KVM originally used a smaller mapping than the guest because the
range of memory covered by the guest hugepage exceeds the bounds of a
memslot, then KVM will link a direct shadow page with a gfn that is outside
the bounds of the memslot being used to fault in memory.  The rmap entry
added for the leaf mapping is correct and within bounds, but the gfn of the
leaf SPTE's parent shadow page will be out of bounds.

  BUG: unable to handle page fault for address: ffffc90000806ffc
  #PF: supervisor read access in kernel mode
  #PF: error_code(0x0000) - not-present page
  PGD 100000067 P4D 100000067 PUD 1002a7067 PMD 10612f067 PTE 0
  Oops: Oops: 0000 [#1] SMP
  CPU: 13 UID: 1000 PID: 757 Comm: mmu_stress_test Not tainted 7.1.0-rc1-48ce1e26eace-x86_pir_to_irr_comments-vm #341 PREEMPT
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:kvm_mmu_max_mapping_level+0x79/0x2b0 [kvm]
  Call Trace:
   <TASK>
   kvm_mmu_recover_huge_pages+0x21b/0x320 [kvm]
   kvm_set_memslot+0x1ee/0x590 [kvm]
   kvm_set_memory_region.part.0+0x3a1/0x4d0 [kvm]
   kvm_vm_ioctl+0x9bf/0x15d0 [kvm]
   __x64_sys_ioctl+0x8a/0xd0
   do_syscall_64+0xb7/0xbb0
   entry_SYSCALL_64_after_hwframe+0x4b/0x53
  RIP: 0033:0x7f21c0f1a9bf
   </TASK>

Don't bother pre-checking the bounds of the potential hugepage, i.e. don't
check that e.g. sp->gfn + KVM_PAGES_PER_HPAGE(sp->role.level + 1) is also
within the memslot, as the checks performed by kvm_mmu_max_mapping_level()
are a superset of the basic bounds checks.  I.e. pre-checking the full
range would be a dubious micro-optimization.

Fixes: 9eba50f ("KVM: x86/mmu: Consult max mapping level when zapping collapsible SPTEs")
	Cc: stable@vger.kernel.org
	Cc: David Matlack <dmatlack@google.com>
	Cc: James Houghton <jthoughton@google.com>
	Cc: Alexander Bulekov <bkov@amazon.com>
	Cc: Fred Griffoul <fgriffo@amazon.co.uk>
	Cc: Alexander Graf <graf@amazon.de>
	Cc: David Woodhouse <dwmw@amazon.co.uk>
	Cc: Filippo Sironi <sironi@amazon.de>
	Cc: Ivan Orlov <iorlov@amazon.co.uk>
	Signed-off-by: Sean Christopherson <seanjc@google.com>
	Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit ef057cb)
	Signed-off-by: Jonathan Maple <jmaple@ciq.com>

# Conflicts:
#	arch/x86/kvm/mmu/mmu.c
Rebuild_History BUILDABLE
Rebuilding Kernel from rpm changelog with Fuzz Limit: 87.50%
Number of commits in upstream range v5.14~1..kernel-mainline: 394115
Number of commits in rpm: 17
Number of commits matched with upstream: 11 (64.71%)
Number of commits in upstream but not in rpm: 394104
Number of commits NOT found in upstream: 6 (35.29%)

Rebuilding Kernel on Branch rocky9_8_rebuild_kernel-5.14.0-687.30.1.el9_8 for kernel-5.14.0-687.30.1.el9_8
Clean Cherry Picks: 10 (90.91%)
Empty Cherry Picks: 1 (9.09%)
_______________________________

Full Details Located here:
ciq/ciq_backports/kernel-5.14.0-687.30.1.el9_8/rebuild.details.txt

Includes:
* git commit header above
* Empty Commits with upstream SHA
* RPM ChangeLog Entries that could not be matched

Individual Empty Commit failures contained in the same containing directory.
The git message for empty commits will have the path for the failed commit.
File names are the first 8 characters of the upstream SHA
@PlaidCat PlaidCat self-assigned this Jul 27, 2026
@PlaidCat
PlaidCat requested review from a team July 27, 2026 17:18

@bmastbergen bmastbergen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥌

@bmastbergen
bmastbergen requested a review from a team July 27, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants