mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:42:45 +00:00 
			
		
		
		
	DynamicLoader: Make heuristic for running directly actually correct
When we run directly the dynamic loader, we shouldn't rely on the passed program path to be run, but rather on whether the main program fd number is not -1, because the kernel will set it to a non-negative number if it exists. To test that the heuristic is working correctly, the /usr/lib/Loader.so file can be copied to /tmp/Loader.so and then be invoked from that path.
This commit is contained in:
		
							parent
							
								
									69b97fe318
								
							
						
					
					
						commit
						a8601b4ac7
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -136,7 +136,7 @@ void _entry(int argc, char** argv, char** envp) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (main_program_path == "/usr/lib/Loader.so"sv) { |     if (main_program_fd == -1) { | ||||||
|         // We've been invoked directly as an executable rather than as the
 |         // We've been invoked directly as an executable rather than as the
 | ||||||
|         // ELF interpreter for some other binary. The second argv string should
 |         // ELF interpreter for some other binary. The second argv string should
 | ||||||
|         // be the path to the ELF executable, and if we don't have enough strings in argv
 |         // be the path to the ELF executable, and if we don't have enough strings in argv
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A