mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
Kernel: Use Process::credentials() and remove user ID/group ID helpers
Move away from using the group ID/user ID helpers in the process to allow for us to take advantage of the immutable credentials instead.
This commit is contained in:
parent
8026d8926c
commit
f86b671de2
Notes:
sideshowbarker
2024-07-17 08:05:08 +09:00
Author: https://github.com/AnthonyIacono 🔰
Commit: f86b671de2
Pull-request: https://github.com/SerenityOS/serenity/pull/14944
27 changed files with 109 additions and 94 deletions
|
@ -25,7 +25,8 @@ ErrorOr<void> Process::procfs_get_thread_stack(ThreadID thread_id, KBufferBuilde
|
|||
auto thread = Thread::from_tid(thread_id);
|
||||
if (!thread)
|
||||
return ESRCH;
|
||||
bool show_kernel_addresses = Process::current().is_superuser();
|
||||
auto current_process_credentials = Process::current().credentials();
|
||||
bool show_kernel_addresses = current_process_credentials->is_superuser();
|
||||
bool kernel_address_added = false;
|
||||
for (auto address : TRY(Processor::capture_stack_trace(*thread, 1024))) {
|
||||
if (!show_kernel_addresses && !Memory::is_user_address(VirtualAddress { address })) {
|
||||
|
@ -269,7 +270,8 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder)
|
|||
{
|
||||
SpinlockLocker lock(address_space().get_lock());
|
||||
for (auto const& region : address_space().regions()) {
|
||||
if (!region.is_user() && !Process::current().is_superuser())
|
||||
auto current_process_credentials = Process::current().credentials();
|
||||
if (!region.is_user() && !current_process_credentials->is_superuser())
|
||||
continue;
|
||||
auto region_object = TRY(array.add_object());
|
||||
TRY(region_object.add("readable"sv, region.is_readable()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue