diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-03-13 21:22:24 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-03-13 21:24:16 +0100 |
commit | 54c0b9b9dbf72467f099291950680ff8270b02ad (patch) | |
tree | 867839d92f5a70d01493a5a26c7e23581aed9369 /ext2fs/pager.c | |
parent | 5ff93bc7b5727024394a75defbabb0bff9a2820b (diff) |
ext2fs: Trap trying to access bogus data areas
i.e. superblock, block group descriptor table or beyond the end.
Diffstat (limited to 'ext2fs/pager.c')
-rw-r--r-- | ext2fs/pager.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 99dac140..b93a9edd 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -41,6 +41,8 @@ struct pager_requests *file_pager_requests; pthread_spinlock_t node_to_page_lock = PTHREAD_SPINLOCK_INITIALIZER; +static int disk_cache_initialized; + #ifdef DONT_CACHE_MEMORY_OBJECTS #define MAY_CACHE 0 @@ -953,6 +955,7 @@ disk_cache_init (void) assert_backtrace (disk_cache_info[i-fixed_first].block == i); disk_cache_info[i-fixed_first].flags |= DC_FIXED; } + disk_cache_initialized = 1; } static void @@ -1022,7 +1025,10 @@ disk_cache_block_ref (block_t block) void *bptr; hurd_ihash_locp_t slot; - assert_backtrace (block < store->size >> log2_block_size); + /* Trap trying to map superblock, block group descriptor table, or beyond the end */ + if (disk_cache_initialized) + assert_backtrace (block >= group_desc_block_end + && block < store->size >> log2_block_size); ext2_debug ("(%u)", block); |