Skip to content

Commit

Permalink
linux_{4_8,grsec_nixos}: patch to fix build failure
Browse files Browse the repository at this point in the history
crypto/rsa_helper.c:18:28: fatal error: rsapubkey-asn1.h: No such file or directory

(cherry picked from commit 7a813d3)
  • Loading branch information
grahamc committed Dec 13, 2016
1 parent 77b32b3 commit f38c537
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
45 changes: 45 additions & 0 deletions pkgs/os-specific/linux/kernel/multithreaded-rsapubkey-asn1.patch
@@ -0,0 +1,45 @@

From Yang Shi <>
Subject [PATCH] crypto: rsa - fix a potential race condition in build
Date Fri, 2 Dec 2016 15:41:04 -0800


When building kernel with RSA enabled with multithreaded, the below
compile failure might be caught:

| /buildarea/kernel-source/crypto/rsa_helper.c:18:28: fatal error: rsapubkey-asn1.h: No such file or directory
| #include "rsapubkey-asn1.h"
| ^
| compilation terminated.
| CC crypto/rsa-pkcs1pad.o
| CC crypto/algboss.o
| CC crypto/testmgr.o
| make[3]: *** [/buildarea/kernel-source/scripts/Makefile.build:289: crypto/rsa_helper.o] Error 1
| make[3]: *** Waiting for unfinished jobs....
| make[2]: *** [/buildarea/kernel-source/Makefile:969: crypto] Error 2
| make[1]: *** [Makefile:150: sub-make] Error 2
| make: *** [Makefile:24: __sub-make] Error 2

The header file is not generated before rsa_helper is compiled, so
adding dependency to avoid such issue.

Signed-off-by: Yang Shi <yang.shi@windriver.com>

---
crypto/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/crypto/Makefile b/crypto/Makefile
index 99cc64a..8db39f9 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_CRYPTO_ECDH) += ecdh_generic.o

$(obj)/rsapubkey-asn1.o: $(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h
$(obj)/rsaprivkey-asn1.o: $(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h
+$(obj)/rsa_helper.o: $(obj)/rsa_helper.c $(obj)/rsaprivkey-asn1.h
clean-files += rsapubkey-asn1.c rsapubkey-asn1.h
clean-files += rsaprivkey-asn1.c rsaprivkey-asn1.h

--
2.0.2
6 changes: 6 additions & 0 deletions pkgs/os-specific/linux/kernel/patches.nix
Expand Up @@ -38,6 +38,12 @@ in

rec {

multithreaded_rsapubkey =
{
name = "multithreaded-rsapubkey-asn1.patch";
patch = ./multithreaded-rsapubkey-asn1.patch;
};

bridge_stp_helper =
{ name = "bridge-stp-helper";
patch = ./bridge-stp-helper.patch;
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -11252,6 +11252,7 @@ in
linux_4_8 = callPackage ../os-specific/linux/kernel/linux-4.8.nix {
kernelPatches =
[ kernelPatches.bridge_stp_helper
kernelPatches.multithreaded_rsapubkey
# See pkgs/os-specific/linux/kernel/cpu-cgroup-v2-patches/README.md
# when adding a new linux version
# !!! 4.7 patch doesn't apply, 4.8 patch not up yet, will keep checking
Expand Down Expand Up @@ -11453,6 +11454,7 @@ in
inherit (lib) overrideDerivation;
kernel = callPackage ../os-specific/linux/kernel/linux-grsecurity.nix {
kernelPatches = with self.kernelPatches; [
kernelPatches.multithreaded_rsapubkey
bridge_stp_helper
modinst_arg_list_too_long
] ++ lib.optionals ((platform.kernelArch or null) == "mips")
Expand Down

0 comments on commit f38c537

Please sign in to comment.