mirror of
				https://github.com/GrapheneOS/hardened_malloc.git
				synced 2025-11-04 01:36:33 +01:00 
			
		
		
		
	add missing thread unseal / seal for atfork hooks
This commit is contained in:
		
							parent
							
								
									9d1567ce16
								
							
						
					
					
						commit
						299bd6d414
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		
							
								
								
									
										6
									
								
								malloc.c
									
										
									
									
									
								
							
							
						
						
									
										6
									
								
								malloc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -757,20 +757,25 @@ static void regions_delete(struct region_metadata *region) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void full_lock(void) {
 | 
			
		||||
    thread_unseal_metadata();
 | 
			
		||||
    mutex_lock(&ro.region_allocator->lock);
 | 
			
		||||
    for (unsigned class = 0; class < N_SIZE_CLASSES; class++) {
 | 
			
		||||
        mutex_lock(&ro.size_class_metadata[class].lock);
 | 
			
		||||
    }
 | 
			
		||||
    thread_seal_metadata();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void full_unlock(void) {
 | 
			
		||||
    thread_unseal_metadata();
 | 
			
		||||
    mutex_unlock(&ro.region_allocator->lock);
 | 
			
		||||
    for (unsigned class = 0; class < N_SIZE_CLASSES; class++) {
 | 
			
		||||
        mutex_unlock(&ro.size_class_metadata[class].lock);
 | 
			
		||||
    }
 | 
			
		||||
    thread_seal_metadata();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void post_fork_child(void) {
 | 
			
		||||
    thread_unseal_metadata();
 | 
			
		||||
    mutex_init(&ro.region_allocator->lock);
 | 
			
		||||
    random_state_init(&ro.region_allocator->rng);
 | 
			
		||||
    for (unsigned class = 0; class < N_SIZE_CLASSES; class++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -778,6 +783,7 @@ static void post_fork_child(void) {
 | 
			
		|||
        mutex_init(&c->lock);
 | 
			
		||||
        random_state_init(&c->rng);
 | 
			
		||||
    }
 | 
			
		||||
    thread_seal_metadata();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline bool is_init(void) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue