From b4d0cb44975e069e926a2c8963aded9557040541 Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Mon, 11 Jul 2022 13:07:37 +0200 Subject: [PATCH] kernel: port randstruct patch to 5.19 Signed-off-by: Roman Volosatovs Signed-off-by: Roman Volosatovs --- pkgs/os-specific/linux/kernel/manual-config.nix | 3 ++- .../linux/kernel/randstruct-provide-seed-5.19.patch | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 910541f0ba60..acf965d99507 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -114,7 +114,8 @@ let patches = map (p: p.patch) kernelPatches # Required for deterministic builds along with some postPatch magic. - ++ optional (lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch + ++ optional (lib.versionAtLeast version "4.13" && lib.versionOlder version "5.19") ./randstruct-provide-seed.patch + ++ optional (lib.versionAtLeast version "5.19") ./randstruct-provide-seed-5.19.patch # Fixes determinism by normalizing metadata for the archive of kheaders ++ optional (lib.versionAtLeast version "5.2" && lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch; diff --git a/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch b/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch new file mode 100644 index 000000000000..5ca897a76bf6 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/gen-randstruct-seed.sh b/scripts/gen-randstruct-seed.sh +index 61017b36c464..7bb494dd2e18 100755 +--- a/scripts/gen-randstruct-seed.sh ++++ b/scripts/gen-randstruct-seed.sh +@@ -1,7 +1,7 @@ + #!/bin/sh + # SPDX-License-Identifier: GPL-2.0 + +-SEED=$(od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n') ++SEED="NIXOS_RANDSTRUCT_SEED" + echo "$SEED" > "$1" + HASH=$(echo -n "$SEED" | sha256sum | cut -d" " -f1) + echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"