From 7e9048b5a1690e9a5b3358f2ed7b1b7919d6c88b Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Mon, 27 Feb 2023 19:45:15 +0100 Subject: [PATCH] [Hardware] Fix crashes on AMD Zen 1 CPUs Caused my Opcache issue. Only real fix is to RMA the processor, but that is no longer an option for me. --- hardware.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hardware.nix b/hardware.nix index a1d6d45..6f1d870 100644 --- a/hardware.nix +++ b/hardware.nix @@ -3,6 +3,7 @@ with lib; let cfg = config.aviallon.hardware; desktopCfg = config.aviallon.desktop; + generalCfg = config.aviallon.general; in { options.aviallon.hardware = { }; @@ -19,6 +20,13 @@ in ++ optional cfg.nvidia.enable pkgs.nvtop-nvidia ; + boot.kernel.sysctl = { + + # Why: https://www.phoronix.com/news/Ryzen-Segv-Response + # Workaround: https://forums.gentoo.org/viewtopic-p-2605135.html#2605135 + "kernel.randomize_va_space" = mkIf (generalCfg.cpuVendor == "amd" && generalCfg.cpuArch == "znver1" ) (warn "Disable Adress Space Layout Randomization on Ryzen 1 CPU" 0); + }; + }; }