From 319cb2845250eaead5e4f0fe033b67a51f2c0d1e Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 22 Jan 2020 02:34:20 -0800 Subject: [PATCH] dmesg: Use pledge() and unveil() --- Userland/dmesg.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Userland/dmesg.cpp b/Userland/dmesg.cpp index 34218c3ac7..4e7492bd5e 100644 --- a/Userland/dmesg.cpp +++ b/Userland/dmesg.cpp @@ -32,6 +32,18 @@ int main(int argc, char** argv) { + if (pledge("stdio rpath", nullptr) < 0) { + perror("pledge"); + return 1; + } + + if (unveil("/proc/dmesg", "r") < 0) { + perror("unveil"); + return 1; + } + + unveil(nullptr, nullptr); + (void)argc; (void)argv; auto f = CFile::construct("/proc/dmesg");