Added privilidges
This commit is contained in:
9
memory.c
9
memory.c
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "memory.h"
|
||||
#include "task.h"
|
||||
|
||||
/* Null-safe print helper used throughout the kernel. */
|
||||
#define SAFE_PRINT(Boot, ...) \
|
||||
@@ -526,6 +527,14 @@ void memory_print_stats(BootInfo *Boot)
|
||||
{
|
||||
UINTN h_total, h_used, h_free, h_blocks;
|
||||
UINTN p_total, p_free, p_used;
|
||||
Task *caller;
|
||||
|
||||
/* Subsystem-level privilege enforcement: memory stats require KERNEL. */
|
||||
caller = task_current();
|
||||
if (caller != NULL && task_get_privilege(caller) < TASK_PRIV_KERNEL) {
|
||||
SAFE_PRINT(Boot, L"Permission denied: memory stats require kernel privilege.\n\r");
|
||||
return;
|
||||
}
|
||||
|
||||
p_total = pmm_get_total_pages();
|
||||
p_free = pmm_get_free_pages();
|
||||
|
||||
Reference in New Issue
Block a user