diff options
author | Andreas Kling <kling@serenityos.org> | 2021-12-19 16:41:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-19 18:18:38 +0100 |
commit | 1cdc7aa0387bc4fe68a39b2e96519cf4269f6227 (patch) | |
tree | e00a0a1e6b9ed9bcf7f067ea8c8aeb9c56b4dde1 /Kernel | |
parent | 369c7a7e9f448da681655969ed903d5e6f4378aa (diff) | |
download | serenity-1cdc7aa0387bc4fe68a39b2e96519cf4269f6227.zip |
Kernel: Mask kernel addresses in perf event streams for non-superuser
We now turn kernel addresses into 0xdeadc0de, same as /proc/PID/stacks/
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/PerformanceEventBuffer.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp index 38c04fe14f..d3d8901e08 100644 --- a/Kernel/PerformanceEventBuffer.cpp +++ b/Kernel/PerformanceEventBuffer.cpp @@ -286,7 +286,10 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const seen_first_sample = true; auto stack_array = event_object.add_array("stack"); for (size_t j = 0; j < event.stack_size; ++j) { - stack_array.add(event.stack[j]); + auto address = event.stack[j]; + if (!show_kernel_addresses && !Memory::is_user_address(VirtualAddress { address })) + address = 0xdeadc0de; + stack_array.add(address); } stack_array.finish(); event_object.finish(); |