From 16d5b1d4ca8e54c28c85ab39c08461dbda0f8848 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 18 Feb 2020 10:41:37 +0100 Subject: [PATCH] top: Use pledge() and unveil() --- Userland/top.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Userland/top.cpp b/Userland/top.cpp index 37175cf3d33..beef373a977 100644 --- a/Userland/top.cpp +++ b/Userland/top.cpp @@ -133,6 +133,23 @@ static Snapshot get_snapshot() int main(int, char**) { + if (pledge("stdio rpath", nullptr) < 0) { + perror("pledge"); + return 1; + } + + if (unveil("/proc/all", "r") < 0) { + perror("unveil"); + return 1; + } + + if (unveil("/etc/passwd", "r") < 0) { + perror("unveil"); + return 1; + } + + unveil(nullptr, nullptr); + Vector threads; auto prev = get_snapshot(); usleep(10000);