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

@ -22,7 +22,7 @@
int main(int argc, char* argv[])
{
if (pledge("stdio recvfd sendfd rpath fattr unix cpath wpath thread", nullptr) < 0) {
if (pledge("stdio recvfd sendfd rpath fattr unix cpath wpath thread prot_exec", nullptr) < 0) {
perror("pledge");
return 1;
}
@ -69,6 +69,11 @@ int main(int argc, char* argv[])
return 1;
}
if (unveil("/usr/lib/libunicodedata.so.serenity", "r") < 0) {
perror("unveil");
return 1;
}
if (unveil(nullptr, nullptr) < 0) {
perror("unveil");
return 1;