fix (stack-tracing): added rip memory region check for process resolving

This commit is contained in:
antifallobst 2023-03-10 02:30:22 +01:00
parent 3d0aedeeca
commit ed490817e2
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@
*/ */
#include "mm/stack.h" #include "mm/stack.h"
#include "mm/region.h"
#include "utils/logger.h" #include "utils/logger.h"
#include "proc/scheduler.h" #include "proc/scheduler.h"
@ -31,7 +32,7 @@ void stack_dump_call_info(uint64_t rip, symbol_T* symbol) {
void stack_trace_call_stack(uint64_t rbp) { void stack_trace_call_stack(uint64_t rbp) {
uint64_t rip = ((uint64_t*)rbp)[1]; uint64_t rip = ((uint64_t*)rbp)[1];
process_T* process = scheduler_get_current_process(); process_T* process = rip >= MEM_REGION_KERNEL ? scheduler_get_process(PROCESS_KERNEL) : scheduler_get_current_process();
if (process == NULL) { if (process == NULL) {
log(LOG_NONE, " 0x%x -> <failed to resolve symbol> (process NULL reference)", rip); log(LOG_NONE, " 0x%x -> <failed to resolve symbol> (process NULL reference)", rip);
return; return;