Kernel: If userspace sets fs or gs, dont overwrite it
Current cpu index is stored at either segment. If userspace sets that segment, kernel will not overwrite it on every reschedule. This is fine as long as user program does not use anything that relies on it :)
This commit is contained in:
@@ -3302,7 +3302,9 @@ namespace Kernel
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_set_fsbase(void* addr)
|
||||
{
|
||||
Thread::current().set_fsbase(reinterpret_cast<vaddr_t>(addr));
|
||||
auto& thread = Thread::current();
|
||||
thread.m_has_custom_fsbase = true;
|
||||
thread.set_fsbase(reinterpret_cast<vaddr_t>(addr));
|
||||
Processor::load_fsbase();
|
||||
return 0;
|
||||
}
|
||||
@@ -3314,7 +3316,9 @@ namespace Kernel
|
||||
|
||||
BAN::ErrorOr<long> Process::sys_set_gsbase(void* addr)
|
||||
{
|
||||
Thread::current().set_gsbase(reinterpret_cast<vaddr_t>(addr));
|
||||
auto& thread = Thread::current();
|
||||
thread.m_has_custom_gsbase = true;
|
||||
thread.set_gsbase(reinterpret_cast<vaddr_t>(addr));
|
||||
Processor::load_gsbase();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user