From c44d2515b4cbaf29bd6d94e64e3af7284952751f Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 16 Aug 2020 00:27:23 -0700 Subject: [PATCH] Kernel: Emit ProcFS pledge/veil properties as "N/A" for kernel processes Pledges and Veil state don't really make sense for kernel mode processes, as they can do what ever they want since they are in kernel mode. Make this clear in the system monitor UI by marking these entries as null. --- Kernel/FileSystem/ProcFS.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index a88b4d520bc..3aaf589ccab 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -824,26 +824,32 @@ static Optional procfs$all(InodeIdentifier) auto build_process = [&](const Process& process) { auto process_object = array.add_object(); - StringBuilder pledge_builder; + if (process.is_ring3()) { + StringBuilder pledge_builder; + #define __ENUMERATE_PLEDGE_PROMISE(promise) \ if (process.has_promised(Pledge::promise)) { \ pledge_builder.append(#promise " "); \ } - ENUMERATE_PLEDGE_PROMISES + ENUMERATE_PLEDGE_PROMISES #undef __ENUMERATE_PLEDGE_PROMISE - process_object.add("pledge", pledge_builder.to_string()); + process_object.add("pledge", pledge_builder.to_string()); - switch (process.veil_state()) { - case VeilState::None: - process_object.add("veil", "None"); - break; - case VeilState::Dropped: - process_object.add("veil", "Dropped"); - break; - case VeilState::Locked: - process_object.add("veil", "Locked"); - break; + switch (process.veil_state()) { + case VeilState::None: + process_object.add("veil", "None"); + break; + case VeilState::Dropped: + process_object.add("veil", "Dropped"); + break; + case VeilState::Locked: + process_object.add("veil", "Locked"); + break; + } + } else { + process_object.add("pledge", String()); + process_object.add("veil", String()); } process_object.add("pid", process.pid().value());