mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:42:45 +00:00 
			
		
		
		
	Kernel: Don't blindly dereference Process::executable()
When setting up profiling, don't assume that the profiled process has a valid executable.
This commit is contained in:
		
							parent
							
								
									9632388bed
								
							
						
					
					
						commit
						79e79ad1d2
					
				
					 1 changed files with 4 additions and 5 deletions
				
			
		|  | @ -40,7 +40,6 @@ namespace Profiling { | ||||||
| static KBufferImpl* s_profiling_buffer; | static KBufferImpl* s_profiling_buffer; | ||||||
| static size_t s_slot_count; | static size_t s_slot_count; | ||||||
| static size_t s_next_slot_index; | static size_t s_next_slot_index; | ||||||
| static Process* s_process; |  | ||||||
| static u32 s_pid; | static u32 s_pid; | ||||||
| 
 | 
 | ||||||
| String& executable_path() | String& executable_path() | ||||||
|  | @ -58,9 +57,10 @@ u32 pid() | ||||||
| 
 | 
 | ||||||
| void start(Process& process) | void start(Process& process) | ||||||
| { | { | ||||||
|     s_process = &process; |     if (process.executable()) | ||||||
| 
 |  | ||||||
|         executable_path() = process.executable()->absolute_path().impl(); |         executable_path() = process.executable()->absolute_path().impl(); | ||||||
|  |     else | ||||||
|  |         executable_path() = {}; | ||||||
|     s_pid = process.pid(); |     s_pid = process.pid(); | ||||||
| 
 | 
 | ||||||
|     if (!s_profiling_buffer) { |     if (!s_profiling_buffer) { | ||||||
|  | @ -87,7 +87,6 @@ Sample& next_sample_slot() | ||||||
| 
 | 
 | ||||||
| void stop() | void stop() | ||||||
| { | { | ||||||
|     s_process = nullptr; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void did_exec(const String& new_executable_path) | void did_exec(const String& new_executable_path) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling