mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	UserspaceEmulator: Honor the read/write/execute bits in mmap regions
UE will now correctly crash when accessing an mmap memory region in some way it's not supposed to be accessed.
This commit is contained in:
		
							parent
							
								
									ef9ac8a8a2
								
							
						
					
					
						commit
						d4509647d8
					
				
					 5 changed files with 72 additions and 5 deletions
				
			
		|  | @ -920,9 +920,17 @@ u32 Emulator::virt$unveil(u32) | |||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| u32 Emulator::virt$mprotect(FlatPtr, size_t, int) | ||||
| u32 Emulator::virt$mprotect(FlatPtr base, size_t size, int prot) | ||||
| { | ||||
|     return 0; | ||||
|     if (auto* region = mmu().find_region({ m_cpu.ds(), base })) { | ||||
|         if (!region->is_mmap()) | ||||
|             return -EINVAL; | ||||
|         ASSERT(region->size() == size); | ||||
|         auto& mmap_region = *(MmapRegion*)region; | ||||
|         mmap_region.set_prot(prot); | ||||
|         return 0; | ||||
|     } | ||||
|     return -EINVAL; | ||||
| } | ||||
| 
 | ||||
| u32 Emulator::virt$madvise(FlatPtr, size_t, int) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling