-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop "proc exec" and other promises never needed as early as possible. More delicate unveil(2) bits come next.
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Use pledge(2) after QApplication[0] initialisation (uses shmget(2) not | ||
covered by pledge) and before execution, covering both CLI and GUI mode. | ||
|
||
Index: src/app/main.cpp | ||
--- src/app/main.cpp.orig | ||
+++ src/app/main.cpp | ||
@@ -24,6 +24,10 @@ | ||
#include "controller.hpp" | ||
#include "logging.hpp" | ||
|
||
+#ifdef Q_OS_OPENBSD | ||
+#include <unistd.h> | ||
+#endif // Q_OS_OPENBSD | ||
+ | ||
#include <QTimer> | ||
|
||
int main(int argc, char* argv[]) | ||
@@ -32,6 +36,21 @@ int main(int argc, char* argv[]) | ||
Q_INIT_RESOURCE(translations); | ||
|
||
Application app(argc, argv, QStringLiteral("web-eid")); | ||
+ | ||
+#ifdef Q_OS_OPENBSD | ||
+ // "rpath cpath wpath" Qt owns web-eid's config and log directories | ||
+ // "inet dns" web-eid talks to the internet | ||
+ // "fattr flock ps" Qt locks file access, sysctl(2) KERN_PROC_PID from QLockFile | ||
+ // "unix" web-eid and Qt communicate with PCSC and D-Bus | ||
+ // "prot_exec" Qt dlopen(3) libqsvg.so | ||
+ // | ||
+ // src/controller/application.cpp Application::isDarkTheme() has code under | ||
+ // '#elif 0' (the only QProcess occurence in web-eid) that would need "proc exec". | ||
+ if (pledge("stdio rpath cpath wpath inet fattr flock unix dns prot_exec ps", NULL) == -1) { | ||
+ std::cerr << "pledge: " << strerror(errno) << std::endl; | ||
+ return -1; | ||
+ } | ||
+#endif // Q_OS_OPENBSD | ||
|
||
try { | ||
Controller controller(app.parseArgs()); |