Skip to content

[ciqcbr7_9] Multiple patches tested (2 commits)#1157

Open
ciq-kernel-automation[bot] wants to merge 2 commits intociqcbr7_9from
{roxanan}_ciqcbr7_9
Open

[ciqcbr7_9] Multiple patches tested (2 commits)#1157
ciq-kernel-automation[bot] wants to merge 2 commits intociqcbr7_9from
{roxanan}_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)

Squashfs: check return result of sb_min_blocksize

jira VULN-79855
cve CVE-2025-38415
commit-author Phillip Lougher <phillip@squashfs.org.uk>
commit 734aa85390ea693bb7eaf2240623d41b03705c84
upstream-diff |
	Replaced errorf with ERROR due to missing 5a2be1288b51
	("vfs: Convert squashfs to use the new mount API") and
	c6b82263f9c6 ("vfs: Introduce logging functions") its deps.
squashfs: fix memory leak in squashfs_fill_super

jira VULN-79855
cve-bf CVE-2025-38415
commit-author Phillip Lougher <phillip@squashfs.org.uk>
commit b64700d41bdc4e9f82f1346c15a3678ebb91a89c
upstream-diff |
	Replaced errorf with ERROR due to missing 5a2be1288b51
	("vfs: Convert squashfs to use the new mount API") and
	c6b82263f9c6 ("vfs: Introduce logging functions") its deps.

Test Results

✅ Build Stage

  • Status: Passed (x86_64)

  • Build Time: 12m 43s

  • Total Time: 13m 51s

  • View build logs

✅ Boot Verification


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

jira VULN-79855
cve CVE-2025-38415
commit-author Phillip Lougher <phillip@squashfs.org.uk>
commit 734aa85
upstream-diff |
	Replaced errorf with ERROR due to missing 5a2be12
	("vfs: Convert squashfs to use the new mount API") and
	c6b8226 ("vfs: Introduce logging functions") its deps.

Syzkaller reports an "UBSAN: shift-out-of-bounds in squashfs_bio_read" bug.

Syzkaller forks multiple processes which after mounting the Squashfs
filesystem, issues an ioctl("/dev/loop0", LOOP_SET_BLOCK_SIZE, 0x8000).
Now if this ioctl occurs at the same time another process is in the
process of mounting a Squashfs filesystem on /dev/loop0, the failure
occurs.  When this happens the following code in squashfs_fill_super()
fails.

----
msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
msblk->devblksize_log2 = ffz(~msblk->devblksize);
----

sb_min_blocksize() returns 0, which means msblk->devblksize is set to 0.

As a result, ffz(~msblk->devblksize) returns 64, and msblk->devblksize_log2
is set to 64.

This subsequently causes the

UBSAN: shift-out-of-bounds in fs/squashfs/block.c:195:36
shift exponent 64 is too large for 64-bit type 'u64' (aka
'unsigned long long')

This commit adds a check for a 0 return by sb_min_blocksize().

Link: https://lkml.kernel.org/r/20250409024747.876480-1-phillip@squashfs.org.uk
Fixes: 0aa6661 ("Squashfs: super block operations")
	Reported-by: syzbot+65761fc25a137b9c8c6e@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/67f0dd7a.050a0220.0a13.0230.GAE@google.com/
	Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
	Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 734aa85)
	Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
jira VULN-79855
cve-bf CVE-2025-38415
commit-author Phillip Lougher <phillip@squashfs.org.uk>
commit b64700d
upstream-diff |
	Replaced errorf with ERROR due to missing 5a2be12
	("vfs: Convert squashfs to use the new mount API") and
	c6b8226 ("vfs: Introduce logging functions") its deps.

If sb_min_blocksize returns 0, squashfs_fill_super exits without freeing
allocated memory (sb->s_fs_info).

Fix this by moving the call to sb_min_blocksize to before memory is
allocated.

Link: https://lkml.kernel.org/r/20250811223740.110392-1-phillip@squashfs.org.uk
Fixes: 734aa85 ("Squashfs: check return result of sb_min_blocksize")
	Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
	Reported-by: Scott GUO <scottzhguo@tencent.com>
Closes: https://lore.kernel.org/all/20250811061921.3807353-1-scott_gzh@163.com
	Cc: <stable@vger.kernel.org>
	Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit b64700d)
	Signed-off-by: Roxana Nicolescu <rnicolescu@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 Apr 29, 2026
@github-actions
Copy link
Copy Markdown

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

@github-actions
Copy link
Copy Markdown

🔍 Interdiff Analysis

  • ⚠️ PR commit 6e8ce8c36260 (Squashfs: check return result of sb_min_blocksize) → upstream 734aa85390ea
    Differences found:
================================================================================
*    DELTA DIFFERENCES - code changes that differ between the patches          *
================================================================================

--- b/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -97,7 +97,7 @@
 
 	msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
 	if (!msblk->devblksize) {
-		ERROR("squashfs: unable to set blocksize\n");
+		errorf(fc, "squashfs: unable to set blocksize\n");
 		return -EINVAL;
 	}
 

================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -93,5 +94,5 @@
 
 	msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
 	msblk->devblksize_log2 = ffz(~msblk->devblksize);
 
-	mutex_init(&msblk->read_data_mutex);
+	mutex_init(&msblk->meta_index_mutex);
  • ⚠️ PR commit 28daee59a008 (squashfs: fix memory leak in squashfs_fill_super) → upstream b64700d41bdc
    Differences found:
================================================================================
*    DELTA DIFFERENCES - code changes that differ between the patches          *
================================================================================

--- b/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -89,7 +89,7 @@
 	TRACE("Entered squashfs_fill_superblock\n");
 
 	if (!devblksize) {
-		ERROR("squashfs: unable to set blocksize\n");
+		errorf(fc, "squashfs: unable to set blocksize\n");
 		return -EINVAL;
 	}
 
@@ -100,7 +100,12 @@
 	}
 	msblk = sb->s_fs_info;
 
-	msblk->devblksize = devblksize;
+	msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
+	if (!msblk->devblksize) {
+		ERROR("squashfs: unable to set blocksize\n");
+		return -EINVAL;
+	}
+
 	msblk->devblksize_log2 = ffz(~msblk->devblksize);
 
 	mutex_init(&msblk->read_data_mutex);

################################################################################
!    REJECTED PATCH2 HUNKS - could not be compared; manual review needed       !
################################################################################

--- b/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -206,12 +211,7 @@
 
 	msblk->panic_on_errors = (opts->errors == Opt_errors_panic);
 
-	msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
-	if (!msblk->devblksize) {
-		errorf(fc, "squashfs: unable to set blocksize\n");
-		return -EINVAL;
-	}
-
+	msblk->devblksize = devblksize;
 	msblk->devblksize_log2 = ffz(~msblk->devblksize);
 
 	mutex_init(&msblk->meta_index_mutex);

================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -91,12 +194,12 @@
-	}
-	msblk = sb->s_fs_info;
+
+	msblk->panic_on_errors = (opts->errors == Opt_errors_panic);
 
 	msblk->devblksize = sb_min_blocksize(sb, SQUASHFS_DEVBLK_SIZE);
 	if (!msblk->devblksize) {
-		ERROR("squashfs: unable to set blocksize\n");
+		errorf(fc, "squashfs: unable to set blocksize\n");
 		return -EINVAL;
 	}
 
 	msblk->devblksize_log2 = ffz(~msblk->devblksize);
 
-	mutex_init(&msblk->read_data_mutex);
+	mutex_init(&msblk->meta_index_mutex);

This is an automated interdiff check for backported commits.

@github-actions
Copy link
Copy Markdown

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

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.

1 participant