mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	DynamicLoader: Ensure that backtrace computation stops at _start
				
					
				
			If we don't set FP and LR to 0, the Kernel might not stop generating backtraces when it reaches `_start`'s stack frame, and might continue by reading garbage memory instead. This leads to a kernel panic, as SafeMem access faults aren't handled properly in the AArch64 kernel yet. We might want to ensure that the kernel zeroes out all registers when a new process is created.
This commit is contained in:
		
							parent
							
								
									ff2fa72e28
								
							
						
					
					
						commit
						f18e7659a6
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -63,7 +63,11 @@ void _entry(int, char**, char**) __attribute__((used)); | |||
| NAKED void _start(int, char**, char**) | ||||
| { | ||||
| #if ARCH(AARCH64) | ||||
|     // Make sure backtrace computation stops here by setting FP and LR to 0.
 | ||||
|     // FIXME: The kernel should ensure that registers are zeroed on program start
 | ||||
|     asm( | ||||
|         "mov x29, 0\n" | ||||
|         "mov x30, 0\n" | ||||
|         "bl _entry\n"); | ||||
| #else | ||||
|     asm( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Bertalan
						Daniel Bertalan