Fix ZFS panic on space map corruption #17812#17870
Open
tidjean wants to merge 3 commits intoopenzfs:masterfrom
Open
Fix ZFS panic on space map corruption #17812#17870tidjean wants to merge 3 commits intoopenzfs:masterfrom
tidjean wants to merge 3 commits intoopenzfs:masterfrom
Conversation
Add defensive validation to prevent kernel panics when corrupted space map data is encountered during pool import. Instead of panicking, the system now logs corruption and continues in read-only mode. Changes: - space_map.c: Add bounds checking in space_map_load_callback to skip zero-sized and out-of-bounds entries - range_tree.c: Add defensive check in zfs_range_tree_remove_impl to detect corrupted segment bounds and recover gracefully Signed-off-by: Tidjean <tidjean@gmail.com>
Member
|
On a quick look this looks like a pretty narrow solution. Please see this discussion: #17094 (comment). |
alek-p
added a commit
to alek-p/openzfs
that referenced
this pull request
Jan 12, 2026
…p corruption - Add configuration check for simple_fillattr which replaces generic_fillattr in Linux 6.13. - Update vfs_compat.h and zpl_ctldir.c to use simple_fillattr when available. - Update zfs_vnops_os.c to support HAVE_SIMPLE_FILLATTR. - Make zfs_range_tree_remove_impl and space_map_load_callback robust against corruption by using zfs_panic_recover instead of panic or assertions. - This addresses issues openzfs#18094, openzfs#17870, openzfs#17812.
alek-p
added a commit
to alek-p/openzfs
that referenced
this pull request
Jan 12, 2026
…p corruption - Add configuration check for simple_fillattr which replaces generic_fillattr in Linux 6.13. - Update vfs_compat.h and zpl_ctldir.c to use simple_fillattr when available. - Update zfs_vnops_os.c to support HAVE_SIMPLE_FILLATTR. - Make zfs_range_tree_remove_impl and space_map_load_callback robust against corruption by using zfs_panic_recover instead of panic or assertions. - This addresses issues openzfs#18094, openzfs#17870, openzfs#17812. closes #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add defensive validation to prevent kernel panics when corrupted space map data is encountered during pool import. Instead of panicking, the system now logs corruption and continues in read-only mode.
Changes:
Motivation and Context
Description
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by.