1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 01:27:42 +00:00

Kernel: Disable x86 RDTSC instruction in userspace

It's still possible to read the TSC via the read_tsc() syscall, but we
will now clear some of the bottom bits for unprivileged users.
This commit is contained in:
Andreas Kling 2020-01-01 18:18:02 +01:00
parent dfd759f75a
commit 38f93ef13b
6 changed files with 25 additions and 1 deletions

View file

@ -2452,6 +2452,8 @@ int Process::sys$read_tsc(u32* lsw, u32* msw)
if (!validate_write_typed(msw))
return -EFAULT;
read_tsc(*lsw, *msw);
if (!is_superuser())
*lsw &= ~0xfff;
return 0;
}