summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuperherointj <5861043+superherointj@users.noreply.github.com>2022-09-22 07:58:42 -0300
committerGitHub <noreply@github.com>2022-09-22 07:58:42 -0300
commitbd118201b898412367205011af65ec9d0d26025b (patch)
treea59dc8deb7c8812b6bdaafc10e5e5fd875869fec
parentMerge pull request #188643 from risicle/ris-mod-wsgi-CVE-2022-2255-r22.05 (diff)
parentlinux/hardened/5.19: fix build (diff)
downloadnixpkgs-bd118201b898412367205011af65ec9d0d26025b.tar.gz
Merge pull request #192406 from NixOS/backport-191670-to-release-22.05
[Backport release-22.05] linux/hardened: fix update script and build for 5.19
-rw-r--r--nixos/tests/kernel-generic.nix1
-rw-r--r--pkgs/os-specific/linux/kernel/hardened/config.nix8
-rw-r--r--pkgs/os-specific/linux/kernel/hardened/patches.json8
-rwxr-xr-xpkgs/os-specific/linux/kernel/hardened/update.py2
-rw-r--r--pkgs/os-specific/linux/kernel/linux-libre.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/manual-config.nix13
-rw-r--r--pkgs/top-level/linux-kernels.nix2
7 files changed, 24 insertions, 14 deletions
diff --git a/nixos/tests/kernel-generic.nix b/nixos/tests/kernel-generic.nix
index f34d5d607940..452c15a3a058 100644
--- a/nixos/tests/kernel-generic.nix
+++ b/nixos/tests/kernel-generic.nix
@@ -30,6 +30,7 @@ let
linux_5_4_hardened
linux_5_10_hardened
linux_5_15_hardened
+ linux_5_19_hardened
linux_testing;
};
diff --git a/pkgs/os-specific/linux/kernel/hardened/config.nix b/pkgs/os-specific/linux/kernel/hardened/config.nix
index 0beab0725f6a..c90027f3eb14 100644
--- a/pkgs/os-specific/linux/kernel/hardened/config.nix
+++ b/pkgs/os-specific/linux/kernel/hardened/config.nix
@@ -72,8 +72,12 @@ assert (stdenv.hostPlatform.isx86_64 -> versions.majorMinor version != "5.4");
GCC_PLUGIN_STRUCTLEAK = whenAtLeast "4.11" yes; # A port of the PaX structleak plugin
GCC_PLUGIN_STRUCTLEAK_BYREF_ALL = whenAtLeast "4.14" yes; # Also cover structs passed by address
GCC_PLUGIN_STACKLEAK = whenAtLeast "4.20" yes; # A port of the PaX stackleak plugin
- GCC_PLUGIN_RANDSTRUCT = whenAtLeast "4.13" yes; # A port of the PaX randstruct plugin
- GCC_PLUGIN_RANDSTRUCT_PERFORMANCE = whenAtLeast "4.13" yes;
+ GCC_PLUGIN_RANDSTRUCT = whenBetween "4.13" "5.19" yes; # A port of the PaX randstruct plugin
+ GCC_PLUGIN_RANDSTRUCT_PERFORMANCE = whenBetween "4.13" "5.19" yes;
+
+ # Same as GCC_PLUGIN_RANDSTRUCT*, but has been renamed to `RANDSTRUCT*` in 5.19.
+ RANDSTRUCT = whenAtLeast "5.19" yes;
+ RANDSTRUCT_PERFORMANCE = whenAtLeast "5.19" yes;
# Disable various dangerous settings
ACPI_CUSTOM_METHOD = no; # Allows writing directly to physical memory
diff --git a/pkgs/os-specific/linux/kernel/hardened/patches.json b/pkgs/os-specific/linux/kernel/hardened/patches.json
index a27edf5260ec..141797bc7146 100644
--- a/pkgs/os-specific/linux/kernel/hardened/patches.json
+++ b/pkgs/os-specific/linux/kernel/hardened/patches.json
@@ -41,10 +41,10 @@
},
"5.19": {
"patch": {
- "extra": "-hardened1",
- "name": "linux-hardened-5.19.8-hardened1.patch",
- "sha256": "1j7wg4hq06drxr42jl89za1f7x52d4ck5i38p4njz4j415ihsiys",
- "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.19.8-hardened1/linux-hardened-5.19.8-hardened1.patch"
+ "extra": "-hardened2",
+ "name": "linux-hardened-5.19.8-hardened2.patch",
+ "sha256": "1dfgnx2yr5d5kh2d8r7ywqkyjq1rfni2b5sdpqly0w986rlkw48k",
+ "url": "https://github.com/anthraxx/linux-hardened/releases/download/5.19.8-hardened2/linux-hardened-5.19.8-hardened2.patch"
},
"sha256": "1kl7fifsa6vsm34xg3kd2svhx18n771hfj67nhwnlalmb9whhqv1",
"version": "5.19.8"
diff --git a/pkgs/os-specific/linux/kernel/hardened/update.py b/pkgs/os-specific/linux/kernel/hardened/update.py
index d0f8c77c783f..543537b13adb 100755
--- a/pkgs/os-specific/linux/kernel/hardened/update.py
+++ b/pkgs/os-specific/linux/kernel/hardened/update.py
@@ -138,7 +138,7 @@ def fetch_patch(*, name: str, release_info: ReleaseInfo) -> Optional[Patch]:
if not sig_ok:
return None
- kernel_ver = release_info.release.tag_name.replace("-hardened1", "")
+ kernel_ver = re.sub(r"(.*)(-hardened[\d]+)$", r'\1', release_info.release.tag_name)
major = kernel_ver.split('.')[0]
sha256_kernel, _ = nix_prefetch_url(f"mirror://kernel/linux/kernel/v{major}.x/linux-{kernel_ver}.tar.xz")
diff --git a/pkgs/os-specific/linux/kernel/linux-libre.nix b/pkgs/os-specific/linux/kernel/linux-libre.nix
index f760c033683d..18f91ae78d01 100644
--- a/pkgs/os-specific/linux/kernel/linux-libre.nix
+++ b/pkgs/os-specific/linux/kernel/linux-libre.nix
@@ -1,8 +1,8 @@
{ stdenv, lib, fetchsvn, linux
, scripts ? fetchsvn {
url = "https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/";
- rev = "18911";
- sha256 = "1f5b936a7ayva2kyly3n71sg6cqdvcavcxbj3cy3imaj9247bx72";
+ rev = "18916";
+ sha256 = "0axjbr1zbj7izkvvz2nv4ij1xjjnbxpch43cpl169cr8rqdl6n6i";
}
, ...
}:
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index a2683c373ed5..ed1f887f82cb 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -143,11 +143,14 @@ let
# the buildFlags, but that would require also patching the kernel's
# toplevel Makefile to add a variable export. This would be likely to
# cause future patch conflicts.
- if [ -f scripts/gcc-plugins/gen-random-seed.sh ]; then
- substituteInPlace scripts/gcc-plugins/gen-random-seed.sh \
- --replace NIXOS_RANDSTRUCT_SEED \
- $(echo ${randstructSeed}${src} ${configfile} | sha256sum | cut -d ' ' -f 1 | tr -d '\n')
- fi
+ for file in scripts/gen-randstruct-seed.sh scripts/gcc-plugins/gen-random-seed.sh; do
+ if [ -f "$file" ]; then
+ substituteInPlace "$file" \
+ --replace NIXOS_RANDSTRUCT_SEED \
+ $(echo ${randstructSeed}${src} ${configfile} | sha256sum | cut -d ' ' -f 1 | tr -d '\n')
+ break
+ fi
+ done
patchShebangs scripts
'';
diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix
index 2a9b219726e3..7443c63361d0 100644
--- a/pkgs/top-level/linux-kernels.nix
+++ b/pkgs/top-level/linux-kernels.nix
@@ -240,6 +240,7 @@ in {
linux_5_10_hardened = hardenedKernelFor kernels.linux_5_10 { };
linux_5_15_hardened = hardenedKernelFor kernels.linux_5_15 { };
linux_5_18_hardened = throw "linux 5.18 was removed because it has reached its end of life upstream";
+ linux_5_19_hardened = hardenedKernelFor kernels.linux_5_19 { };
}));
/* Linux kernel modules are inherently tied to a specific kernel. So
@@ -546,6 +547,7 @@ in {
linux_5_10_hardened = recurseIntoAttrs (hardenedPackagesFor kernels.linux_5_10 { });
linux_5_15_hardened = recurseIntoAttrs (hardenedPackagesFor kernels.linux_5_15 { });
linux_5_18_hardened = throw "linux 5.18 was removed because it has reached its end of life upstream";
+ linux_5_19_hardened = recurseIntoAttrs (hardenedPackagesFor kernels.linux_5_19 { });
linux_zen = recurseIntoAttrs (packagesFor kernels.linux_zen);
linux_lqx = recurseIntoAttrs (packagesFor kernels.linux_lqx);