summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-17 11:12:06 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-17 11:19:06 +0100
commit26a31c7efbb62e2836a2199a27e6377c50cc1896 (patch)
treef00732a2acd59eaa5a99858db8732d4b4c5e7001 /Applications
parenta9b24ebbe86e2d3e98631454922ec08f4119c64b (diff)
downloadserenity-26a31c7efbb62e2836a2199a27e6377c50cc1896.zip
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.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/About/main.cpp4
-rw-r--r--Applications/Browser/main.cpp4
-rw-r--r--Applications/Calculator/main.cpp4
-rw-r--r--Applications/DisplayProperties/main.cpp4
-rw-r--r--Applications/FileManager/main.cpp4
-rw-r--r--Applications/FontEditor/main.cpp4
-rw-r--r--Applications/Help/main.cpp4
-rw-r--r--Applications/HexEditor/main.cpp4
-rw-r--r--Applications/PaintBrush/main.cpp4
-rw-r--r--Applications/QuickShow/main.cpp4
-rw-r--r--Applications/SoundPlayer/main.cpp6
-rw-r--r--Applications/SystemMonitor/main.cpp4
-rw-r--r--Applications/Taskbar/main.cpp4
-rw-r--r--Applications/Terminal/main.cpp4
-rw-r--r--Applications/TextEditor/main.cpp4
15 files changed, 31 insertions, 31 deletions
diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp
index aee5bae1d9..bb6900ff4e 100644
--- a/Applications/About/main.cpp
+++ b/Applications/About/main.cpp
@@ -9,14 +9,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath cpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 68a1214f5b..91b477ca39 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -30,7 +30,7 @@ static const char* home_url = "file:///home/anon/www/welcome.html";
int main(int argc, char** argv)
{
- if (pledge("stdio unix shared_buffer cpath rpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept unix cpath rpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
@@ -40,7 +40,7 @@ int main(int argc, char** argv)
// Connect to the ProtocolServer immediately so we can drop the "unix" pledge.
ResourceLoader::the();
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/Calculator/main.cpp b/Applications/Calculator/main.cpp
index e89302bf59..f42c266d49 100644
--- a/Applications/Calculator/main.cpp
+++ b/Applications/Calculator/main.cpp
@@ -9,14 +9,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath cpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/DisplayProperties/main.cpp b/Applications/DisplayProperties/main.cpp
index fe01d670b8..0fb4464b13 100644
--- a/Applications/DisplayProperties/main.cpp
+++ b/Applications/DisplayProperties/main.cpp
@@ -12,14 +12,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath cpath wpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept unix cpath wpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath cpath wpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept cpath wpath", nullptr) < 0) {
perror("pledge");
return 1;
}
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;
}
diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp
index b143f3835e..f18ec99dc1 100644
--- a/Applications/FontEditor/main.cpp
+++ b/Applications/FontEditor/main.cpp
@@ -9,14 +9,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath cpath wpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept unix cpath wpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath cpath wpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer rpath accept cpath wpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp
index 19b31a517c..ca06805295 100644
--- a/Applications/Help/main.cpp
+++ b/Applications/Help/main.cpp
@@ -24,14 +24,14 @@
int main(int argc, char* argv[])
{
- if (pledge("stdio unix shared_buffer cpath rpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/HexEditor/main.cpp b/Applications/HexEditor/main.cpp
index 5f70b92b0b..fcf9bdc1c0 100644
--- a/Applications/HexEditor/main.cpp
+++ b/Applications/HexEditor/main.cpp
@@ -4,14 +4,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath cpath wpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix cpath wpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath cpath wpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath cpath wpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/PaintBrush/main.cpp b/Applications/PaintBrush/main.cpp
index a3fb589508..36a33d9402 100644
--- a/Applications/PaintBrush/main.cpp
+++ b/Applications/PaintBrush/main.cpp
@@ -15,14 +15,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer unix rpath wpath cpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix wpath cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath wpath cpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath wpath cpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp
index b46b576e79..68bbf70518 100644
--- a/Applications/QuickShow/main.cpp
+++ b/Applications/QuickShow/main.cpp
@@ -11,14 +11,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio unix shared_buffer rpath cpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/SoundPlayer/main.cpp b/Applications/SoundPlayer/main.cpp
index b5d804ae9b..b236e6553f 100644
--- a/Applications/SoundPlayer/main.cpp
+++ b/Applications/SoundPlayer/main.cpp
@@ -12,14 +12,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio unix shared_buffer cpath rpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio unix shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath unix", nullptr) < 0) {
perror("pledge");
return 1;
}
@@ -27,7 +27,7 @@ int main(int argc, char** argv)
auto audio_client = AClientConnection::construct();
audio_client->handshake();
- if (pledge("stdio shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index e9fab809a5..2a66d9d406 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -49,14 +49,14 @@ static NonnullRefPtr<GWidget> build_graphs_tab();
int main(int argc, char** argv)
{
- if (pledge("stdio proc shared_buffer rpath unix cpath fattr", nullptr) < 0) {
+ if (pledge("stdio proc shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio proc shared_buffer rpath", nullptr) < 0) {
+ if (pledge("stdio proc shared_buffer accept rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/Taskbar/main.cpp b/Applications/Taskbar/main.cpp
index 6624d4385d..5852d993ca 100644
--- a/Applications/Taskbar/main.cpp
+++ b/Applications/Taskbar/main.cpp
@@ -5,14 +5,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio shared_buffer proc exec rpath unix cpath fattr", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept proc exec rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio shared_buffer proc exec rpath", nullptr) < 0) {
+ if (pledge("stdio shared_buffer accept proc exec rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index 6c0aa6c7c3..f4f245d978 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -136,7 +136,7 @@ RefPtr<GWindow> create_settings_window(TerminalWidget& terminal, RefPtr<CConfigF
int main(int argc, char** argv)
{
- if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec unix fattr", nullptr) < 0) {
+ if (pledge("stdio tty rpath accept cpath wpath shared_buffer proc exec unix fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
@@ -153,7 +153,7 @@ int main(int argc, char** argv)
GApplication app(argc, argv);
- if (pledge("stdio tty rpath cpath wpath shared_buffer proc exec", nullptr) < 0) {
+ if (pledge("stdio tty rpath accept cpath wpath shared_buffer proc exec", nullptr) < 0) {
perror("pledge");
return 1;
}
diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp
index 09c0567c51..ebe9861b8c 100644
--- a/Applications/TextEditor/main.cpp
+++ b/Applications/TextEditor/main.cpp
@@ -4,14 +4,14 @@
int main(int argc, char** argv)
{
- if (pledge("stdio rpath cpath wpath shared_buffer unix fattr", nullptr) < 0) {
+ if (pledge("stdio rpath accept cpath wpath shared_buffer unix fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GApplication app(argc, argv);
- if (pledge("stdio rpath cpath wpath shared_buffer", nullptr) < 0) {
+ if (pledge("stdio rpath accept cpath wpath shared_buffer", nullptr) < 0) {
perror("pledge");
return 1;
}