From a3f5640dd7e24b97f6fdbdd734f9f144e1344964 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Fri, 7 Jun 2024 20:13:24 +0100 Subject: [PATCH] doc/stdenv: hardening flags: add section on stackclashprotection --- doc/stdenv/stdenv.chapter.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md index f2bc7f71de38..af6fc1ea37e6 100644 --- a/doc/stdenv/stdenv.chapter.md +++ b/doc/stdenv/stdenv.chapter.md @@ -1677,6 +1677,10 @@ Adds the `-ftrivial-auto-var-init=pattern` compiler option. This causes "trivial Use of this flag is controversial as it can prevent tools that detect uninitialized variable use (such as valgrind) from operating correctly. +#### `stackclashprotection` {#stackclashprotection} + +This flag adds the `-fstack-clash-protection` compiler option, which causes growth of a program's stack to access each successive page in order. This should force the guard page to be accessed and cause an attempt to "jump over" this guard page to crash. + [^footnote-stdenv-ignored-build-platform]: The build platform is ignored because it is a mere implementation detail of the package satisfying the dependency: As a general programming principle, dependencies are always *specified* as interfaces, not concrete implementation. [^footnote-stdenv-native-dependencies-in-path]: Currently, this means for native builds all dependencies are put on the `PATH`. But in the future that may not be the case for sake of matching cross: the platforms would be assumed to be unique for native and cross builds alike, so only the `depsBuild*` and `nativeBuildInputs` would be added to the `PATH`. [^footnote-stdenv-propagated-dependencies]: Nix itself already takes a package’s transitive dependencies into account, but this propagation ensures nixpkgs-specific infrastructure like [setup hooks](#ssec-setup-hooks) also are run as if it were a propagated dependency.