mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
UserspaceEmulator: Implement the setuid() and setgid() syscalls
Note that running a setuid program (e.g /bin/ping) in UE does not actually run uid=0. You'll have to run UE itself as uid=0 if you want to test programs that do setuid/setgid.
This commit is contained in:
parent
368cea4094
commit
d9f933df7b
Notes:
sideshowbarker
2024-07-19 04:34:03 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d9f933df7b1
2 changed files with 16 additions and 0 deletions
|
@ -278,6 +278,10 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
return virt$getuid();
|
||||
case SC_getgid:
|
||||
return virt$getgid();
|
||||
case SC_setuid:
|
||||
return virt$setuid(arg1);
|
||||
case SC_setgid:
|
||||
return virt$setgid(arg2);
|
||||
case SC_close:
|
||||
return virt$close(arg1);
|
||||
case SC_fstat:
|
||||
|
@ -791,6 +795,16 @@ gid_t Emulator::virt$getgid()
|
|||
return getgid();
|
||||
}
|
||||
|
||||
int Emulator::virt$setuid(uid_t uid)
|
||||
{
|
||||
return syscall(SC_setuid, uid);
|
||||
}
|
||||
|
||||
int Emulator::virt$setgid(gid_t gid)
|
||||
{
|
||||
return syscall(SC_setgid, gid);
|
||||
}
|
||||
|
||||
u32 Emulator::virt$write(int fd, FlatPtr data, ssize_t size)
|
||||
{
|
||||
if (size < 0)
|
||||
|
|
|
@ -88,6 +88,8 @@ private:
|
|||
u32 virt$pledge(u32);
|
||||
uid_t virt$getuid();
|
||||
gid_t virt$getgid();
|
||||
int virt$setuid(uid_t);
|
||||
int virt$setgid(gid_t);
|
||||
u32 virt$read(int, FlatPtr, ssize_t);
|
||||
u32 virt$write(int, FlatPtr, ssize_t);
|
||||
u32 virt$mprotect(FlatPtr, size_t, int);
|
||||
|
|
Loading…
Reference in a new issue