mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
Kernel: Don't include kmalloc perf events in JSON for non-superuser
These events contain sensitive kernel information and should not be available to regular users.
This commit is contained in:
parent
8ef9b003ad
commit
369c7a7e9f
|
@ -196,10 +196,17 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const
|
|||
}
|
||||
}
|
||||
|
||||
bool show_kernel_addresses = Process::current().is_superuser();
|
||||
auto array = object.add_array("events");
|
||||
bool seen_first_sample = false;
|
||||
for (size_t i = 0; i < m_count; ++i) {
|
||||
auto& event = at(i);
|
||||
auto const& event = at(i);
|
||||
|
||||
if (!show_kernel_addresses) {
|
||||
if (event.type == PERF_EVENT_KMALLOC || event.type == PERF_EVENT_KFREE)
|
||||
continue;
|
||||
}
|
||||
|
||||
auto event_object = array.add_object();
|
||||
switch (event.type) {
|
||||
case PERF_EVENT_SAMPLE:
|
||||
|
|
Loading…
Reference in a new issue