From 4KB to 1MB: Guard Page Evolution

Following the Stack Clash, operating systems like Linux significantly increased the stack guard gap size from the insufficient 4KB to 1 MiB, complemented by compiler-level protections like GCC's `-fstack-clash-protection` to probe large stack allocations.

The top 3

  1. Stack Clash: The Exploit That Forced 1MB Guard Pages: The 4KB stack guard page proved insufficient against 'Stack Clash' vulnerabilities (CVE-2017-1000364), where attackers could 'hop' over the small guard. This led the Linux kernel to increase the stack guard gap size to 1 MiB as a mitigation, making successful exploitation significantly more difficult.
  2. Beyond Size: How Guard Pages Instantly Halt Memory Overruns: Guard pages are intentionally inaccessible memory regions placed at critical boundaries (like stack or heap). Any attempt to access them triggers an immediate memory access violation (e.g., segmentation fault), acting as a 'fail-fast' mechanism to detect buffer/stack overflows, enhance system stability, and aid debugging.
  3. Guard Page Size: Balancing Overflow Defense and Memory Overhead: While larger guard pages (e.g., 1MB) offer stronger protection against complex stack overflows by creating a larger buffer, they introduce trade-offs. Increased guard page size can lead to higher memory consumption and potentially reduce Translation Lookaside Buffer (TLB) efficiency, impacting overall system performance due to more TLB misses.

Open the full topic