Kernel: Limit the size of stack traces

Let's not allow infinitely long stack traces. Cap it at 4096 frames.
This commit is contained in:
Andreas Kling 2021-02-02 16:05:18 +01:00
parent 7b50d3cda4
commit b0b51c3955

View file

@ -1161,9 +1161,10 @@ Vector<FlatPtr> Processor::capture_stack_trace(Thread& thread, size_t max_frames
auto walk_stack = [&](FlatPtr stack_ptr) auto walk_stack = [&](FlatPtr stack_ptr)
{ {
static constexpr size_t max_stack_frames = 4096;
stack_trace.append(eip); stack_trace.append(eip);
size_t count = 1; size_t count = 1;
while (stack_ptr) { while (stack_ptr && stack_trace.size() < max_stack_frames) {
FlatPtr retaddr; FlatPtr retaddr;
count++; count++;