Merge pull request #65585 from delroth/hardened-pti
nixos/hardened: make pti=on overridable
This commit is contained in:
commit
a7d71da84d
@ -26,6 +26,8 @@ with lib;
|
|||||||
|
|
||||||
security.allowSimultaneousMultithreading = mkDefault false;
|
security.allowSimultaneousMultithreading = mkDefault false;
|
||||||
|
|
||||||
|
security.forcePageTableIsolation = mkDefault true;
|
||||||
|
|
||||||
security.virtualisation.flushL1DataCache = mkDefault "always";
|
security.virtualisation.flushL1DataCache = mkDefault "always";
|
||||||
|
|
||||||
security.apparmor.enable = mkDefault true;
|
security.apparmor.enable = mkDefault true;
|
||||||
@ -42,9 +44,6 @@ with lib;
|
|||||||
|
|
||||||
# Disable legacy virtual syscalls
|
# Disable legacy virtual syscalls
|
||||||
"vsyscall=none"
|
"vsyscall=none"
|
||||||
|
|
||||||
# Enable PTI even if CPU claims to be safe from meltdown
|
|
||||||
"pti=on"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.blacklistedKernelModules = [
|
boot.blacklistedKernelModules = [
|
||||||
|
@ -54,6 +54,18 @@ with lib;
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
security.forcePageTableIsolation = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to force-enable the Page Table Isolation (PTI) Linux kernel
|
||||||
|
feature even on CPU models that claim to be safe from Meltdown.
|
||||||
|
|
||||||
|
This hardening feature is most beneficial to systems that run untrusted
|
||||||
|
workloads that rely on address space isolation for security.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
security.virtualisation.flushL1DataCache = mkOption {
|
security.virtualisation.flushL1DataCache = mkOption {
|
||||||
type = types.nullOr (types.enum [ "never" "cond" "always" ]);
|
type = types.nullOr (types.enum [ "never" "cond" "always" ]);
|
||||||
default = null;
|
default = null;
|
||||||
@ -114,6 +126,10 @@ with lib;
|
|||||||
boot.kernelParams = [ "nosmt" ];
|
boot.kernelParams = [ "nosmt" ];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf config.security.forcePageTableIsolation {
|
||||||
|
boot.kernelParams = [ "pti=on" ];
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf (config.security.virtualisation.flushL1DataCache != null) {
|
(mkIf (config.security.virtualisation.flushL1DataCache != null) {
|
||||||
boot.kernelParams = [ "kvm-intel.vmentry_l1d_flush=${config.security.virtualisation.flushL1DataCache}" ];
|
boot.kernelParams = [ "kvm-intel.vmentry_l1d_flush=${config.security.virtualisation.flushL1DataCache}" ];
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user