fs/ext: Support INCOMPAT_EXTENTS, RO_COMPAT_DIR_NLINK, RO_COMPAT_HUGE_FILE. #603
Open
Matou1306
wants to merge 15 commits from
Matou1306/kolibrios:extents into main
pull from: Matou1306/kolibrios:extents
merge into: :main
:main
:hdaudio-irq-polling
:egor00f-patch-1
:opendial-update
:msgbox-update
:rdsave-rewrite
:krn_refactoring_curr_slot_idx_1
:fat-fix-stack-imbalance
:kernel-tcp-socket-buffer-128k
:fix_602
:kernel-tcp-socket-list-locking
:network/getsockname
:kernel-tcp-reassembly-queue
:kernel-tcp-connrefused-uaf
:rewrite_ide_drv
:libimg-png-8-bit
:apps/table-msvc-to-tcc
:netsurf-4
:vidmode-s3ide-clgd54xx-kms-etc
:updf-1.5
:pr-fs-unhardcode
:kbd-busoff
:webview-4
:workflow-fuse
:add-license-file-header-to-guide
:shell-improve-cpuid
:qrcodegen
:ci/update
:laser-tank-fix-win-height
:improvement/commit-and-branch-styles
:docs/libs
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Influence/Text/TYPO
AI
Eolite
FS
GSoC
Good First PR
HLL
HardwareTested
IRCC
Influence/Settings
Lang/C
Lang/FASM
Pay for the code
Subsystem/API
Subsystem/Audio
Subsystem/Graphics
Subsystem/IPC and events
Subsystem/Memory
Subsystem/Network
Subsystem/Services(daemon)
Subsystem/Taskmanager
Subsystem/VFS
Subsystem/Window
This issue or PR in the Google Source of Code program
The issue is suitable to beginners
Paid task
infinity service, audio drivers, midi, speacker, audio programs
vesa, vga, framebuffer, cursors, blitter, and video drivers
pipes, signals, events, shared memory
virt and phys memory allocators, malloc and other
userspace and kernel(for example: serial) services
process, threads, run apps, scheduler
drivers from filesystem, fs api, blkdev, programs that work with the file system
windows, skins, buttons, mouse and keyboard code for windows (not the base code)
Category
Applications
Category
Drivers
Category
General
Category
Kernel
Category
Libraries
Kind
Breaking
Breaking change that won't be backward compatible
Kind
Bug
Something is not working
Kind
Build
Kind
Documentation
Documentation changes
Kind
Enhancement
Improve existing functionality
Kind
Feature
New functionality
Kind
Security
This is security issue
Kind
Testing
Issue or pull request related to testing
PR
Ready to merge
Pull request is ready for merge
PR
Conflicts
PR conflicts with main
PR
Dependent
This PR is dependent on another PR
PR
Request changes
Changes requested in pull request
PR
Review required
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: KolibriOS/kolibrios#603
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Extents writing support.
In addition, the file system can now write to file systems with dir_nlink, as long as the target directory doesn't have the index flag enabled (directories exceeding 64k subdirectories). It also supports huge_file, as long as the huge_file inode flag is not enabled on the file itself (files > 2TB).
This Pull Request depends on #584
What currently works:
3bf4e317catocf370a4220fb314654e6to69bcdc89f3@Burer @dunkaist This PR is finally supposedly complete, please review when you have time and feel free to test it, I will try to post a script or something to easily test soon.
🔴 Unbounded tree descent → heap overflow.
extfsGetLastLeafdescends viaINDEX.nodeBlockand writes 8 bytes per index level intoedi, which callers point atEXTFS.extentBreadcrumbs-rb 40, i.e. exactly 5 slots, and the last field of the struct. The descent is bounded only by each node's on-diskcurrentDepth; there's no depth counter and no check against the 40-byte end. A crafted ext4 image with an index chain deeper than 5 (valid0xF30Amagic,currentDepth != 0) writes past the struct → ring0 heap corruption. Threat model is real: KolibriOS mounts removable media, and any write/delete on an RW-mounted image reaches this viaextfsExtendExtent/extfsTruncateExtent.🟡
entriesMaxfrom disk is trusted without an upper bound. In the ascend path, index nodes read from disk supplyentriesMax, and whenentriesFolow < entriesMaxthe code writes[esi + ecx*sizeof.INDEX + …]into the 4 KB block buffer. A forgedentriesMaxlarger than fits in one block writes pasttempBlockBuffer. Your own computedentriesMax(Split/CreateLeaf) is fine; the disk-read nodes are not validated.🔵 The PR description says "up to 4 extents", but the code already does multi-level trees (root split, ascent through index nodes). Please sync the description and state what was actually exercised.
🔵 This PR conflicts with previously merged #584, so update it and relsolve conflict, please.
df6c428672to344f6bd5afHi @Burer please check the latest commit. The changes should be done, please let me know if there is something else.
344f6bd5afto9d681467489d68146748to8750837c248750837c24to29b350134eView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.