From c796f87d68dd7d9f45c4318d82a511014ec9457e Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Thu, 23 Feb 2017 09:11:17 -0800 Subject: [PATCH] Linux v4.10-6476-gbc49a78 --- 0001-Work-around-for-gcc7-and-arm64.patch | 62 --- ...mapping_error-when-bypassing-SWIOTLB.patch | 66 --- efi-lockdown.patch | 402 +++++++++--------- gitrev | 2 +- kernel-aarch64-debug.config | 44 ++ kernel-aarch64.config | 44 ++ kernel-armv7hl-debug.config | 41 ++ kernel-armv7hl-lpae-debug.config | 41 ++ kernel-armv7hl-lpae.config | 41 ++ kernel-armv7hl.config | 41 ++ kernel-i686-PAE.config | 42 ++ kernel-i686-PAEdebug.config | 42 ++ kernel-i686-debug.config | 42 ++ kernel-i686.config | 42 ++ kernel-ppc64-debug.config | 40 ++ kernel-ppc64.config | 40 ++ kernel-ppc64le-debug.config | 40 ++ kernel-ppc64le.config | 40 ++ kernel-ppc64p7-debug.config | 40 ++ kernel-ppc64p7.config | 40 ++ kernel-s390x-debug.config | 40 ++ kernel-s390x.config | 40 ++ kernel-x86_64-debug.config | 42 ++ kernel-x86_64.config | 42 ++ kernel.spec | 14 +- kvm-fix-page-struct-leak-in-handle_vmon.patch | 49 --- sources | 2 +- 27 files changed, 1031 insertions(+), 390 deletions(-) delete mode 100644 0001-Work-around-for-gcc7-and-arm64.patch delete mode 100644 arm64-dma-mapping-Fix-dma_mapping_error-when-bypassing-SWIOTLB.patch delete mode 100644 kvm-fix-page-struct-leak-in-handle_vmon.patch diff --git a/0001-Work-around-for-gcc7-and-arm64.patch b/0001-Work-around-for-gcc7-and-arm64.patch deleted file mode 100644 index 88f40be5d..000000000 --- a/0001-Work-around-for-gcc7-and-arm64.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 975dcf140bd307b431aff7b6d671155c796cfe5e Mon Sep 17 00:00:00 2001 -From: Laura Abbott -Date: Sat, 28 Jan 2017 16:13:49 +0100 -Subject: [PATCH] Work around for gcc7 and arm64 - -Originally proposed by Will Deacon - -http://lists.infradead.org/pipermail/linux-arm-kernel/2016-October/462224.html - -Signed-off-by: Laura Abbott ---- - include/linux/log2.h | 13 ++----------- - 1 file changed, 2 insertions(+), 11 deletions(-) - -diff --git a/include/linux/log2.h b/include/linux/log2.h -index fd7ff3d91e6a..1ab22b79681e 100644 ---- a/include/linux/log2.h -+++ b/include/linux/log2.h -@@ -16,12 +16,6 @@ - #include - - /* -- * deal with unrepresentable constant logarithms -- */ --extern __attribute__((const, noreturn)) --int ____ilog2_NaN(void); -- --/* - * non-constant log of base 2 calculators - * - the arch may override these in asm/bitops.h if they can be implemented - * more efficiently than using fls() and fls64() -@@ -85,7 +79,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) - #define ilog2(n) \ - ( \ - __builtin_constant_p(n) ? ( \ -- (n) < 1 ? ____ilog2_NaN() : \ -+ (n) < 1 ? 0 : \ - (n) & (1ULL << 63) ? 63 : \ - (n) & (1ULL << 62) ? 62 : \ - (n) & (1ULL << 61) ? 61 : \ -@@ -149,9 +143,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) - (n) & (1ULL << 3) ? 3 : \ - (n) & (1ULL << 2) ? 2 : \ - (n) & (1ULL << 1) ? 1 : \ -- (n) & (1ULL << 0) ? 0 : \ -- ____ilog2_NaN() \ -- ) : \ -+ 0 ) : \ - (sizeof(n) <= 4) ? \ - __ilog2_u32(n) : \ - __ilog2_u64(n) \ -@@ -194,7 +186,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n) - * @n: parameter - * - * The first few values calculated by this routine: -- * ob2(0) = 0 - * ob2(1) = 0 - * ob2(2) = 1 - * ob2(3) = 2 --- -2.11.0 - diff --git a/arm64-dma-mapping-Fix-dma_mapping_error-when-bypassing-SWIOTLB.patch b/arm64-dma-mapping-Fix-dma_mapping_error-when-bypassing-SWIOTLB.patch deleted file mode 100644 index 2e7f51ec6..000000000 --- a/arm64-dma-mapping-Fix-dma_mapping_error-when-bypassing-SWIOTLB.patch +++ /dev/null @@ -1,66 +0,0 @@ -From patchwork Wed Jan 25 18:31:31 2017 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -Subject: [v2] arm64: dma-mapping: Fix dma_mapping_error() when bypassing - SWIOTLB -From: Robin Murphy -X-Patchwork-Id: 9537723 -Message-Id: <840027acb4750542003dff17b4a8902ba8972754.1485368348.git.robin.murphy@arm.com> -To: will.deacon@arm.com, - catalin.marinas@arm.com -Cc: Jisheng Zhang , arnd@arndb.de, - konrad.wilk@oracle.com, aaro.koskinen@iki.fi, stable@vger.kernel.org, - linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org -Date: Wed, 25 Jan 2017 18:31:31 +0000 - -When bypassing SWIOTLB on small-memory systems, we need to avoid calling -into swiotlb_dma_mapping_error() in exactly the same way as we avoid -swiotlb_dma_supported(), because the former also relies on SWIOTLB state -being initialised. - -Under the assumptions for which we skip SWIOTLB, dma_map_{single,page}() -will only ever return the DMA-offset-adjusted physical address of the -page passed in, thus we can report success unconditionally. - -Fixes: b67a8b29df7e ("arm64: mm: only initialize swiotlb when necessary") -CC: stable@vger.kernel.org -CC: Jisheng Zhang -Reported-by: Aaro Koskinen -Signed-off-by: Robin Murphy -Tested-by: Aaro Koskinen ---- - -v2: Get the return value the right way round this time... After some - careful reasoning it really is that simple. - - arch/arm64/mm/dma-mapping.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c -index e04082700bb1..1ffb7d5d299a 100644 ---- a/arch/arm64/mm/dma-mapping.c -+++ b/arch/arm64/mm/dma-mapping.c -@@ -352,6 +352,13 @@ static int __swiotlb_dma_supported(struct device *hwdev, u64 mask) - return 1; - } - -+static int __swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t addr) -+{ -+ if (swiotlb) -+ return swiotlb_dma_mapping_error(hwdev, addr); -+ return 0; -+} -+ - static struct dma_map_ops swiotlb_dma_ops = { - .alloc = __dma_alloc, - .free = __dma_free, -@@ -366,7 +373,7 @@ static struct dma_map_ops swiotlb_dma_ops = { - .sync_sg_for_cpu = __swiotlb_sync_sg_for_cpu, - .sync_sg_for_device = __swiotlb_sync_sg_for_device, - .dma_supported = __swiotlb_dma_supported, -- .mapping_error = swiotlb_dma_mapping_error, -+ .mapping_error = __swiotlb_dma_mapping_error, - }; - - static int __init atomic_pool_init(void) diff --git a/efi-lockdown.patch b/efi-lockdown.patch index dcdd2e99a..d6517d5ed 100644 --- a/efi-lockdown.patch +++ b/efi-lockdown.patch @@ -1,4 +1,4 @@ -From 9079547f4808ea5c8cd844bf40d3895994bd175e Mon Sep 17 00:00:00 2001 +From df7d76ae50f18d4465e59fdf7f19d3df44906cb5 Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Mon, 21 Nov 2016 23:55:55 +0000 Subject: [PATCH 07/32] efi: Add EFI_SECURE_BOOT bit @@ -13,9 +13,9 @@ out whether secure boot mode is enabled so that it can be disabled. Signed-off-by: Josh Boyer Signed-off-by: David Howells --- - arch/x86/kernel/setup.c | 15 +++++++++++++++ - include/linux/efi.h | 1 + - 2 files changed, 16 insertions(+) + arch/x86/kernel/setup.c | 1 + + include/linux/efi.h | 1 + + 2 files changed, 2 insertions(+) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 69780ed..447905e 100644 @@ -38,13 +38,13 @@ index 94d34e0..6049600 100644 #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ +#define EFI_SECURE_BOOT 11 /* Are we in Secure Boot mode? */ - + #ifdef CONFIG_EFI /* -- -2.9.3 +2.7.4 -From eada0243f0b8fc21588a21c564187219dee03e3c Mon Sep 17 00:00:00 2001 +From 0f9281e3b77bf5f767f1993d52b152a1ef317a0a Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 25 Nov 2016 11:52:05 +0000 Subject: [PATCH 08/32] efi: Handle secure boot from UEFI-2.6 @@ -60,20 +60,20 @@ Signed-off-by: David Howells 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/secureboot.c b/drivers/firmware/efi/libstub/secureboot.c -index ba6ef71..333b159 100644 +index 6def402..77af519 100644 --- a/drivers/firmware/efi/libstub/secureboot.c +++ b/drivers/firmware/efi/libstub/secureboot.c -@@ -22,6 +22,9 @@ static const efi_char16_t const efi_SecureBoot_name[] = { +@@ -20,6 +20,9 @@ static const efi_char16_t const efi_SecureBoot_name[] = { static const efi_char16_t const efi_SetupMode_name[] = { 'S', 'e', 't', 'u', 'p', 'M', 'o', 'd', 'e', 0 }; +static const efi_char16_t const efi_DeployedMode_name[] = { + 'D', 'e', 'p', 'l', 'o', 'y', 'e', 'd', 'M', 'o', 'd', 'e', 0 +}; - + /* SHIM variables */ static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID; -@@ -40,7 +43,7 @@ static efi_char16_t const shim_MokSBState_name[] = { +@@ -38,7 +41,7 @@ static efi_char16_t const shim_MokSBState_name[] = { enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) { u32 attr; @@ -81,11 +81,11 @@ index ba6ef71..333b159 100644 + u8 secboot, setupmode, deployedmode, moksbstate; unsigned long size; efi_status_t status; - -@@ -57,6 +57,17 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) + +@@ -57,6 +60,17 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg) if (secboot == 0 || setupmode == 1) return efi_secureboot_mode_disabled; - + + /* UEFI-2.6 requires DeployedMode to be 1. */ + if (sys_table_arg->hdr.revision >= EFI_2_60_SYSTEM_TABLE_REVISION) { + size = sizeof(deployedmode); @@ -100,15 +100,14 @@ index ba6ef71..333b159 100644 /* * See if a user has put the shim into insecure mode. If so, and if the * variable doesn't have the runtime attribute set, we might as well - * honor that. diff --git a/include/linux/efi.h b/include/linux/efi.h -index 135ca9c..e1893f5 100644 +index 6049600..784a276 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h -@@ -645,6 +645,10 @@ typedef struct { - +@@ -646,6 +646,10 @@ typedef struct { + #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) - + +#define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60)) +#define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50)) +#define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40)) @@ -117,9 +116,9 @@ index 135ca9c..e1893f5 100644 #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20)) #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10)) -- -2.9.3 +2.7.4 -From 3b0695eda22ad712a2b9be9bb70979d875a37816 Mon Sep 17 00:00:00 2001 +From f05a90c19a9613d8d50597319ed91f691e25b689 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 21 Nov 2016 23:36:17 +0000 Subject: [PATCH 09/32] Add the ability to lock down access to the running @@ -142,13 +141,13 @@ Signed-off-by: David Howells create mode 100644 security/lock_down.c diff --git a/include/linux/kernel.h b/include/linux/kernel.h -index bc6ed52..8ab309d 100644 +index cb09238..3cd3be9 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h -@@ -268,6 +268,15 @@ extern int oops_may_print(void); +@@ -273,6 +273,15 @@ extern int oops_may_print(void); void do_exit(long error_code) __noreturn; void complete_and_exit(struct completion *, long) __noreturn; - + +#ifdef CONFIG_LOCK_DOWN_KERNEL +extern bool kernel_is_locked_down(void); +#else @@ -162,13 +161,13 @@ index bc6ed52..8ab309d 100644 int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); int __must_check _kstrtol(const char *s, unsigned int base, long *res); diff --git a/include/linux/security.h b/include/linux/security.h -index c2125e9..41a7325 100644 +index d3868f2..187b74b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h -@@ -1685,5 +1685,16 @@ static inline void free_secdata(void *secdata) +@@ -1679,5 +1679,16 @@ static inline void free_secdata(void *secdata) { } #endif /* CONFIG_SECURITY */ - + +#ifdef CONFIG_LOCK_DOWN_KERNEL +extern void lock_kernel_down(void); +#ifdef CONFIG_ALLOW_LOCKDOWN_LIFT @@ -181,15 +180,15 @@ index c2125e9..41a7325 100644 +#endif + #endif /* ! __LINUX_SECURITY_H */ - + diff --git a/security/Kconfig b/security/Kconfig -index 118f454..fa1a678 100644 +index d900f47..d9b391d 100644 --- a/security/Kconfig +++ b/security/Kconfig -@@ -158,6 +158,21 @@ config HARDENED_USERCOPY_PAGESPAN - been removed. This config is intended to be used only while - trying to find such users. - +@@ -193,6 +193,21 @@ config STATIC_USERMODEHELPER_PATH + If you wish for all usermode helper programs to be disabled, + specify an empty string here (i.e. ""). + +config LOCK_DOWN_KERNEL + bool "Allow the kernel to be 'locked down'" + help @@ -266,9 +265,9 @@ index 0000000..5788c60 +} +EXPORT_SYMBOL(kernel_is_locked_down); -- -2.9.3 +2.7.4 -From c1cc643f82e1c9efee123eb81befb58e41b87310 Mon Sep 17 00:00:00 2001 +From fb6feb38e297260d050fc477c72683ac51d07ae3 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 21 Nov 2016 23:55:55 +0000 Subject: [PATCH 10/32] efi: Lock down the kernel if booted in secure boot mode @@ -286,13 +285,13 @@ Signed-off-by: David Howells 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index bada636..5b19997 100644 +index 874c123..a315974 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig -@@ -1786,6 +1786,18 @@ config EFI_MIXED - +@@ -1816,6 +1816,18 @@ config EFI_MIXED + If unsure, say N. - + +config EFI_SECURE_BOOT_LOCK_DOWN + def_bool n + depends on EFI @@ -309,7 +308,7 @@ index bada636..5b19997 100644 def_bool y prompt "Enable seccomp to safely compute untrusted bytecode" diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c -index d8972ec..facaeb9 100644 +index 447905e..d44e60e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -69,6 +69,7 @@ @@ -317,10 +316,10 @@ index d8972ec..facaeb9 100644 #include #include +#include - + #include