id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
dc2ff8ba9b9093eb0564407e46e71520b054fc85
Analyze and fix the following issue in the Linux kernel code: xhci: dbc: Fix sysfs ABI Documentation for xhci dbc states
Problem Details: Reading the 'dbc' sysfs file won't return the "stalled" string anymore as "stalled" is no longer considered a DbC state since commit 9044ad57b60b ("xhci: dbc: Fix STALL transfer event handling") in 6.12 kernel. Remove it from sysfs-bus-pci-drivers-xhci_hcd ABI documentation Signed-off-by: Mathias Nym...
```diff diff --git a/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd b/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd index d10e6de3adb2..98a8376a83d2 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd +++ b/Documentation/ABI/testing/sysfs-bus-pci-drivers-xhci_hcd @@ -22,7 +22,7 @@...
a592b28bc82d88e7d3f4ff69ccc1033dd2b0ba86
Analyze and fix the following issue in the Linux kernel code: usb: xhci: fix typo in xhci_set_port_power() comment
Problem Details: Fix a spelling mistake (re-aquire -> re-acquire) in the function header comment. No functional change. Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://patch.msgid.link/20260603091132.1110849-2-mathias.nyman@linux.intel.co...
```diff diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 3830d4123961..b0264bd8577a 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -638,7 +638,7 @@ struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd) /* * xhci_set_port_power() must be called with xhci->loc...
30252e6f71ba974ecf9cd8ce395b73b9900bc378
Analyze and fix the following issue in the Linux kernel code: drm/dumb-buffer: Drop buffer-size limits for now
Problem Details: The size limits break some of the CI tests. So drop them for now. Keep the other overflow tests from commit 5ab62dd3687b ("drm: prevent integer overflows in dumb buffer creation helpers") in place. There is still a pre-existing overflow check for 32-bit type limits in drm_mode_create_dumb() that will ...
```diff diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c index cc99681a9ed0..2156dbe601c9 100644 --- a/drivers/gpu/drm/drm_dumb_buffers.c +++ b/drivers/gpu/drm/drm_dumb_buffers.c @@ -202,13 +202,6 @@ int drm_mode_create_dumb(struct drm_device *dev, if (!args->width || !args->height...
f1a5a0f4c0eab83299201129cffb7907d7dc99c6
Analyze and fix the following issue in the Linux kernel code: irqchip/qcom-pdc: Tighten ioremap clamp to single DRV region size
Problem Details: The QCOM_PDC_SIZE constant (0x30000) was introduced to work around old sm8150 DTs that described a too-small PDC register region, causing the driver to silently expand the ioremap to cover three DRV regions. Now that the preceding DT fixes have corrected all platforms to describe only the APSS DRV regi...
```diff diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 5f0da15b6fc2..0b82306f8dd8 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -21,7 +21,7 @@ #include <linux/types.h> #define PDC_MAX_GPIO_IRQS 256 -#define PDC_DRV_OFFSET 0x10000 +#define PDC_DRV_SIZE 0x10...
6fe450074626eaab3def4b3e8c1819d46d2d682c
Analyze and fix the following issue in the Linux kernel code: irqchip/exynos-combiner: Remove useless spinlock
Problem Details: irq_controller_lock doesn't protect anything, it is a leftover from early development or copy/paste. Remove it completely. Fixes: 96031b31a4b3 ("irqchip/exynos-combiner: Switch to raw_spinlock") Suggested-by: Thomas Gleixner <tglx@kernel.org> Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix...
```diff diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index 03cafcc5c835..d9d408cb4711 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c @@ -24,8 +24,6 @@ #define IRQ_IN_COMBINER 8 -static DEFINE_RAW_SPINLOCK(irq_controller_lock); - struct...
6bb0009862c5f0e89a6e4afc09b499a02576c7da
Analyze and fix the following issue in the Linux kernel code: mm/slab: improve kmem_cache_alloc_bulk
Problem Details: The kmem_cache_alloc_bulk return value is weird. It returns the number of allocated objects, but that must always be 0 or the requested number based on the implementations and the handling in the callers, but that assumption is not actually documented anywhere, which confuses automated review tools. ...
```diff diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 7d449e5202c5..35dd43e3ef43 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c @@ -330,17 +330,20 @@ static int msm_iommu_pagetable_prealloc_allocate(struct msm_mmu *mmu, struct msm_mmu_prealloc ...
9ea06080a680a2aa521795432396d2c27f9bb9f9
Analyze and fix the following issue in the Linux kernel code: x86/virt/seamldr: Shut down the current TDX module
Problem Details: The first step of TDX module updates is shutting down the current TDX module. This step also packs state information that needs to be preserved across updates, called "handoff data". This handoff data is consumed by the updated module and stored internally in the SEAM range and hidden from the kernel. ...
```diff diff --git a/arch/x86/include/asm/tdx_global_metadata.h b/arch/x86/include/asm/tdx_global_metadata.h index 40689c8dc67e..41150d546589 100644 --- a/arch/x86/include/asm/tdx_global_metadata.h +++ b/arch/x86/include/asm/tdx_global_metadata.h @@ -40,6 +40,10 @@ struct tdx_sys_info_td_conf { u64 cpuid_config_value...
dc233762588051bfd28f03e848aa2015c9b1dbd2
Analyze and fix the following issue in the Linux kernel code: KVM: arm64: Don't override FFR save/restore argument
Problem Details: The __sve_save_state() and __sve_restore_state() functions take a parameter describing whether to save/restore the FFR, but both functions silently override this with '1'. This has always been benign (and callers have all passed 'true' since the parameter was introduced), but clearly this is not intent...
```diff diff --git a/arch/arm64/kvm/hyp/fpsimd.S b/arch/arm64/kvm/hyp/fpsimd.S index e950875e31ce..30507c50942e 100644 --- a/arch/arm64/kvm/hyp/fpsimd.S +++ b/arch/arm64/kvm/hyp/fpsimd.S @@ -21,13 +21,11 @@ SYM_FUNC_START(__fpsimd_restore_state) SYM_FUNC_END(__fpsimd_restore_state) SYM_FUNC_START(__sve_restore_stat...
247bd153905085c18ff9006cca1ccb96dfd18e7f
Analyze and fix the following issue in the Linux kernel code: arm64: fpsimd: Fix type mismatch in sme_{save,load}_state()
Problem Details: The sme_save_state() and sme_load_state() functions take a 32-bit int argument that describes whether to save/restore ZT0. Their assembly implementations consume the entire 64-bit register containing this 32-bit value, and will attempt to save/restore ZT0 if any bit of that 64-bit register is non-zero....
```diff diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S index cb08d879cb4d..28af4bcd97a5 100644 --- a/arch/arm64/kernel/entry-fpsimd.S +++ b/arch/arm64/kernel/entry-fpsimd.S @@ -103,13 +103,13 @@ SYM_FUNC_END(sme_set_vq) * Save the ZA and ZT state * * x0 - pointer to buffer for st...
ae24f6b06e90681ec36b9c21c3f5c09618350f5a
Analyze and fix the following issue in the Linux kernel code: arm64: fpsimd: Fix type mismatch in sve_{save,load}_state()
Problem Details: The sve_save_state() and sve_load_state() functions take a 32-bit int argument that describes whether to save/restore the FFR. Their assembly implementations consume the entire 64-bit register containing this 32-bit value, and will attempt to save/restore the FFR if any bit of that 64-bit register is n...
```diff diff --git a/arch/arm64/kernel/entry-fpsimd.S b/arch/arm64/kernel/entry-fpsimd.S index 6325db1a2179..cb08d879cb4d 100644 --- a/arch/arm64/kernel/entry-fpsimd.S +++ b/arch/arm64/kernel/entry-fpsimd.S @@ -38,10 +38,10 @@ SYM_FUNC_END(fpsimd_load_state) * * x0 - pointer to buffer for state * x1 - pointer to ...
149324fc762c2a7acef9c26790566f81f475e51f
Analyze and fix the following issue in the Linux kernel code: Bluetooth: MGMT: Fix backward compatibility with userspace
Problem Details: bluetoothd has a bug with makes it send extra bytes as part of MGMT_OP_ADD_EXT_ADV_DATA which are now being checked to be the exact the expected length, relax this so only when the expected length is greater than the data length to cause an error since that would result in accessing invalid memory, oth...
```diff diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 027b266ccc74..f4aa814a0397 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -9114,8 +9114,9 @@ static int add_ext_adv_data(struct sock *sk, struct hci_dev *hdev, void *data, BT_DBG("%s", hdev->name); - expected_len = struct_size...
4847c5bca22227100ae69e96af86618b6fd2671f
Analyze and fix the following issue in the Linux kernel code: Bluetooth: SCO: Fix data-race on sco_pi fields in sco_connect
Problem Details: sco_sock_connect() copies the destination address into sco_pi(sk)->dst under lock_sock(), then releases the lock and calls sco_connect(), which reads dst, src, setting, and codec without holding lock_sock() in hci_get_route() and hci_connect_sco(). These fields may be modified concurrently by connect(...
```diff diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index f1799c6a6f87..140869e5b2df 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -312,11 +312,21 @@ static int sco_connect(struct sock *sk) struct sco_conn *conn; struct hci_conn *hcon; struct hci_dev *hdev; + bdaddr_t src, dst; + struc...
9ca7053d6215d89c33f28893bfd1625a32919d3f
Analyze and fix the following issue in the Linux kernel code: Bluetooth: ISO: Fix data-race on iso_pi fields in hci_get_route calls
Problem Details: iso_connect_bis(), iso_connect_cis(), iso_listen_bis(), and iso_conn_big_sync() call hci_get_route() using iso_pi(sk)->dst, iso_pi(sk)->src, and iso_pi(sk)->src_type without holding lock_sock(). These fields may be modified concurrently by connect() or setsockopt() on the same socket, resulting in dat...
```diff diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index c21ed2bb3cf8..3abd8111dda8 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -337,12 +337,20 @@ static int iso_connect_bis(struct sock *sk) struct iso_conn *conn; struct hci_conn *hcon; struct hci_dev *hdev; + bdaddr_t src, dst; + u...
f50331f2a1441ec49988832c3a95f2edacc47322
Analyze and fix the following issue in the Linux kernel code: Bluetooth: ISO: Fix a use-after-free of the hci_conn pointer
Problem Details: In iso_sock_rebind_bc(), the bis pointer is cached, then the socket lock is dropped: bis = iso_pi(sk)->conn->hcon; /* Release the socket before lookups since that requires hci_dev_lock * which shall not be acquired while holding sock_lock for proper * ordering. */ release_sock(sk); hci_dev_lo...
```diff diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 3d707c43bdc0..c21ed2bb3cf8 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -1082,7 +1082,7 @@ static int iso_sock_rebind_bc(struct sock *sk, struct sockaddr_iso *sa, * ordering. */ release_sock(sk); - hci_dev_lock(bis->hdev); + h...
5cbf290b79351971f20c7a533247e8d58a3f970c
Analyze and fix the following issue in the Linux kernel code: Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
Problem Details: hci_get_route() returns a reference-counted hci_dev pointer via hci_dev_hold(). The function exits normally or with an error without ever releasing it. Fixes: 07a9342b94a9 ("Bluetooth: ISO: Send BIG Create Sync via hci_sync") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Luiz Augusto vo...
```diff diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c index 876649556d3c..3d707c43bdc0 100644 --- a/net/bluetooth/iso.c +++ b/net/bluetooth/iso.c @@ -1595,6 +1595,7 @@ static void iso_conn_big_sync(struct sock *sk) release_sock(sk); hci_dev_unlock(hdev); + hci_dev_put(hdev); } static int iso_sock_rec...
37b3009bf5976e8ab77c8b9a9bc3bbd7ff49e37f
Analyze and fix the following issue in the Linux kernel code: Bluetooth: fix memory leak in error path of hci_alloc_dev()
Problem Details: Early failures in Bluetooth HCI UART configuration leak SRCU percpu memory. When device initialization fails before hci_register_dev() completes, the HCI_UNREGISTER flag is never set. As a result, when the device reference count reaches zero, bt_host_release() evaluates this flag as false and falls ba...
```diff diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 041ce9adc378..8957ce7c21b7 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -83,10 +83,12 @@ static void bt_host_release(struct device *dev) { struct hci_dev *hdev = to_hci_dev(dev); - if (hci_dev_test_flag(hd...
6770d3a8acdf9151769180cc3710346c4cfbe6f0
Analyze and fix the following issue in the Linux kernel code: Bluetooth: bnep: reject short frames before parsing
Problem Details: A BNEP peer can send a short BNEP SDU. bnep_rx_frame() reads the packet type byte immediately and, for control packets, reads the control opcode and setup UUID-size byte before proving that those bytes are present. bnep_rx_control() also dereferences the control opcode without rejecting an empty contro...
```diff diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 0de5df690bd0..5c5f53ff30e8 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -206,14 +206,11 @@ static int bnep_ctrl_set_mcfilter(struct bnep_session *s, u8 *data, int len) return 0; } -static int bnep_rx_contr...
5c65b96b549ea2dcfde497436bf9e048deb87758
Analyze and fix the following issue in the Linux kernel code: Bluetooth: hci_sync: reject oversized Broadcast Announcement prepend
Problem Details: Existing advertising instances can already hold the maximum extended advertising payload. When hci_adv_bcast_annoucement() prepends the Broadcast Announcement service data to that payload, the combined data may no longer fit in the temporary buffer used to rebuild the advertising data. Reject that cas...
```diff diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index aeccd8084cba..df23245d6ccd 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -1725,6 +1725,11 @@ static int hci_adv_bcast_annoucement(struct hci_dev *hdev, struct adv_info *adv) /* Generate Broadcast ID */ get_rando...
dd214733544427587a95f66dbf3adff072568990
Analyze and fix the following issue in the Linux kernel code: Bluetooth: L2CAP: reject BR/EDR signaling packets over MTUsig
Problem Details: net/bluetooth/l2cap_core.c:l2cap_sig_channel() accepts BR/EDR signaling packets up to the channel MTU and dispatches each command without enforcing the signaling MTU (MTUsig). A Bluetooth BR/EDR peer within radio range can send a fixed-channel CID 0x0001 packet that is larger than MTUsig and contains m...
```diff diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 5172afee5494..e0a1f2293679 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -33,6 +33,7 @@ /* L2CAP defaults */ #define L2CAP_DEFAULT_MTU 672 #define L2CAP_DEFAULT_MIN_MTU 48 +#define L2CAP_SIG...
23882b828c3c8c51d0c946446a396b10abb3b16b
Analyze and fix the following issue in the Linux kernel code: Bluetooth: RFCOMM: validate skb length in MCC handlers
Problem Details: The RFCOMM MCC handlers cast skb->data to protocol-specific structs without validating skb->len first. A malicious remote device can send truncated MCC frames and trigger out-of-bounds reads in these handlers. Fix this by using skb_pull_data() to validate and access the required data before dereferenc...
```diff diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index d11bd5337d57..364b9381c2dc 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -1431,10 +1431,15 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn) static int rfcomm_recv_pn(s...
de23fb62259aa01d294f77238ae3b835eb674413
Analyze and fix the following issue in the Linux kernel code: Bluetooth: MGMT: validate advertising TLV before type checks
Problem Details: tlv_data_is_valid() reads each advertising data field length from data[i], then inspects data[i + 1] for managed EIR types before checking that the current field still fits inside the supplied buffer. A malformed field whose length byte is the last byte of the buffer can therefore make the parser read...
```diff diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index de5bd6b637b2..027b266ccc74 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -8638,6 +8638,12 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data, if (!cur_len) continue; + /* If the current field l...
43c441edacf953b39517a44f5e5e10a93618b226
Analyze and fix the following issue in the Linux kernel code: Bluetooth: RFCOMM: hold listener socket in rfcomm_connect_ind()
Problem Details: rfcomm_get_sock_by_channel() scans rfcomm_sk_list under the list lock, but returns the selected listener after dropping that lock without taking a reference. rfcomm_connect_ind() then locks the listener, queues a child socket on it, and may notify it after unlocking it. The buggy scenario involves two...
```diff diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index bd7d959c6e9e..805ed5d28ed6 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -122,7 +122,7 @@ static struct sock *__rfcomm_get_listen_sock_by_addr(u8 channel, bdaddr_t *src) } /* Find socket with channel...
c3e70c5ee53f1a5e1df2e83f846185154d58111f
Analyze and fix the following issue in the Linux kernel code: coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates
Problem Details: tl;dr: Select fw_upload for doing TDX module updates. The process of selecting among available update images is complicated and nuanced. Punt the selection process out to userspace. One existing userspace implementation today is the script in the Intel TDX Module Binaries repository[1]. Long Version: ...
```diff diff --git a/arch/x86/include/asm/seamldr.h b/arch/x86/include/asm/seamldr.h index a74151b75599..43084e2daa2d 100644 --- a/arch/x86/include/asm/seamldr.h +++ b/arch/x86/include/asm/seamldr.h @@ -31,5 +31,6 @@ struct seamldr_info { static_assert(sizeof(struct seamldr_info) == 256); int seamldr_get_info(struc...
5ce9cc5a232b992806cf31027e6281727a2040fc
Analyze and fix the following issue in the Linux kernel code: coco/tdx-host: Don't expose P-SEAMLDR information on CPUs with erratum
Problem Details: TDX-capable CPUs clobber the current VMCS on P-SEAMLDR calls. Clearing the current VMCS behind KVM's back breaks KVM. Future CPUs will fix this by preserving the current VMCS across P-SEAMLDR calls. A future specification update will describe the VMCS-clearing behavior as an erratum and to state that ...
```diff diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 1d506e5d6f46..7b572bc24265 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -573,4 +573,5 @@ #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affec...
5eb5d5d123a8bd29204147a0cdd712f6d6d339e4
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Return INVALID_INPUT, not MISSING_INPUT, for bad GUEST_REQUEST input(s)
Problem Details: Return INVALID_INPUT, not MISSING_INPUT, if the guest provides an unaligned address for a GUEST_REQUEST, and/or attempts to use the same page for the source and destination. The inputs are obviously invalid, not missing. Opportunistically move the checks out of sev_es_validate_vmgexit(), to continue ...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index b59adddfdbcc..84421d9a116b 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3508,10 +3508,6 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) break; case SVM_VMGEXIT_GUEST_REQUEST: case SVM_VMGEXIT_EXT_GUEST_...
95d8c59cdf6d6c49b24cda1de595ed409cbb8596
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Return INVALID_EVENT for SNP-only #VMGEXIT from non-SNP guest
Problem Details: Signal INVALID_EVENT, not MISSING_INPUT, if a non-SNP guest attempts to invoke an SNP-only #VMGEXIT. Opportunistically move the checks out of sev_es_validate_vmgexit() to continue the march towards making said helper a predicate whose sole purpose is to verify the guest has marked required GHCB fields...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 880a2acd77bf..b59adddfdbcc 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3491,8 +3491,6 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) goto vmgexit_err; break; case SVM_VMGEXIT_AP_CREATION: - if (!is...
9a6e8d23dd6129eef5bfa474ddf161d732613701
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Move GHCB "usage" check out of sev_es_validate_vmgexit()
Problem Details: Move the check to verify the guest's requested GHCB out of sev_es_validate_vmgexit() as the first step towards making said helper a predicate whose sole purpose is to verify the guest has marked required GHCB fields as valid. Using a single "validate" helper sounds good on paper, but in practice it's ...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 7c2ebc81306f..880a2acd77bf 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3416,12 +3416,6 @@ static int sev_es_validate_vmgexit(struct vcpu_svm *svm) struct kvm_vcpu *vcpu = &svm->vcpu; u64 reason; - /* Only GHCB Usag...
1797e00bf802d64b859ea18505087daad92019c8
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Don't terminate SNP VMs on #VMGEXIT without a registered GHCB
Problem Details: If the guest attempts a non-MSR #VMGEXIT without the registered GHCB, return a GHCB_HV_RESP_MALFORMED_INPUT+GHCB_ERR_NOT_REGISTERED error to the guest instead of exiting KVM_RUN with -EINVAL (and in likelihood killing the VM). KVM has already mapped the requested GHCB, i.e. can cleanly report an error...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 6c6a6d663e29..7c2ebc81306f 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -4520,9 +4520,12 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu) sev_es_sync_from_ghcb(svm); /* SEV-SNP guest requires that the GHCB GPA must b...
a69a9e23dce95a1b7315f73b29200a58e0f54830
Analyze and fix the following issue in the Linux kernel code: gpu: nova-core: Hopper/Blackwell: add GSP lockdown release polling
Problem Details: On Hopper and Blackwell, FSP boots GSP with hardware lockdown enabled. After FSP Chain of Trust completes, the driver must poll for lockdown release before proceeding with GSP initialization. Add the register bit and helper functions needed for this polling. Signed-off-by: John Hubbard <jhubbard@nvidi...
```diff diff --git a/drivers/gpu/nova-core/falcon/gsp.rs b/drivers/gpu/nova-core/falcon/gsp.rs index df6d5a382c7a..98a1c1dc8465 100644 --- a/drivers/gpu/nova-core/falcon/gsp.rs +++ b/drivers/gpu/nova-core/falcon/gsp.rs @@ -24,6 +24,10 @@ use crate::{ regs, }; +/// Pattern returned by GSP register reads while th...
db38bcb3311053954f62b865cd2d86e164b04351
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Unmap and unpin the GHCB as needed on vCPU free
Problem Details: Unmap and unpin the GHCB as needed when freeing a vCPU. If the VM is destroyed after mapping+pinning the GHCB on #VMGEXIT, without re-running the vCPU, KVM will effectively leak the GHCB and any mappings created for the GHCB. Fixes: 291bd20d5d88 ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT") ...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 11d46600cbdc..6c6a6d663e29 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3552,6 +3552,20 @@ vmgexit_err: return 1; } +static void __sev_es_unmap_ghcb(struct vcpu_svm *svm) +{ + if (svm->sev_es.ghcb_sa_free) { + kvfre...
8618004d3e897c0f1b71d9a9ab860461289bb89a
Analyze and fix the following issue in the Linux kernel code: KVM: Don't WARN if memory is dirtied without a vCPU when the VM is dying
Problem Details: When marking a page dirty, complain about not having a running/loaded vCPU if and only if the VM is still alive, i.e. its refcount is non-zero. This will allow fixing a memory leak for x86 SEV-ES guests without hitting what is effectively a false positive on the WARN. For some SEV-ES VM-Exits, KVM ke...
```diff diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 89489996fbc1..881f92d7a469 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3520,7 +3520,8 @@ void mark_page_dirty_in_slot(struct kvm *kvm, if (WARN_ON_ONCE(vcpu && vcpu->kvm != kvm)) return; - WARN_ON_ONCE(!vcpu && !kvm_arch_allo...
00b9744a3688758c5c492756d08a1cd599a76965
Analyze and fix the following issue in the Linux kernel code: KVM: SEV: Add an anonymous "psc" struct to track current PSC metadata
Problem Details: Add a "psc" struct to vcpu_sev_es_state to avoid having to prefix all of the fields with "psc_". Take advantage of the code churn to opportunistically rename local variables to "guest_psc" to make it more obvious that the buffer is guest data, and more importantly, guest accessible! Opportunistically...
```diff diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 1982d13e71d9..9f6543cebedf 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3845,9 +3845,7 @@ static int snp_begin_psc(struct vcpu_svm *svm); static void snp_complete_psc(struct vcpu_svm *svm, u64 psc_ret) { - svm->sev_es...
6a4c53a2e26a865565bd6a460961e8d6fcb32329
Analyze and fix the following issue in the Linux kernel code: fs/ntfs3: validate lcns_follow in log_replay conversion
Problem Details: log_replay() converts DIR_PAGE_ENTRY_32 records into DIR_PAGE_ENTRY records when replaying version 0 restart tables. During this conversion, the memmove() length is derived directly from the on-disk lcns_follow field: memmove(&dp->vcn, &dp0->vcn_low, 2 * sizeof(u64) + le32_to_cpu(dp->lcns_foll...
```diff diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 81a305d4bcf2..95e1cdb47475 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -4257,13 +4257,26 @@ check_dirty_page_table: if (rst->major_ver) goto end_conv_1; /* reduce tab pressure. */ + t16 = le16_to_cpu(dptbl->size); + if (t16 < sizeof(struc...
5e7b598660cfa8e5af172cf4c65cffc126333307
Analyze and fix the following issue in the Linux kernel code: fs/ntfs3: bound copy_lcns dp->page_lcns[] index in analysis pass
Problem Details: In log_replay()'s analysis pass, after find_dp() returns a valid DIR_PAGE_ENTRY for the (target_attr, target_vcn) tuple, the copy_lcns block walks lrh->lcns_follow further entries: t16 = le16_to_cpu(lrh->lcns_follow); for (i = 0; i < t16; i++) { size_t j = (size_t)(le64_to_cpu(lrh->target_vcn) ...
```diff diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 2bd8754ef26d..81a305d4bcf2 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -3394,8 +3394,8 @@ move_data: if (run_get_highest_vcn(le64_to_cpu(attr->nres.svcn), attr_run(attr), - le32_to_cpu(attr->size) - - le...
fc4626bb3656362de8b0ecd56605d47a19ec3518
Analyze and fix the following issue in the Linux kernel code: fs/ntfs3: bound DeleteIndexEntryAllocation memmove length
Problem Details: In do_action()'s DeleteIndexEntryAllocation case, e->size comes from an on-disk INDEX_BUFFER entry. When e->size makes e + e->size point past hdr + hdr->used, PtrOffset(e1, Add2Ptr(hdr, used)) returns a negative ptrdiff_t that is silently cast to a quasi-infinite size_t when passed to memmove(). The ...
```diff diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 847048637dda..2bd8754ef26d 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -3598,9 +3598,23 @@ move_data: } e1 = Add2Ptr(e, esize); - nsize = esize; used = le32_to_cpu(hdr->used); + /* + * Reject crafted entries whose e->size makes ...
d1570c48f49a693974d000251030370ee2e83539
Analyze and fix the following issue in the Linux kernel code: fs/ntfs3: bound attr_off in UpdateResidentValue against data_off
Problem Details: In do_action()'s UpdateResidentValue case (fslog.c:3307), lrh->attr_off and lrh->redo_len come from the on-disk LRH. When they satisfy aoff + dlen < attr->res.data_off, the assignment attr->res.data_size = cpu_to_le32(aoff + dlen - data_off); underflows to ~4 GiB (e.g. 0xFFFFFFF9 when aoff=0x10, dle...
```diff diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 92a7e3a46240..847048637dda 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -3339,6 +3339,17 @@ skip_load_parent: nsize = ALIGN(nsize, 8); data_off = le16_to_cpu(attr->res.data_off); + /* + * aoff comes from the on-disk lrh->attr_off. For...
9bfaa86b405381326c971984fd6da184c289713f
Analyze and fix the following issue in the Linux kernel code: dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device
Problem Details: In debug_dma_sync_sg_for_device(), when iterating over a scatterlist, the debug entry population mistakenly uses the head of the scatterlist 'sg' to fetch the physical address via sg_phys(), instead of using the current iterator variable 's'. This causes dma-debug to track the physical address of the ...
```diff diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 3248f8b4d096..2c0e2cd89b5e 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -1556,7 +1556,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, struct dma_debug_entry ref = { .type = dma_debug_sg,...
2b9b216628fd9352f9c791701c8990d05736aa90
Analyze and fix the following issue in the Linux kernel code: ext4: fast commit: avoid self-deadlock in inode snapshotting
Problem Details: ext4_fc_snapshot_inodes() used igrab()/iput() to pin inodes while building commit-time snapshots. With ext4_fc_del() waiting for EXT4_STATE_FC_COMMITTING, iput() can trigger ext4_clear_inode()->ext4_fc_del() in the commit thread and deadlock waiting for the fast commit to finish. ext4_fc_del() also ha...
```diff diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c index 673668860e2d..8a6981e50ffe 100644 --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -235,6 +235,37 @@ static bool ext4_fc_eligible(struct super_block *sb) !(ext4_test_mount_flag(sb, EXT4_MF_FC_INELIGIBLE)); } +/* + * Wait for an ino...
b3060e96533dc3157fc6d3d45dc19927c566977b
Analyze and fix the following issue in the Linux kernel code: ext4: fast commit: avoid waiting for FC_COMMITTING
Problem Details: ext4_fc_track_inode() can be called while holding i_data_sem (e.g. fallocate). Waiting for EXT4_STATE_FC_COMMITTING in that case risks an ABBA deadlock: i_data_sem -> wait(FC_COMMITTING) vs FC_COMMITTING -> wait(i_data_sem) in the commit task. Now that fast commit snapshots inode state at commit time,...
```diff diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 115a3c94db16..927173bc8381 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1991,6 +1991,7 @@ enum { EXT4_STATE_FC_COMMITTING, /* Fast commit ongoing */ EXT4_STATE_FC_FLUSHING_DATA, /* Fast commit flushing data */ EXT4_STATE_ORPHAN_FILE, /* Inode orp...
7f473f971382d73a58e386afa7efdaac294b89f0
Analyze and fix the following issue in the Linux kernel code: ext4: lockdep: handle i_data_sem subclassing for special inodes
Problem Details: Fast commit can hold s_fc_lock while writing journal blocks. Mapping the journal inode can take its i_data_sem. Normal inode update paths can take a data inode i_data_sem and then s_fc_lock, which makes lockdep report a circular dependency. lockdep treats all i_data_sem instances as one lock class and...
```diff diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index e337a37bb6fb..115a3c94db16 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1015,12 +1015,14 @@ do { \ * than the first * I_DATA_SEM_QUOTA - Used for quota inodes only * I_DATA_SEM_EA - Used for ea_inodes only + * I_DATA_SEM_JOURN...
289a2ca0c9b7eae74f93fc213b0b971669b8683d
Analyze and fix the following issue in the Linux kernel code: jbd2: fix integer underflow in jbd2_journal_initialize_fast_commit()
Problem Details: jbd2_journal_initialize_fast_commit() validates journal capacity by checking (journal->j_last - num_fc_blks < JBD2_MIN_JOURNAL_BLOCKS). Both j_last and num_fc_blks are unsigned, so when num_fc_blks exceeds j_last the subtraction wraps to a large value, bypassing the bounds check. The resulting underfl...
```diff diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 4f397fcdb13c..e3b2e38e1a1b 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2263,6 +2263,8 @@ jbd2_journal_initialize_fast_commit(journal_t *journal) unsigned long long num_fc_blks; num_fc_blks = jbd2_journal_get_num_fc_blks(sb); + if (num...
8b3bc93fee6771775243665a0cf31857d6659775
Analyze and fix the following issue in the Linux kernel code: ext4: fix fast commit wait/wake bit mapping on 64-bit
Problem Details: On 64-bit, ext4 dynamic inode states live in the upper half of i_flags, and ext4_test_inode_state() applies the corresponding +32 offset. The fast-commit wait and wake paths open-coded the wait key with the raw EXT4_STATE_* value. Add small helpers for the state wait word and bit, and use them for the...
```diff diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 94283a991e5c..6569d1d575a0 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2000,6 +2000,8 @@ EXT4_INODE_BIT_FNS(flag, flags, 0) static inline int ext4_test_inode_state(struct inode *inode, int bit); static inline void ext4_set_inode_state(struct inode *i...
8fc197cf366beaabaeb46575c8cf46fe5076b943
Analyze and fix the following issue in the Linux kernel code: jbd2: check for aborted handle in jbd2_journal_dirty_metadata()
Problem Details: jbd2_journal_dirty_metadata() unconditionally dereferences handle->h_transaction at function entry to obtain the journal pointer: transaction_t *transaction = handle->h_transaction; journal_t *journal = transaction->t_journal; However, h_transaction may legitimately be NULL for an aborted handle. T...
```diff diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 4885903bbd10..aa0be9e9c876 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1516,14 +1516,19 @@ void jbd2_buffer_abort_trigger(struct journal_head *jh, */ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *b...
ff124ad01dd3fedfda710b6961080a199e1f94aa
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: fix a typo
Problem Details: We use 512 A-MSDUs in an A-MPDU, not 612. Fix the typo. Link: https://patch.msgid.link/20260531135036.62a394741a04.I2fd9e1d5dc4d467426c9061df2796ff8ba0129d4@changeid Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h index 933a96131d1a..6a3539ad7331 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h @@ -372,7 +372,7 @@ struct iwl_mac_cfg { }; /* - ...
f255f1f2a05d2e2147a24f649755b2a0dd8aa1a7
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: pcie: fix write pointer move detection
Problem Details: Ever since the TFD queue size is no longer limited to 256 entries, this code has been wrong, and might erroneously not detect a move if it was by a multiple of 256. Not a big deal, but fix it while I see it. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20260531...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c index 976a47ef6d0e..28b276c65952 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c @@ -2590,7 +2590,7 @@ int...
b74e377cad9271950c57472867c469e4b5b2ff0c
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: mvm: fix P2P-Device binding handling
Problem Details: Our binding handling for P2P-Device can run into the following scenario, as observed by our testing: - a station interface is connected on some channel - the P2P-Device does a remain-on-channel (ROC) on that channel - the ROC ends, and the P2P-Device is removed from the binding, but the phy_ctxt...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/binding.c b/drivers/net/wireless/intel/iwlwifi/mvm/binding.c index 58e9a940024d..0812522edea0 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/binding.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/binding.c @@ -2,7 +2,7 @@ /* * Copyright (C) 2012-2014, ...
f60f2159219fda21e5fde5a6a9aa94edb14d76a0
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: fix STEP_URM register address for SC devices
Problem Details: The CNVI_PMU_STEP_FLOW register address differs between device families. For SC and newer devices, the register is at 0xA2D688, while for BZ devices it's at 0xA2D588. Signed-off-by: Moriya Itzchaki <moriya.itzchaki@intel.com> Link: https://patch.msgid.link/20260527230313.f0c115c4f74e.I3c66b2e39a97f754...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h index 6ca1f51b69a1..50acfe0d4f79 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-prph.h @@ -385,7 +385,8 @@ enum { #define CNVI_SCU_REG_FOR_ECO_1_...
be443355dafcd4ab40f59b399868b04cc1e9da78
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: mld: fix smatch warning
Problem Details: We dereference the mld_sta pointer before checking for NULL. But we do check the sta pointer, and sta != NULL means mld_sta != NULL, so there is no real issue. Fix it anyway to silence the warning. Link: https://patch.msgid.link/20260527200512.506707-2-miriam.rachel.korenblit@intel.com Signed-off-by: ...
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/mld/tx.c b/drivers/net/wireless/intel/iwlwifi/mld/tx.c index 1e8716cbb4ce..2185dade95f8 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/tx.c @@ -563,7 +563,8 @@ iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct s...
8c1104b006414a404d32000191fb31917c965c98
Analyze and fix the following issue in the Linux kernel code: wifi: iwlwifi: remove mvm prefix from marker command
Problem Details: This command is sent in other opmodes as well. Remove the mvm prefix. Link: https://patch.msgid.link/20260527230313.290e4d9db14a.Ia4edc64dacc8e298ab7817ab5c37843e92698b8d@changeid Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
```diff diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h index abd259350589..f76f76e54c4e 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/commands.h @@ -466,8 +466,8 @@ enum iwl_lega...
ed8f317671d9a6bd1daf2f0cb152e126eae2bf10
Analyze and fix the following issue in the Linux kernel code: selftests: livepatch: set LC_ALL=C to fix locale-dependent test failure
Problem Details: When executing the command "make -C tools/testing/selftests TARGETS=livepatch run_tests", the following error message was reported. TEST: livepatch interaction with ftrace_enabled sysctl ... not ok ... livepatch: sysctlo : setting key "kernel.ftrace_enabled": Device or resource busy livepatch: sysctl:...
```diff diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh index 2bc50271729c..30dc677b2f45 100644 --- a/tools/testing/selftests/livepatch/functions.sh +++ b/tools/testing/selftests/livepatch/functions.sh @@ -4,6 +4,8 @@ # Shell functions for the rest of the ...
b408b52e7111c560dcd7d69612c2e07c59c36ae3
Analyze and fix the following issue in the Linux kernel code: KVM: selftests: Add guest_memfd regression test signed offset+size bug
Problem Details: Add a regression (and proof-of-bug) testcase to ensure KVM rejects an offset+size that would result in a negative value when computed as a signed 64-bit value. KVM had a flaw where it would allow binding a memslot to a guest_memfd instance even with a wildly out-of-range offset, if the offset and size...
```diff diff --git a/tools/testing/selftests/kvm/guest_memfd_test.c b/tools/testing/selftests/kvm/guest_memfd_test.c index 4b4462c8bacd..775f99443d49 100644 --- a/tools/testing/selftests/kvm/guest_memfd_test.c +++ b/tools/testing/selftests/kvm/guest_memfd_test.c @@ -345,6 +345,16 @@ static void test_invalid_punch_hole(...
eba85fee7fc6cf28fec38a5bf3c378bef9a79ca6
Analyze and fix the following issue in the Linux kernel code: KVM: guest_memfd: Treat memslot binding offset+size as unsigned values
Problem Details: When binding a memslot to a guest_memfd file, treat the offset and size as unsigned values to fix a bug where the sum of the two can result in a false negative when checking for overflow against the size of the file. Passing unsigned values also avoids relying on somewhat obscure checks in other flows...
```diff diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index 46727539d08a..f54502640b08 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -640,15 +640,16 @@ int kvm_gmem_create(struct kvm *kvm, struct kvm_create_guest_memfd *args) } int kvm_gmem_bind(struct kvm *kvm, struct kvm_memor...
15fe76e23615f502d051ef0768f86babaf08746c
Analyze and fix the following issue in the Linux kernel code: RDMA/umem: Fix truncation for block sizes >= 4G
Problem Details: When the iommu is used the linearization of the mapping can give a single block that is very large split across multiple SG entries. When __rdma_block_iter_next() reassembles the split SG entries it is overflowing the 32 bit stack values and computed the wrong DMA addresses for blocks after the trunca...
```diff diff --git a/drivers/infiniband/core/iter.c b/drivers/infiniband/core/iter.c index 8e543d100657..3ed351e8fcf6 100644 --- a/drivers/infiniband/core/iter.c +++ b/drivers/infiniband/core/iter.c @@ -19,8 +19,8 @@ EXPORT_SYMBOL(__rdma_block_iter_start); bool __rdma_block_iter_next(struct ib_block_iter *biter) { ...
c7722e5e1daeeabbd9f969554d52bb7158120b27
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Move update_cr8_intercept() to lapic.c
Problem Details: Move update_cr8_intercept() to lapic.c so that it's globally visible in anticipation of extracting most of the register-specific code out of x86.c and into a new compilation unit. Opportunistically prefix the helper kvm_lapic_ to make its role/scope more obvious. No functional change intended. Revie...
```diff diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d8dbfb107bfb..27cca31308bd 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2744,6 +2744,32 @@ u64 kvm_lapic_get_cr8(struct kvm_vcpu *vcpu) return (tpr & 0xf0) >> 4; } +void kvm_lapic_update_cr8_intercept(struct kvm_vcpu *vcpu) ...
a7e6e09b27ca797abc593778f0fbc23f70f5b4c7
Analyze and fix the following issue in the Linux kernel code: KVM: nSVM: Use kvm_rax_read() now that it's mode-aware
Problem Details: Now that kvm_rax_read() truncates the output value to 32 bits if the vCPU isn't in 64-bit mode, use it instead of the more verbose (and very technically slower) kvm_register_read(). Note! VMLOAD, VMSAVE, and VMRUN emulation are still technically buggy, as they can use EAX (versus RAX) in 64-bit mode ...
```diff diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index be7671880261..de9de9cc9d69 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1135,7 +1135,7 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) if (WARN_ON_ONCE(!svm->nested.initialized)) return -EINVAL; - vmcb12...
ed8a7b89c504aa24c01014dd4ebde50dbf8ac9d0
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Move inlined GPR, CR, and DR helpers from x86.h to regs.h
Problem Details: Move inlined General Purpose Register, Control Register, and Debug Register helpers from x86.h to the aptly named regs.h, to help trim down x86.h (and x86.c in the future). Move *very* select EFER functionality as well, but leave behind the bulk of EFER handling and all other MSR handling. There is m...
```diff diff --git a/arch/x86/kvm/regs.h b/arch/x86/kvm/regs.h index 4440f3992fce..62cc9deea226 100644 --- a/arch/x86/kvm/regs.h +++ b/arch/x86/kvm/regs.h @@ -16,6 +16,37 @@ static_assert(!(KVM_POSSIBLE_CR0_GUEST_BITS & X86_CR0_PDPTR_BITS)); +static inline bool is_long_mode(struct kvm_vcpu *vcpu) +{ +#ifdef CONFIG...
ece08316ca21ac2a3f3cc47a27b25f95adf1cfb2
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Rename kvm_cache_regs.h => regs.h
Problem Details: Rename kvm_cache_regs.h to simply regs.h, as the "cache" nomenclature is already a lie (the file deals with state/registers that aren't cached per se), and so that more code/functionality can be landed in the header without making it a truly horrible misnomer. Deliberately drop the kvm_ prefix/namespa...
```diff diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a367828ce869..94e253148771 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -20,7 +20,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/kvm_host.h> -#include "kvm_cache_regs.h" +#include "regs.h" #include "...
16b5d193b2127caab46ca5840e5d945732215e55
Analyze and fix the following issue in the Linux kernel code: KVM: x86: Trace hypercall register *after* truncating values for 32-bit
Problem Details: When tracing hypercalls, invoke the tracepoint *after* truncating the register values for 32-bit guests so as not to record unused garbage (in the extremely unlikely scenario that the guest left garbage in a register after transitioning from 64-bit mode to 32-bit mode). Fixes: 229456fc34b1 ("KVM: conv...
```diff diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 57ce0f1f1860..63ee091aed70 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10433,8 +10433,6 @@ int ____kvm_emulate_hypercall(struct kvm_vcpu *vcpu, int cpl, ++vcpu->stat.hypercalls; - trace_kvm_hypercall(nr, a0, a1, a2, a3); - if (!...
f43caad54cc0d7ab8c3a08092687fad515ce8da6
Analyze and fix the following issue in the Linux kernel code: KVM: VMX: Read 32-bit GPR values for ENCLS instructions outside of 64-bit mode
Problem Details: When getting register values for ENCLS emulation, use kvm_register_read() instead of kvm_<reg>_read() so that bits 63:32 of the register are dropped if the guest is in 32-bit mode. Note, the misleading/surprising behavior of kvm_<reg>_read() being "raw" variants under the hood will be addressed once a...
```diff diff --git a/arch/x86/kvm/vmx/sgx.c b/arch/x86/kvm/vmx/sgx.c index df1d0cf76947..4c61fc33f764 100644 --- a/arch/x86/kvm/vmx/sgx.c +++ b/arch/x86/kvm/vmx/sgx.c @@ -225,8 +225,8 @@ static int handle_encls_ecreate(struct kvm_vcpu *vcpu) struct x86_exception ex; int r; - if (sgx_get_encls_gva(vcpu, kvm_rbx_re...
9377016c2f9e2e25dca5788ac109190daf116134
Analyze and fix the following issue in the Linux kernel code: KVM: x86/xen: Don't truncate RAX when handling hypercall from protected guest
Problem Details: Don't truncate RAX when handling a Xen hypercall for a guest with protected state, as KVM's ABI is to assume the guest is in 64-bit for such cases (the guest leaving garbage in 63:32 after a transition to 32-bit mode is far less likely than 63:32 being necessary to complete the hypercall). Fixes: b5ae...
```diff diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 6d9be74bb673..895095dc684e 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1678,15 +1678,14 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu) bool handled = false; u8 cpl; - input = (u64)kvm_register_read(vcpu, VCPU_REGS_RAX); - /* Hy...
09912b8ad22f981d83818fc83a141dd8216d9ffb
Analyze and fix the following issue in the Linux kernel code: KVM: x86/xen: Bug the VM if 32-bit KVM observes a 64-bit mode hypercall
Problem Details: Bug the VM if 32-bit KVM attempts to handle a 64-bit hypercall, primarily so that a future change to set "input" in mode-specific code doesn't trigger a false positive warn=>error: arch/x86/kvm/xen.c:1687:6: error: variable 'input' is used uninitialized whenever '...
```diff diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 91fd3673c09a..6d9be74bb673 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -1694,16 +1694,19 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu) params[4] = (u32)kvm_rdi_read(vcpu); params[5] = (u32)kvm_rbp_read(vcpu); } -#ifdef CONFIG_X...
42a842f3f6b9eaa361914c96a7c974973e1e2132
Analyze and fix the following issue in the Linux kernel code: KVM: SVM: Truncate INVLPGA address in compatibility mode
Problem Details: Check for full 64-bit mode, not just long mode, when truncating the virtual address as part of INVLPGA emulation. Compatibility mode doesn't support 64-bit addressing. Note, the FIXME still applies, e.g. if the guest deliberately targeted EAX while in 64-bit via an address size override. That flaw i...
```diff diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 95c411da6f2c..be15cb516803 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -2404,7 +2404,7 @@ static int invlpga_interception(struct kvm_vcpu *vcpu) return 1; /* FIXME: Handle an address size prefix. */ - if (!is_long_...
a3f3859cecacb64f18fd446271ece9a3b3f2d4de
Analyze and fix the following issue in the Linux kernel code: ipmi: fix refcount leak in i_ipmi_request()
Problem Details: When a caller provides a `supplied_recv` message to i_ipmi_request(), the function increments the user's `nr_msgs` reference count. If an error occurs later, the out_err cleanup path only frees the recv_msg if the function allocated it itself (i.e., !supplied_recv). In the supplied_recv case the cleanu...
```diff diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 7ca2cacbaa05..ab4c85f3d6fe 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -2345,6 +2345,10 @@ static int i_ipmi_request(struct ipmi_user *user, if (smi_msg == NULL) ...
73fde0cbff7d9d618591774a12c23434232752c1
Analyze and fix the following issue in the Linux kernel code: HID: hid-lenovo-go: cancel cfg_setup work in hid_go_cfg_remove()
Problem Details: hid_go_cfg_probe() initialises drvdata.go_cfg_setup and schedules it to run 2 ms later: INIT_DELAYED_WORK(&drvdata.go_cfg_setup, &cfg_setup); schedule_delayed_work(&drvdata.go_cfg_setup, msecs_to_jiffies(2)); cfg_setup() dereferences drvdata.hdev to issue MCU command requests. hid_go_cfg_remo...
```diff diff --git a/drivers/hid/hid-lenovo-go.c b/drivers/hid/hid-lenovo-go.c index e0c9d5ec9451..318b1152ff8b 100644 --- a/drivers/hid/hid-lenovo-go.c +++ b/drivers/hid/hid-lenovo-go.c @@ -2405,6 +2405,15 @@ static int hid_go_cfg_probe(struct hid_device *hdev, static void hid_go_cfg_remove(struct hid_device *hdev)...
d823fc25eaaf357be292bd9c827026985bd502b3
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: always expose multi-link element
Problem Details: During beacon processing, the parser is always called with a BSS to find the correct multi-BSSID profile (if any) and therefore never attempts to parse a multi-link element. This means the code to handle cross-link CSA can effectively never do anything. Fix this by parsing the multi-link element in th...
```diff diff --git a/net/mac80211/parse.c b/net/mac80211/parse.c index 34f4c76ebc5d..c2f2f78f2b4f 100644 --- a/net/mac80211/parse.c +++ b/net/mac80211/parse.c @@ -54,7 +54,7 @@ struct ieee80211_elems_parse { /* must be first for kfree to work */ struct ieee802_11_elems elems; - struct ieee80211_elem_defrag ml_rec...
4ec9ea8a58859c260ae32e097aa643975572e58b
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: Fix PERR frame processing
Problem Details: There are no issues with the PERR processing itself; however, to maintain consistency with the previous PREQ/PREP code modifications, I will create a new mesh_path_parse_error_frame() function to separately implement the frame format validation and the "not supported" check. Signed-off-by: Masashi Hon...
```diff diff --git a/include/linux/ieee80211-mesh.h b/include/linux/ieee80211-mesh.h index 482ac0c6d759..7eb15834531c 100644 --- a/include/linux/ieee80211-mesh.h +++ b/include/linux/ieee80211-mesh.h @@ -403,4 +403,40 @@ static inline bool ieee80211_mesh_prep_size_ok(const u8 *pos, u8 elen) return elen == needed; } ...
d158e54476ea9667c33dfa2c8d87c7cc32b40f1b
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: Fix overread in PREP frame processing
Problem Details: When the AF flag is enabled, hwmp_prep_frame_process() overreads orig_addr by 2 bytes. Since this occurs within the socket buffer, it does not read across memory boundaries and therefore poses no security risk; however, we will fix it as a precaution. In this fix, a new function mesh_path_parse_reply_...
```diff diff --git a/include/linux/ieee80211-mesh.h b/include/linux/ieee80211-mesh.h index 8fbd31d9538d..482ac0c6d759 100644 --- a/include/linux/ieee80211-mesh.h +++ b/include/linux/ieee80211-mesh.h @@ -387,4 +387,20 @@ static inline bool ieee80211_mesh_preq_size_ok(const u8 *pos, u8 elen) return elen == needed; } ...
8b40b1d24a6099fe9fac8e207d4cb04ab5e0baae
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: Fix overread in PREQ frame processing
Problem Details: When the AF flag is enabled, hwmp_preq_frame_process() overreads target_addr by 2 bytes. Since this occurs within the socket buffer, it does not read across memory boundaries and therefore poses no security risk; however, we will fix it as a precaution. In this fix, a new function mesh_path_parse_requ...
```diff diff --git a/include/linux/ieee80211-mesh.h b/include/linux/ieee80211-mesh.h index f709263c310b..8fbd31d9538d 100644 --- a/include/linux/ieee80211-mesh.h +++ b/include/linux/ieee80211-mesh.h @@ -358,4 +358,33 @@ ieee80211_mesh_hwmp_perr_get_rcode(const u8 *ie, u8 dst_idx) (dst->flags & AE_F) ? ETH_ALEN : 0])...
a91c65cb99d1e03c8d8f0244258cbdd2d60faa86
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: Use struct instead of macro for PREP frame
Problem Details: The existing PREP_IE_* macros access HWMP PREP frame fields via hardcoded byte offsets. When the AE (Address Extension) flag is set, an additional 6 bytes appear mid-frame, making the offset arithmetic error-prone. Introduce typed packed C structs to represent the PREP frame layout: - ieee80211_mesh...
```diff diff --git a/include/linux/ieee80211-mesh.h b/include/linux/ieee80211-mesh.h index bf4a544aed00..4ce4e47d6d01 100644 --- a/include/linux/ieee80211-mesh.h +++ b/include/linux/ieee80211-mesh.h @@ -53,6 +53,24 @@ struct ieee80211_mesh_hwmp_preq_bottom { struct ieee80211_mesh_hwmp_preq_target targets[]; } __pack...
4ac20bd40b7db8568aea5ba1d390241842e41ed8
Analyze and fix the following issue in the Linux kernel code: wifi: mac80211: Use struct instead of macro for PREQ frame
Problem Details: The existing PREQ_IE_* macros access HWMP PREQ frame fields via hardcoded byte offsets. When the AE (Address Extension) flag is set, an additional 6 bytes appear mid-frame, and the macros handle this with conditional arithmetic (e.g., AE_F_SET(x) ? x + N+6 : x + N). This approach obscures the frame lay...
```diff diff --git a/include/linux/ieee80211-mesh.h b/include/linux/ieee80211-mesh.h index 4b829bcb38b6..bf4a544aed00 100644 --- a/include/linux/ieee80211-mesh.h +++ b/include/linux/ieee80211-mesh.h @@ -28,12 +28,40 @@ struct ieee80211s_hdr { u8 eaddr2[ETH_ALEN]; } __packed __aligned(2); +struct ieee80211_mesh_hwm...
1a15bf9708ba3bf80410065e113aa17cd6a18dcf
Analyze and fix the following issue in the Linux kernel code: wifi: cfg80211: remove 5/10 MHz channel support
Problem Details: Remove WIPHY_FLAG_SUPPORTS_5_10_MHZ and 5/10 MHz channel width support. We contemplated this back in early 2023 and didn't do it yet, but nobody stepped up to maintain it. It's already _mostly_ dead code since it can really only be used for AP and maybe IBSS and monitor, but not on a client since ther...
```diff diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 6ca31d4ea437..610a3321b497 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c @@ -2600,8 +2600,6 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops) ...
f20f8fe086b2487ff70562866c4a30b1d9a66a37
Analyze and fix the following issue in the Linux kernel code: arm64: Document SVE constraints on new hwcaps
Problem Details: Two of the SVE hwcaps added for the SVE features in the 2025 dpISA did not explicitly call out their dependency on SVE in the ABI documentation. Do so. While we're here reorder the SVE and fature specific ID registers for HWCAP3_SVE_LUT6 which did have the SVE dependency but listed it second unlike th...
```diff diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst index 07ff9ea1d605..f60ca5612daa 100644 --- a/Documentation/arch/arm64/elf_hwcaps.rst +++ b/Documentation/arch/arm64/elf_hwcaps.rst @@ -452,10 +452,12 @@ HWCAP3_LS64 memory location, otherwise fallback to the non...
cb9959ab5f99611d27a06586add84811fe8102dc
Analyze and fix the following issue in the Linux kernel code: wifi: cfg80211: enforce HE/EHT cap/oper consistency
Problem Details: Xiang Mei reports that mac80211 could crash if eht_cap is set but eht_oper isn't. Rather than fixing that for the individual user(s), enforce that both HE/EHT have consistent elements. Reported-by: Xiang Mei <xmei5@asu.edu> Fixes: 22c64f37e1d4 ("wifi: mac80211: Update MCS15 support in link_conf") Link...
```diff diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index dac2e8643c49..76c537a6e8b5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6714,6 +6714,12 @@ static int nl80211_calculate_ap_params(struct cfg80211_ap_settings *params) return -EINVAL; } + if (!!params->he_cap != !!...
7f93fad5ea0affc9e1505dd0f7596c0fdb496213
Analyze and fix the following issue in the Linux kernel code: drm/v3d: Skip CSD when it has zeroed workgroups
Problem Details: A compute shader dispatch encodes its workgroup counts in the CFG0..CFG2 registers. Kicking off a dispatch with a zero count in any of the three dimensions is invalid. First, the hardware will process 0 as 65536, while the user-space driver exposes a maximum of 65535. Over that, a submission with a zer...
```diff diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 47f83936cd73..8a635a9ec046 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -352,6 +352,16 @@ v3d_csd_job_run(struct drm_sched_job *sched_job) return NULL; } + /* The HW interprets a ...
ae7676952790f421c40918e2586a2c9f12a682b6
Analyze and fix the following issue in the Linux kernel code: drm/v3d: Fix vaddr leak when indirect CSD has zeroed workgroups
Problem Details: v3d_rewrite_csd_job_wg_counts_from_indirect() maps both the indirect buffer and the workgroup buffer and is expected to release them before returning. When any of the workgroup counts read from the buffer is zero, the function bailed out early and skipped the cleanup, leaking the vaddr mappings of both...
```diff diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c index 94bf628dc91c..47f83936cd73 100644 --- a/drivers/gpu/drm/v3d/v3d_sched.c +++ b/drivers/gpu/drm/v3d/v3d_sched.c @@ -403,7 +403,7 @@ v3d_rewrite_csd_job_wg_counts_from_indirect(struct v3d_cpu_job *job) wg_counts = (uint32_t *)(b...
7c147fae71f3b3542ba3292d2099ef7237cfc0da
Analyze and fix the following issue in the Linux kernel code: rv: Prevent task migration while handling per-CPU events
Problem Details: Tracepoint handlers are fully preemptible after a46023d5616 ("tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast"). When a per-CPU monitor handles an event, it retrieves the monitor state using a per-CPU pointer. If the event itself doesn't disable preemption, the task can migrate...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 1f440c7818e6..34b8fba9ecd4 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -218,6 +218,10 @@ static inline void da_monitor_destroy(void) da_monitor_sync_hook(); } +#ifndef da_implicit_guard +#define da_implicit_guard...
74e17bd6fc8ed7e30363bb78d4c50b38cfd71efe
Analyze and fix the following issue in the Linux kernel code: rv: Ensure synchronous cleanup for HA monitors
Problem Details: HA monitors may start timers, all cleanup functions currently stop the timers asynchronously to avoid sleeping in the wrong context. Nothing makes sure running callbacks terminate on cleanup. Run the entire HA timer callback in an RCU read-side critical section, this way we can simply synchronize_rcu(...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index ec9bc88bd4c4..1f440c7818e6 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -57,6 +57,15 @@ static struct rv_monitor rv_this; #define da_monitor_reset_hook(da_mon) #endif +/* + * Hook to allow the implementation of hyb...
700782ec8f6589c5792b323efd6e004dd183328b
Analyze and fix the following issue in the Linux kernel code: rv: Add automatic cleanup handlers for per-task HA monitors
Problem Details: Hybrid automata monitors may start timers, depending on the model, these may remain active on an exiting task and cause false positives or even access freed memory. Add an enable/disable hook in the HA code, currently only populated by the per-task handler for registration and deregistration. This hoo...
```diff diff --git a/include/rv/ha_monitor.h b/include/rv/ha_monitor.h index bd87055567cc..4002b5247c46 100644 --- a/include/rv/ha_monitor.h +++ b/include/rv/ha_monitor.h @@ -28,6 +28,7 @@ static inline void ha_monitor_init_env(struct da_monitor *da_mon); static inline void ha_monitor_reset_env(struct da_monitor *da_m...
713c9e1ea7623846f8e0bb657f1b9d211d1a61e6
Analyze and fix the following issue in the Linux kernel code: rv: Do not rely on clean monitor when initialising HA
Problem Details: Hybrid Automata monitors hook into the DA implementation when doing da_monitor_reset(). This function is called both on initialisation and teardown, HA monitors try to cancel a timer only when it's initialised relying on the da_mon->monitoring flag. This flag could however be corrupted during initialis...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 60dc39f2620a..ec9bc88bd4c4 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -76,14 +76,22 @@ static void react(enum states curr_state, enum events event) model_get_state_name(curr_state)); } +/* + * da_monitor_reset...
2b9a8c27417eeef01967c6297def426a44776c04
Analyze and fix the following issue in the Linux kernel code: rv: Fix monitor start ordering and memory ordering for monitoring flag
Problem Details: da_monitor_start() set monitoring=1 before calling da_monitor_init_hook(), may racing with the sched_switch handler: da_monitor_start() sched_switch handler ------------------------- --------------------------------- da_mon->monitoring = 1; ...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index a7e103654406..60dc39f2620a 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -82,7 +82,7 @@ static void react(enum states curr_state, enum events event) static inline void da_monitor_reset(struct da_monitor *da_mon) { d...
32171d828ab964dc1f05f2056a81477522a3361b
Analyze and fix the following issue in the Linux kernel code: rv: Ensure all pending probes terminate on per-obj monitor destroy
Problem Details: The monitor disable/destroy sequence detaches all probes and resets the monitor's data, however it doesn't wait for pending probes. This is an issue with per-object monitors, which free the monitor storage. Call tracepoint_synchronize_unregister() to make sure to wait for all pending probes before des...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index cc97cc5dfbfd..a7e103654406 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -511,9 +511,10 @@ static inline void da_monitor_destroy(void) struct hlist_node *tmp; int bkt; + tracepoint_synchronize_unregister(); /* -...
c3d016ea823a9941ab8cbcef01a500821ff0cf16
Analyze and fix the following issue in the Linux kernel code: rv: Prevent in-flight per-task handlers from using invalid slots
Problem Details: Per-task monitors use a slot in the task_struct->rv[] array and store that locally (e.g. task_mon_slot), this slot is returned during the destruction process but currently hanlers can be running while that slot is returning and this race may lead to accessing an invalid slot. Synchronise with all in-f...
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 1459fb3dfee6..cc97cc5dfbfd 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -302,6 +302,9 @@ static int da_monitor_init(void) /* * da_monitor_destroy - return the allocated slot + * + * Wait for all in-flight handlers...
e32d7f404d7d9dac307c1cd9a1fe132fa62ab6d6
Analyze and fix the following issue in the Linux kernel code: rv: Reset per-task DA monitors before releasing the slot
Problem Details: Per-task monitors use task_mon_slot to determine which slot in the array to use for the monitor. During destruction, this slot is returned but this is done before resetting the monitor. As a result, the monitor's reset is in fact resetting a slot that is outside of the array (RV_PER_TASK_MONITOR_INIT)....
```diff diff --git a/include/rv/da_monitor.h b/include/rv/da_monitor.h index 39765ff6f098..1459fb3dfee6 100644 --- a/include/rv/da_monitor.h +++ b/include/rv/da_monitor.h @@ -309,10 +309,11 @@ static inline void da_monitor_destroy(void) WARN_ONCE(1, "Disabling a disabled monitor: " __stringify(MONITOR_NAME)); ret...
4793e8a6e20e4c17ed4e755ea40e5912cc3539af
Analyze and fix the following issue in the Linux kernel code: rv: Fix __user specifier usage in extract_params()
Problem Details: The attributes variables extracted from syscalls in the helper are both defined with the __user specifier although only the actual pointer to user data should be marked. Remove the __user specifier from attr. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all...
```diff diff --git a/kernel/trace/rv/monitors/deadline/deadline.h b/kernel/trace/rv/monitors/deadline/deadline.h index 0bbfd2543329..78fca873d61e 100644 --- a/kernel/trace/rv/monitors/deadline/deadline.h +++ b/kernel/trace/rv/monitors/deadline/deadline.h @@ -95,7 +95,8 @@ static inline u8 get_server_type(struct task_st...
e46d95f060a2d465413638c5861ee0c205ba12b5
Analyze and fix the following issue in the Linux kernel code: pmdomain: mediatek: mfg: move __packed after struct name to fix kernel-doc
Problem Details: The kernel-doc parser cannot parse 'struct __packed mtk_mfg_opp_entry {'. Move __packed to the closing brace, which is the more common kernel style. Assisted-by: Opencode:Big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
```diff diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c index 3ce6fb74dd53..53bdab66cf15 100644 --- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c +++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c @@ -236,14 +236,14 @@ struct __packed mtk_mfg_ipi_sleep_msg { *...
fba0510cd62666951dcc0221527edc0c47ae6599
Analyze and fix the following issue in the Linux kernel code: pmdomain: imx: fix OF node refcount
Problem Details: for_each_child_of_node_scoped() decrements the reference count of the nod after each iteration. Assigning it without incrementing the refcount to a dynamically allocated platform device will result in a double put in platform_device_release(). Add the missing call to of_node_get(). Cc: stable@vger.ker...
```diff diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c index de695f1944ab..42e50c9b4fb9 100644 --- a/drivers/pmdomain/imx/gpc.c +++ b/drivers/pmdomain/imx/gpc.c @@ -487,7 +487,7 @@ static int imx_gpc_probe(struct platform_device *pdev) domain->ipg_rate_mhz = ipg_rate_mhz; pd_pdev->dev.pa...
4db207599acfc9d676340daa2dc6b52bfca17db4
Analyze and fix the following issue in the Linux kernel code: pmdomain: ti_sci: add wakeup constraint to parent devices of wakeup source
Problem Details: Set wakeup constraint for any device in a wakeup path. All parent devices of a wakeup device should not be turned off during suspend. This ensures the wakeup device is kept on while the system is suspended. Cc: stable@vger.kernel.org Fixes: 9d8aa0dd3be4 ("pmdomain: ti_sci: add wakeup constraint manage...
```diff diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c index 18d33bc35dee..949e4115f930 100644 --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c @@ -86,7 +86,7 @@ static inline void ti_sci_pd_set_wkup_constraint(struct device *dev...
3a413ece2504c70aa34a20be4dafec04e8c741f9
Analyze and fix the following issue in the Linux kernel code: nvmet-auth: validate reply message payload bounds against transfer length
Problem Details: nvmet_auth_reply() accesses the variable-length rval[] array using attacker-controlled hl (hash length) and dhvlen (DH value length) fields without verifying they fit within the allocated buffer of tl bytes. A malicious NVMe-oF initiator can craft a DHCHAP_REPLY message with a small transfer length bu...
```diff diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c index f1e613e7c63e..0a85acf1e5c7 100644 --- a/drivers/nvme/target/fabrics-cmd-auth.c +++ b/drivers/nvme/target/fabrics-cmd-auth.c @@ -132,13 +132,22 @@ static u8 nvmet_auth_negotiate(struct nvmet_req *req, void *d) re...
3f63e2545978abda58f2cf7ff0d7a2942965e8cb
Analyze and fix the following issue in the Linux kernel code: Documentation: futex: Add a note about robust list race condition
Problem Details: Add a note to the documentation giving a brief explanation why doing a robust futex release in userspace is racy, what should be done to avoid it and provide links to read more. [ tglx: Fixed a few typos ] Signed-off-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: Thomas Gleixner <tglx@kern...
```diff diff --git a/Documentation/locking/robust-futex-ABI.rst b/Documentation/locking/robust-futex-ABI.rst index f24904f1c16f..5e6a0665b8ba 100644 --- a/Documentation/locking/robust-futex-ABI.rst +++ b/Documentation/locking/robust-futex-ABI.rst @@ -153,6 +153,9 @@ On removal: 3) release the futex lock, and 4) cle...
a2274cc0091ed4fdce10fad68d08c529b8d3e7dd
Analyze and fix the following issue in the Linux kernel code: x86/vdso: Implement __vdso_futex_robust_try_unlock()
Problem Details: When the FUTEX_ROBUST_UNLOCK mechanism is used for unlocking (PI-)futexes, then the unlock sequence in userspace looks like this: 1) robust_list_set_op_pending(mutex); 2) robust_list_remove(mutex); lval = gettid(); 3) if (atomic_try_cmpxchg(&mutex->lock, lval, 0)) 4) robust_list_clear_op_...
```diff diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1ce62a996192..fdaef60b46d6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -239,6 +239,7 @@ config X86 select HAVE_EFFICIENT_UNALIGNED_ACCESS select HAVE_EISA if X86_32 select HAVE_EXIT_THREAD + select HAVE_FUTEX_ROBUST_UNLOCK select HAVE_...
61cfc8e372d1971e0a96d3f1f8b5ee29916b3385
Analyze and fix the following issue in the Linux kernel code: x86/vdso: Prepare for robust futex unlock support
Problem Details: There will be a VDSO function to unlock non-contended robust futexes in user space. The unlock sequence is racy vs. clearing the list_pending_op pointer in the task's robust list head. To plug this race the kernel needs to know the critical section window so it can clear the pointer when the task is in...
```diff diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index a6bfcc8243cd..9a953e7c76db 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -6,6 +6,7 @@ */ #include <linux/mm.h> #include <linux/err.h> +#include <linux/futex.h> #include <linux/sched.h> #include <linux/sche...
7010c39d8fc5063af69ee63f905e592e046f8e5d
Analyze and fix the following issue in the Linux kernel code: futex: Provide infrastructure to plug the non contended robust futex unlock race
Problem Details: When the FUTEX_ROBUST_UNLOCK mechanism is used for unlocking (PI-)futexes, then the unlock sequence in user space looks like this: 1) robust_list_set_op_pending(mutex); 2) robust_list_remove(mutex); lval = gettid(); 3) if (atomic_try_cmpxchg(&mutex->lock, lval, 0)) 4) robust_list_clear_op...
```diff diff --git a/include/linux/futex.h b/include/linux/futex.h index cb2a182547dd..51f4ccdc9092 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h @@ -105,7 +105,41 @@ static inline int futex_hash_free(struct mm_struct *mm) { return 0; } #endif /* !CONFIG_FUTEX */ #ifdef CONFIG_FUTEX_ROBUST_UNLOCK +...
3ca9595d9fb6cce6633a5b03d98c2aecb5499838
Analyze and fix the following issue in the Linux kernel code: futex: Add support for unlocking robust futexes
Problem Details: Unlocking robust non-PI futexes happens in user space with the following sequence: 1) robust_list_set_op_pending(mutex); 2) robust_list_remove(mutex); lval = 0; 3) lval = atomic_xchg(lock, lval); 4) if (lval & WAITERS) 5) sys_futex(WAKE,....); 6) robust_list_clear_op_pending(); That ...
```diff diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h index 75df1eaff75d..10a36c551675 100644 --- a/include/uapi/linux/futex.h +++ b/include/uapi/linux/futex.h @@ -25,8 +25,11 @@ #define FUTEX_PRIVATE_FLAG 128 #define FUTEX_CLOCK_REALTIME 256 +#define FUTEX_ROBUST_UNLOCK 512 +#define FUTEX_RO...
2cb5251d3d64d57c172185b9b608f704b3015f26
Analyze and fix the following issue in the Linux kernel code: futex: Provide UABI defines for robust list entry modifiers
Problem Details: The marker for PI futexes in the robust list is a hardcoded 0x1 which lacks any sensible form of documentation. Provide proper defines for the bit and the mask and fix up the usage sites. Thereby convert the boolean pi argument into a modifier argument, which allows new modifier bits to be trivially a...
```diff diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h index 7e2744ec8933..29bf2f65406a 100644 --- a/include/uapi/linux/futex.h +++ b/include/uapi/linux/futex.h @@ -177,6 +177,10 @@ struct robust_list_head { */ #define ROBUST_LIST_LIMIT 2048 +/* Modifiers for robust_list_head::list_op_pending...
1f7f4816b9b05e5110bc1c8a05c3c478e2dae11b
Analyze and fix the following issue in the Linux kernel code: futex: Move futex related mm_struct data into a struct
Problem Details: Having all these members in mm_struct along with the required #ifdeffery is annoying, does not allow efficient initializing of the data with memset() and makes extending it tedious. Move it into a data structure and fix up all usage sites. The extra struct for the private hash is intentional to make ...
```diff diff --git a/include/linux/futex_types.h b/include/linux/futex_types.h index 9c6c0dc4148d..d41557d2790d 100644 --- a/include/linux/futex_types.h +++ b/include/linux/futex_types.h @@ -3,6 +3,7 @@ #define _LINUX_FUTEX_TYPES_H #ifdef CONFIG_FUTEX +#include <linux/compiler_types.h> #include <linux/mutex_types....
c1ffc9c6e4f8a13dd68e97920c9a24d095c6e41a
Analyze and fix the following issue in the Linux kernel code: futex: Move futex task related data into a struct
Problem Details: Having all these members in task_struct along with the required #ifdeffery is annoying, does not allow efficient initializing of the data with memset() and makes extending it tedious. Move it into a data structure and fix up all usage sites. Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off...
```diff diff --git a/Documentation/locking/robust-futexes.rst b/Documentation/locking/robust-futexes.rst index 6361fb01c9c1..1423f53ea2f4 100644 --- a/Documentation/locking/robust-futexes.rst +++ b/Documentation/locking/robust-futexes.rst @@ -94,7 +94,7 @@ time, the kernel checks this user-space list: are there any rob...
c06cd66387da92e6cdac44e16c7b5ef9219c53ac
Analyze and fix the following issue in the Linux kernel code: percpu: Sanitize __percpu_qual include hell
Problem Details: Slapping __percpu_qual into the next available header is sloppy at best. It's required by __percpu which is defined in compiler_types.h and that is meant to be included without requiring a boatload of other headers so that a struct or function declaration can contain a __percpu qualifier w/o further p...
```diff diff --git a/arch/um/Makefile b/arch/um/Makefile index 721b652ffb65..937639edc295 100644 --- a/arch/um/Makefile +++ b/arch/um/Makefile @@ -71,7 +71,8 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \ -idirafter $(objt...
a13ab9dd6eb2a89f14b466c3884730ea7969253f
Analyze and fix the following issue in the Linux kernel code: cleanup: Remove NULL check from unconditional guards
Problem Details: The unconditional guard destructors check whether the lock pointer is NULL before unlocking. This check is dead code because unconditional guards guarantee a non-NULL lock pointer at destructor time. DEFINE_GUARD() runs the lock operation unconditionally in the constructor. If the pointer were NULL, t...
```diff diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h index 4e60d519713c..65416938e318 100644 --- a/include/linux/cleanup.h +++ b/include/linux/cleanup.h @@ -398,7 +398,7 @@ static __maybe_unused const bool class_##_name##_is_conditional = _is_cond #define DEFINE_GUARD(_name, _type, _lock, _unlock) ...
06961d60a0e410bf8df69ccff7eb1bd824912b8f
Analyze and fix the following issue in the Linux kernel code: lockdep/selftests: Restore sched_rt_mutex state on PREEMPT_RT
Problem Details: The WW-mutex selftests deliberately exercise failing lock paths. On PREEMPT_RT, some of those paths enter the RT-mutex scheduler helpers. The change referenced by the Fixes tag made those helpers track RT-mutex scheduling state in current->sched_rt_mutex. The bit is normally cleared by the matching po...
```diff diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index cb806b628352..bfafe1204c7b 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1433,6 +1433,7 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask) #ifdef CONFIG_PREEMPT_RT int saved_mgd_count = c...
d8c897b20bf4d4cbb1e935a8ceb666bcc0f82580
Analyze and fix the following issue in the Linux kernel code: lockdep/selftests: Restore migrate_disable() state on PREEMPT_RT
Problem Details: The lockdep selftests deliberately run unbalanced locking patterns. dotest() restores the task state they leave behind before running the next testcase. On PREEMPT_RT, spin_lock() uses migrate_disable() instead of disabling preemption. dotest() cleans up the resulting migration-disabled state, but tha...
```diff diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index d939403331b5..cb806b628352 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1431,9 +1431,7 @@ static void dotest(void (*testcase_fn)(void), int expected, int lockclass_mask) { int saved_preempt_count = preempt_count(); #i...