Changeset 176 for trunk/kernel/mm


Ignore:
Timestamp:
Jul 11, 2017, 12:40:54 PM (7 years ago)
Author:
max@…
Message:

detect use-after-frees

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/kcm.c

    r161 r176  
    106106        index = ((uint8_t *)ptr - (uint8_t *)kcm_page - CONFIG_KCM_SLOT_SIZE) / kcm->block_size;
    107107
     108        assert( !bitmap_state( kcm_page->bitmap , index ) , __FUNCTION__ , "page already freed" );
     109        assert( (kcm_page->count > 0) , __FUNCTION__ , "count already zero" );
     110
    108111        bitmap_set( kcm_page->bitmap , index );
    109112        kcm_page->count --;
Note: See TracChangeset for help on using the changeset viewer.