mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
Kernel: Don't trigger page faults during profiling stack walk
The kernel sampling profiler will walk thread stacks during the timer tick handler. Since it's not safe to trigger page faults during IRQ's, we now avoid this by checking the page tables manually before accessing each stack location.
This commit is contained in:
parent
f9a138aa4b
commit
59b9e49bcd
4 changed files with 31 additions and 1 deletions
|
@ -813,7 +813,7 @@ Vector<uintptr_t> Thread::raw_backtrace(uintptr_t ebp) const
|
|||
ProcessPagingScope paging_scope(process);
|
||||
Vector<uintptr_t, Profiling::max_stack_frame_count> backtrace;
|
||||
backtrace.append(ebp);
|
||||
for (uintptr_t* stack_ptr = (uintptr_t*)ebp; process.validate_read_from_kernel(VirtualAddress(stack_ptr), sizeof(uintptr_t) * 2); stack_ptr = (uintptr_t*)*stack_ptr) {
|
||||
for (uintptr_t* stack_ptr = (uintptr_t*)ebp; MM.can_read_without_faulting(process, VirtualAddress(stack_ptr), sizeof(uintptr_t) * 2); stack_ptr = (uintptr_t*)*stack_ptr) {
|
||||
uintptr_t retaddr = stack_ptr[1];
|
||||
backtrace.append(retaddr);
|
||||
if (backtrace.size() == Profiling::max_stack_frame_count)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue