diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-05-04 00:57:06 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-04 10:57:39 +0200 |
commit | 35bb8ab4dbc4287f0823c093fd2d68a9d467f9b4 (patch) | |
tree | ac2c1f927abdb919d3a6821c6e900b664cb45a47 /Kernel/FileSystem/ProcFS.cpp | |
parent | 869becc944f812e498768f69be88c5b512f020e4 (diff) | |
download | serenity-35bb8ab4dbc4287f0823c093fd2d68a9d467f9b4.zip |
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.
Diffstat (limited to 'Kernel/FileSystem/ProcFS.cpp')
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index af96914af0..595f90d16a 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -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)); } |