Userland: Add unveil/pledge requisites for dynamic Unicode data loading

Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
This commit is contained in:
Timothy Flynn 2021-12-16 08:13:00 -05:00 committed by Brian Gianforcaro
commit 10a8b6d411
Notes: sideshowbarker 2024-07-17 22:28:06 +09:00
7 changed files with 16 additions and 8 deletions

View file

@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 1;
}
TRY(Core::System::pledge("stdio recvfd sendfd unix cpath rpath wpath"));
TRY(Core::System::pledge("stdio recvfd sendfd unix cpath rpath wpath prot_exec"));
const char* specified_url = nullptr;
@ -63,6 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/tmp/portal/image", "rw"));
TRY(Core::System::unveil("/tmp/portal/webcontent", "rw"));
TRY(Core::System::unveil("/tmp/portal/request", "rw"));
TRY(Core::System::unveil("/usr/lib/libunicodedata.so.serenity", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
auto app_icon = GUI::Icon::default_icon("app-browser");