fs/ext2: support legacy Rev0 superblocks #421

Merged
Burer merged 3 commits from Matou1306/kolibrios:ext2-good-old-rev0 into main 2026-05-30 05:07:24 +00:00
Contributor

Ext2 Rev0 superblocks lack dynamic fields. Add fallback logic to check for EXT2_GOOD_OLD_REV and manually populate in-memory inodeSize (128) and firstInode (11). 

Introduce standard EXT2_GOOD_OLD_* constants aligning with Linux kernel approach for the same issue.

This aligns with what the Linux Kernel does.

Ext2 Rev0 superblocks lack dynamic fields. Add fallback logic to check for EXT2_GOOD_OLD_REV and manually populate in-memory inodeSize (128) and firstInode (11).  Introduce standard EXT2_GOOD_OLD_* constants aligning with Linux kernel approach for the same issue. This aligns with [what the Linux Kernel does](https://github.com/torvalds/linux/blob/master/fs/ext2/super.c#L1036-L1039).
dunkaist requested review from dunkaist 2026-04-15 12:41:03 +00:00
Owner

@Matou1306, were you able to find or create a revision 0 FS to test this change?

@Matou1306, were you able to find or create a revision 0 FS to test this change?
Matou1306 added 2 commits 2026-04-20 23:20:14 +00:00
Ext2 Rev0 superblocks lack dynamic fields. Add fallback logic to check for EXT2_GOOD_OLD_REV and manually populate in-memory inodeSize (128) and firstInode (11). 

Introduce standard EXT2_GOOD_OLD_* constants aligning with Linux kernel approach for the same issue.
codestyle
Build system / Check kernel codestyle (pull_request) Successful in 2m13s
Build system / Build (pull_request) Successful in 18m57s
bddaf56c95
Matou1306 force-pushed ext2-good-old-rev0 from 7972a6baff to bddaf56c95 2026-04-20 23:20:14 +00:00 Compare
Owner

@Matou1306, what about the fields s_feature_compat, s_feature_incompat, and s_feature_ro_compat? If I understand correctly, they are present only in revision 1 superblocks, but the current code reads them always. Do I miss anything?

@Matou1306, what about the fields s_feature_compat, s_feature_incompat, and s_feature_ro_compat? If I understand correctly, they are present only in revision 1 superblocks, but the current code reads them always. Do I miss anything?
Matou1306 added 1 commit 2026-05-20 11:19:46 +00:00
merge upstream
Build system / Check kernel codestyle (pull_request) Successful in 33s
Build system / Build (pull_request) Successful in 9m43s
7a0917fbe9
Author
Contributor

@dunkaist For the features they don't cause any errors in the original rev0. The usable superblock fields were indeed only 84 bytes but the superblock size is 1024, so the remaining is explicitly zeroed out.

I also made the test and opened a PR on umka, it only tests ls70, without the fix this outputs file system error, with the fix it reads it normally. I tried read70 but it resulted in access denied (I guess that's because it's the superblock)

I created the image with mkfs but manually matched the rev0 partition style from the hdd loop device you sent me before.

@dunkaist For the features they don't cause any errors in the original rev0. The usable superblock fields were indeed only 84 bytes but the superblock size is 1024, so the remaining is explicitly zeroed out. I also made the test and opened a PR on umka, it only tests ls70, without the fix this outputs file system error, with the fix it reads it normally. I tried read70 but it resulted in access denied (I guess that's because it's the superblock) I created the image with mkfs but manually matched the rev0 partition style from the hdd loop device you sent me before.
Owner

the remaining is explicitly zeroed out

Is this guaranteed by the spec for all cases, or is it so just for the particular test image?

> the remaining is explicitly zeroed out Is this guaranteed by the spec for all cases, or is it so just for the particular test image?
Author
Contributor

I saw the linux kernel completely ignores this, so it seems like it is indeed filled out with 0s. Not doing so can also be a vulnerability since the garbage data that would've been filled isn't actually garbage and might contain sensitive data, writing this to the disk wouldn't have been a safe practice

I saw the linux kernel completely ignores this, so it seems like it is indeed filled out with 0s. Not doing so can also be a vulnerability since the garbage data that would've been filled isn't actually garbage and might contain sensitive data, writing this to the disk wouldn't have been a safe practice
dunkaist approved these changes 2026-05-26 15:20:33 +00:00
dunkaist requested review from Burer 2026-05-26 15:21:18 +00:00
dunkaist requested review from Doczom 2026-05-26 15:21:18 +00:00
Doczom approved these changes 2026-05-29 18:03:42 +00:00
Burer merged commit 779ea18d4e into main 2026-05-30 05:07:23 +00:00
Burer deleted branch ext2-good-old-rev0 2026-05-30 05:07:24 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#421