1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 19:25:07 +00:00

Kernel: Return one kernel frame from procfs$tid_stack for normal users.

Previously we would return a 0xdeadc0de frame for every kernel frame
in the real kernel stack when an non super-user issued the request.
This isn't useful, and just produces visual clutter in tools which
attempt to symbolize stacks.
This commit is contained in:
Brian Gianforcaro 2021-05-04 00:57:06 -07:00 committed by Andreas Kling
parent 869becc944
commit 35bb8ab4db

View file

@ -599,9 +599,14 @@ static bool procfs$tid_stack(InodeIdentifier identifier, KBufferBuilder& builder
JsonArraySerializer array { builder };
bool show_kernel_addresses = Process::current()->is_superuser();
bool kernel_address_added = false;
for (auto address : Processor::capture_stack_trace(*thread, 1024)) {
if (!show_kernel_addresses && !is_user_address(VirtualAddress { address }))
if (!show_kernel_addresses && !is_user_address(VirtualAddress { address })) {
if (kernel_address_added)
continue;
address = 0xdeadc0de;
kernel_address_added = true;
}
array.add(JsonValue(address));
}