From 26a31c7efbb62e2836a2199a27e6377c50cc1896 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 17 Jan 2020 11:12:06 +0100 Subject: Kernel: Add "accept" pledge promise for accepting incoming connections This patch adds a new "accept" promise that allows you to call accept() on an already listening socket. This lets programs set up a socket for for listening and then dropping "inet" and/or "unix" so that only incoming (and existing) connections are allowed from that point on. No new outgoing connections or listening server sockets can be created. In addition to accept() it also allows getsockopt() with SOL_SOCKET and SO_PEERCRED, which is used to find the PID/UID/GID of the socket peer. This is used by our IPC library when creating shared buffers that should only be accessible to a specific peer process. This allows us to drop "unix" in WindowServer and LookupServer. :^) It also makes the debugging/introspection RPC sockets in CEventLoop based programs work again. --- Applications/FileManager/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Applications/FileManager/main.cpp') diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index d97c16156b..6672775a30 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char** argv) { - if (pledge("stdio thread unix shared_buffer cpath rpath wpath fattr proc exec", nullptr) < 0) { + if (pledge("stdio thread shared_buffer accept unix cpath rpath wpath fattr proc exec", nullptr) < 0) { perror("pledge"); return 1; } @@ -50,7 +50,7 @@ int main(int argc, char** argv) GApplication app(argc, argv); - if (pledge("stdio thread shared_buffer cpath rpath wpath fattr proc exec", nullptr) < 0) { + if (pledge("stdio thread shared_buffer accept cpath rpath wpath fattr proc exec", nullptr) < 0) { perror("pledge"); return 1; } -- cgit v1.2.3