/* * Routine to perform various kinds of write operations to a mapping * that we created. */ void dirty_mapping(struct map *map) { switch (map->prot) { case PROT_WRITE: case PROT_WRITE|PROT_READ: random_map_writefn(map); break; case PROT_READ: random_map_readfn(map); break; case PROT_SEM: case PROT_NONE: default: break; } }
/* * Routine to perform various kinds of write operations to a mapping * that we created. */ void dirty_mapping(struct map *map) { bool rw = RAND_BOOL(); if (rw == TRUE) { /* Check mapping is writable, or we'll segv. * TODO: Perhaps we should do that, and trap it, mark it writable, * then reprotect after we dirtied it ? */ if (!(map->prot & PROT_WRITE)) return; random_map_writefn(map); return; } else { if (!(map->prot & PROT_READ)) return; random_map_readfn(map); } }