Compare commits
3 Commits
3b8aabce0f
...
499bf6dd19
Author | SHA1 | Date | |
---|---|---|---|
499bf6dd19 | |||
94e7dde8af | |||
f38c9e68c1 |
@ -14,6 +14,7 @@
|
||||
#include <os/FileSystem.h>
|
||||
#include <os/IPC.h>
|
||||
#include <os/Process.h>
|
||||
#include <os/Security.h>
|
||||
#include <pwd.h>
|
||||
#include <shadow.h>
|
||||
#include <sys/stat.h>
|
||||
@ -45,6 +46,8 @@ Result<int> luna_main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath wpath proc exec id", nullptr));
|
||||
|
||||
setsid();
|
||||
|
||||
bool success = os::IPC::Notifier::run_and_wait(
|
||||
|
@ -58,7 +58,7 @@ Result<int> luna_main(int argc, char** argv)
|
||||
{
|
||||
srand((unsigned)time(NULL));
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix proc exec tty id", NULL));
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix tty id", NULL));
|
||||
|
||||
StringView socket_path = "/tmp/wind.sock";
|
||||
StringView system_socket_path = "/tmp/wsys.sock";
|
||||
@ -128,7 +128,7 @@ Result<int> luna_main(int argc, char** argv)
|
||||
TRY(fds.try_append({ .fd = server->fd(), .events = POLLIN, .revents = 0 }));
|
||||
TRY(fds.try_append({ .fd = system_server->fd(), .events = POLLIN, .revents = 0 }));
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix proc exec", NULL));
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix", NULL));
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ Result<u64> sys_waitpid(Registers* regs, SyscallArgs args)
|
||||
check(current->child_being_waited_for != -1);
|
||||
|
||||
target = TRY(Result<Process*>::from_option(Scheduler::find_by_pid(current->child_being_waited_for), ESRCH));
|
||||
check(!target->dead());
|
||||
check(target->dead());
|
||||
}
|
||||
else
|
||||
target = child.value();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <os/IPC.h>
|
||||
#include <os/Main.h>
|
||||
#include <os/Process.h>
|
||||
#include <os/Security.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
@ -67,6 +68,8 @@ Result<int> luna_main(int argc, char** argv)
|
||||
parser.add_value_argument(username, 'u', "user", "the user to start the UI session as");
|
||||
parser.parse(argc, argv);
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath proc exec id", nullptr));
|
||||
|
||||
if (geteuid() != 0)
|
||||
{
|
||||
os::eprintln("error: %s can only be started as root.", argv[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user