Skip to content

[ciqcbr7_9] Multiple patches tested (2 commits) - #1579

Open
ciq-kernel-automation[bot] wants to merge 2 commits into
ciqcbr7_9from
{ciq_kernel_automation}_ciqcbr7_9
Open

[ciqcbr7_9] Multiple patches tested (2 commits)#1579
ciq-kernel-automation[bot] wants to merge 2 commits into
ciqcbr7_9from
{ciq_kernel_automation}_ciqcbr7_9

Conversation

@ciq-kernel-automation

Copy link
Copy Markdown

Summary

This PR has been automatically created after successful completion of all CI stages.

Commit Message(s)

dm log: fix out-of-bounds write due to region_count overflow

jira VULN-189555
cve CVE-2026-53059
commit-author Junrui Luo <moonafterrain@outlook.com>
commit c20e36b7631d83e7535877f08af8b0af72c44b1a
dm-log: fix a bitset_size overflow on 32bit machines

jira VULN-200611
cve CVE-2026-72105
commit-author Benjamin Marzinski <bmarzins@redhat.com>
commit 9743132a41f4d9d0e54c5f2adcb821b04796bab1

Test Results

✅ Build Stage

  • Status: Passed (x86_64)

  • Build Time: 9m 53s

  • Total Time: 10m 53s

  • View build logs

✅ Boot Verification


🤖 This PR was automatically generated by GitHub Actions
Run ID: 34090675034

CIQ Kernel Automation added 2 commits September 7, 2026 06:21
jira VULN-189555
cve CVE-2026-53059
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: CIQ Kernel Automation <ciq_kernel_automation@ciq.com>
jira VULN-200611
cve CVE-2026-72105
commit-author Benjamin Marzinski <bmarzins@redhat.com>
commit 9743132

Commit c20e36b ("dm log: fix out-of-bounds write due to
region_count overflow") made sure that region_count could fit in an
unsigned int. But the bitmap memory isn't allocated based on
region_count. It uses bitset_size (a size_t variable). The first step of
calculating bitset_size is to set it to region_count, rounded up to a
multiple of BITS_PER_LONG. If region_size is less than BITS_PER_LONG
smaller than UINT_MAX, it will get rounded up to 2^32. On a 32bit
architecture, this will make bitset_size wrap around to 0 and fail,
despite region_count being valid.

Since bitset_size gets divided by 8, it can hold any valid region_count.
It just needs a special case to handle the rollover. If it is 0, the
value rolled over, and bitset size should be set to the number of bytes
needed to hold 2^32 bits.

	Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
	Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: c20e36b ("dm log: fix out-of-bounds write due to region_count overflow")
	Cc: stable@vger.kernel.org
(cherry picked from commit 9743132)
	Signed-off-by: CIQ Kernel Automation <ciq_kernel_automation@ciq.com>
@ciq-kernel-automation ciq-kernel-automation Bot added the created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI) label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/34093295598

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

🔍 Interdiff Analysis

  • ⚠️ PR commit 7eb70cf43039 (dm log: fix out-of-bounds write due to region_count overflow) → upstream c20e36b7631d
    Differences found:
================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -394,3 +401,3 @@
 
-	lc = kmalloc(sizeof(*lc), GFP_KERNEL);
+	lc = kmalloc_obj(*lc);
 	if (!lc) {
  • ⚠️ PR commit 16c927000290 (dm-log: fix a bitset_size overflow on 32bit machines) → upstream 9743132a41f4
    Differences found:
================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -417,5 +417,5 @@
-	bitset_size = dm_round_up(region_count,
-				  sizeof(*lc->clean_bits) << BYTE_SHIFT);
+	 */
+	bitset_size = dm_round_up(region_count, BITS_PER_LONG);
 	bitset_size >>= BYTE_SHIFT;
 
 	lc->bitset_uint32_count = bitset_size / sizeof(*lc->clean_bits);

This is an automated interdiff check for backported commits.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/34093295598

@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 September 8, 2026 15:45

@PlaidCat PlaidCat 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.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI)

Development

Successfully merging this pull request may close these issues.

2 participants