mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:47:35 +00:00
Kernel: Add a random offset to kernel stacks upon syscall entry
When entering the kernel from a syscall, we now insert a small bit of stack padding after the RegisterDump. This makes kernel stacks less deterministic across syscalls and may make some bugs harder to exploit. Inspired by Elena Reshetova's talk on kernel stack exploitation.
This commit is contained in:
parent
f23dc4ea69
commit
1d94b5eb04
2 changed files with 14 additions and 0 deletions
|
@ -447,6 +447,14 @@ inline void read_tsc(u32& lsw, u32& msw)
|
|||
: "=d"(msw), "=a"(lsw));
|
||||
}
|
||||
|
||||
inline u64 read_tsc()
|
||||
{
|
||||
u32 lsw;
|
||||
u32 msw;
|
||||
read_tsc(lsw, msw);
|
||||
return ((u64)msw << 32) | lsw;
|
||||
}
|
||||
|
||||
struct Stopwatch {
|
||||
union SplitQword {
|
||||
struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue