summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-21 18:41:58 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-21 18:48:35 +0100
commit86721a5f78718caf10c578e9501f8b4d19c0eb44 (patch)
tree843681352ebaaefd782e1478be5892c1a5b5e2a6 /nixos
parent78bb734452a76c7719f2224e5add5b2a12b3fbf6 (diff)
downloadnixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar.gz
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar.bz2
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar.lz
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar.xz
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.tar.zst
nixlib-86721a5f78718caf10c578e9501f8b4d19c0eb44.zip
Allow attaching to non-child processes by default
The inability to run strace or gdb is the kind of
developer-unfriendliness that we're used to from OS X, let's not do it
on NixOS.

This restriction can be re-enabled by setting

  boot.kernel.sysctl."kernel.yama.ptrace_scope" = 1;

It might be nice to have a NixOS module for enabling hardened defaults.

Xref #14392.

Thanks @abbradar.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-1703.xml9
-rw-r--r--nixos/modules/config/sysctl.nix4
2 files changed, 4 insertions, 9 deletions
diff --git a/nixos/doc/manual/release-notes/rl-1703.xml b/nixos/doc/manual/release-notes/rl-1703.xml
index 3697b69fcf50..cae46258b808 100644
--- a/nixos/doc/manual/release-notes/rl-1703.xml
+++ b/nixos/doc/manual/release-notes/rl-1703.xml
@@ -97,15 +97,6 @@ following incompatible changes:</para>
 
   <listitem>
     <para>
-      The Yama LSM is now enabled by default in the kernel,
-      which prevents ptracing non-child processes.
-      This means you will not be able to attach gdb to an existing process,
-      but will need to start that process from gdb (so it is a child).
-    </para>
-  </listitem>
-
-  <listitem>
-    <para>
       The <literal>stripHash</literal> bash function in <literal>stdenv</literal>
       changed according to its documentation; it now outputs the stripped name to
       <literal>stdout</literal> instead of putting it in the variable
diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix
index 61b02c5ffa6a..a3f7e8f722f0 100644
--- a/nixos/modules/config/sysctl.nix
+++ b/nixos/modules/config/sysctl.nix
@@ -64,5 +64,9 @@ in
     # Removed under grsecurity.
     boot.kernel.sysctl."kernel.kptr_restrict" =
       if (config.boot.kernelPackages.kernel.features.grsecurity or false) then null else 1;
+
+    # Disable YAMA by default to allow easy debugging.
+    boot.kernel.sysctl."kernel.yama.ptrace_scope" = mkDefault 0;
+
   };
 }