kernel: Support setuid binaries
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
You still have to run "chmod 4755 /bin/su" as root inside Luna for now, as this is not done by the install scripts.
This commit is contained in:
parent
8b45766aaa
commit
3887b98a7d
@ -86,4 +86,14 @@ namespace VFS
|
||||
|
||||
return inode->mode() & S_IROTH;
|
||||
}
|
||||
|
||||
bool is_setuid(SharedPtr<Inode> inode)
|
||||
{
|
||||
return inode->mode() & S_ISUID;
|
||||
}
|
||||
|
||||
bool is_setgid(SharedPtr<Inode> inode)
|
||||
{
|
||||
return inode->mode() & S_ISGID;
|
||||
}
|
||||
}
|
||||
|
@ -178,6 +178,8 @@ namespace VFS
|
||||
bool can_execute(SharedPtr<Inode> inode, Credentials auth);
|
||||
bool can_read(SharedPtr<Inode> inode, Credentials auth);
|
||||
bool can_write(SharedPtr<Inode> inode, Credentials auth);
|
||||
bool is_setuid(SharedPtr<Inode> inode);
|
||||
bool is_setgid(SharedPtr<Inode> inode);
|
||||
|
||||
Inode& root_inode();
|
||||
}
|
||||
|
@ -76,6 +76,9 @@ Result<u64> sys_execve(Registers* regs, SyscallArgs args)
|
||||
|
||||
MMU::delete_userspace_page_directory(current->directory);
|
||||
|
||||
if (VFS::is_setuid(inode)) current->auth.euid = current->auth.suid = inode->uid();
|
||||
if (VFS::is_setgid(inode)) current->auth.egid = current->auth.sgid = inode->gid();
|
||||
|
||||
current->name = path.chars();
|
||||
|
||||
image->apply(current);
|
||||
|
Loading…
Reference in New Issue
Block a user