summaryrefslogtreecommitdiff
path: root/Kernel/PerformanceEventBuffer.cpp
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-25 13:39:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-26 17:13:55 +0200
commit64639de4d25905febf9ee48b5211696ac691bbe4 (patch)
treecc66cf9fb7767896bd09d4552de0fb7913604e15 /Kernel/PerformanceEventBuffer.cpp
parentd164da7d19469ff06df7671aae02157055f337ac (diff)
downloadserenity-64639de4d25905febf9ee48b5211696ac691bbe4.zip
Kernel: Stop walking the stack when we encounter return address 0
Diffstat (limited to 'Kernel/PerformanceEventBuffer.cpp')
-rw-r--r--Kernel/PerformanceEventBuffer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp
index 1aafac5b40..8f8023e510 100644
--- a/Kernel/PerformanceEventBuffer.cpp
+++ b/Kernel/PerformanceEventBuffer.cpp
@@ -45,6 +45,8 @@ static Vector<FlatPtr, PerformanceEvent::max_stack_frame_count> raw_backtrace(Fl
FlatPtr retaddr;
if (!safe_memcpy(&retaddr, (void*)(stack_ptr + sizeof(FlatPtr)), sizeof(FlatPtr), fault_at))
break;
+ if (retaddr == 0)
+ break;
backtrace.append(retaddr);
if (backtrace.size() == PerformanceEvent::max_stack_frame_count)
break;