CVE-2022-50478: nilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()
In the Linux kernel, the following vulnerability has been resolved:
nilfs2: fix shift-out-of-bounds/overflow in nilfssb2badoffset()
Patch series "nilfs2: fix UBSAN shift-out-of-bounds warnings on mount time".
The first patch fixes a bug reported by syzbot, and the second one fixes the remaining bug of the same kind. Although they are triggered by the same super block data anomaly, I divided it into the above two because the details of the issues and how to fix it are different.
Both are required to eliminate the shift-out-of-bounds issues at mount time.
This patch (of 2):
If the block size exponent information written in an on-disk superblock is corrupted, nilfssb2badoffset helper function can trigger shift-out-of-bounds warning followed by a kernel panic (if paniconwarn is set):
shift exponent 38983 is too large for 64-bit type 'unsigned long long' Call Trace: <TASK> dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x1b1/0x28e lib/dumpstack.c:106 ubsanepilogue lib/ubsan.c:151 [inline] ubsanhandleshiftoutofbounds+0x33d/0x3b0 lib/ubsan.c:322 nilfssb2badoffset fs/nilfs2/thenilfs.c:449 [inline] nilfsloadsuperblock+0xdf5/0xe00 fs/nilfs2/thenilfs.c:523 initnilfs+0xb7/0x7d0 fs/nilfs2/thenilfs.c:577 nilfsfillsuper+0xb1/0x5d0 fs/nilfs2/super.c:1047 nilfsmount+0x613/0x9b0 fs/nilfs2/super.c:1317 ...
In addition, since nilfssb2badoffset() performs multiplication without considering the upper bound, the computation may overflow if the disk layout parameters are not normal.
This fixes these issues by inserting preliminary sanity checks for those parameters and by converting the comparison from one involving multiplication and left bit-shifting to one using division and right bit-shifting.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2022-50478?
CVE-2022-50478 is classified as a low-severity vulnerability impacting the Linux kernel.
How do I fix CVE-2022-50478?
To fix CVE-2022-50478, update to the patched version of the Linux kernel that addresses the nilfs2 shift-out-of-bounds vulnerability.
Which versions of the Linux kernel are affected by CVE-2022-50478?
CVE-2022-50478 affects specific versions of the Linux kernel with nilfs2 support prior to the patch release.
What type of issue does CVE-2022-50478 represent?
CVE-2022-50478 represents a shift-out-of-bounds/overflow vulnerability that can occur in the nilfs2 file system.
Is CVE-2022-50478 exploitable by attackers?
While CVE-2022-50478 has a low severity, it may still pose a risk if an attacker can manipulate nilfs2 file system operations.