mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:02:45 +00:00 
			
		
		
		
	UserspaceEmulator: Update memory protection of underlying pages
If a MmapRegion is file backed, we need to call mprotect on its underlying pages.
This commit is contained in:
		
							parent
							
								
									93b68f5566
								
							
						
					
					
						commit
						d2262b8f6d
					
				
					 2 changed files with 11 additions and 6 deletions
				
			
		|  | @ -207,4 +207,14 @@ void MmapRegion::write64(u32 offset, ValueWithShadow<u64> value) | |||
|     *reinterpret_cast<u64*>(m_shadow_data + offset) = value.shadow(); | ||||
| } | ||||
| 
 | ||||
| void MmapRegion::set_prot(int prot) | ||||
| { | ||||
|     set_readable(prot & PROT_READ); | ||||
|     set_writable(prot & PROT_WRITE); | ||||
|     set_executable(prot & PROT_EXEC); | ||||
|     if (m_file_backed) { | ||||
|         mprotect(m_data, size(), prot); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Itamar
						Itamar