--- /dev/null
+From 4b66af2d6356a00e94bcdea3e7fea324e8b5c6f4 Mon Sep 17 00:00:00 2001
+From: Kevin Easton <kevin@guarana.org>
+Date: Sat, 7 Apr 2018 11:40:33 -0400
+Subject: af_key: Always verify length of provided sadb_key
+
+From: Kevin Easton <kevin@guarana.org>
+
+commit 4b66af2d6356a00e94bcdea3e7fea324e8b5c6f4 upstream.
+
+Key extensions (struct sadb_key) include a user-specified number of key
+bits. The kernel uses that number to determine how much key data to copy
+out of the message in pfkey_msg2xfrm_state().
+
+The length of the sadb_key message must be verified to be long enough,
+even in the case of SADB_X_AALG_NULL. Furthermore, the sadb_key_len value
+must be long enough to include both the key data and the struct sadb_key
+itself.
+
+Introduce a helper function verify_key_len(), and call it from
+parse_exthdrs() where other exthdr types are similarly checked for
+correctness.
+
+Signed-off-by: Kevin Easton <kevin@guarana.org>
+Reported-by: syzbot+5022a34ca5a3d49b84223653fab632dfb7b4cf37@syzkaller.appspotmail.com
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+Cc: Zubin Mithra <zsm@chromium.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/key/af_key.c | 45 +++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 35 insertions(+), 10 deletions(-)
+
+--- a/net/key/af_key.c
++++ b/net/key/af_key.c
+@@ -437,6 +437,24 @@ static int verify_address_len(const void
+ return 0;
+ }
+
++static inline int sadb_key_len(const struct sadb_key *key)
++{
++ int key_bytes = DIV_ROUND_UP(key->sadb_key_bits, 8);
++
++ return DIV_ROUND_UP(sizeof(struct sadb_key) + key_bytes,
++ sizeof(uint64_t));
++}
++
++static int verify_key_len(const void *p)
++{
++ const struct sadb_key *key = p;
++
++ if (sadb_key_len(key) > key->sadb_key_len)
++ return -EINVAL;
++
++ return 0;
++}
++
+ static inline int pfkey_sec_ctx_len(const struct sadb_x_sec_ctx *sec_ctx)
+ {
+ return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) +
+@@ -533,16 +551,25 @@ static int parse_exthdrs(struct sk_buff
+ return -EINVAL;
+ if (ext_hdrs[ext_type-1] != NULL)
+ return -EINVAL;
+- if (ext_type == SADB_EXT_ADDRESS_SRC ||
+- ext_type == SADB_EXT_ADDRESS_DST ||
+- ext_type == SADB_EXT_ADDRESS_PROXY ||
+- ext_type == SADB_X_EXT_NAT_T_OA) {
++ switch (ext_type) {
++ case SADB_EXT_ADDRESS_SRC:
++ case SADB_EXT_ADDRESS_DST:
++ case SADB_EXT_ADDRESS_PROXY:
++ case SADB_X_EXT_NAT_T_OA:
+ if (verify_address_len(p))
+ return -EINVAL;
+- }
+- if (ext_type == SADB_X_EXT_SEC_CTX) {
++ break;
++ case SADB_X_EXT_SEC_CTX:
+ if (verify_sec_ctx_len(p))
+ return -EINVAL;
++ break;
++ case SADB_EXT_KEY_AUTH:
++ case SADB_EXT_KEY_ENCRYPT:
++ if (verify_key_len(p))
++ return -EINVAL;
++ break;
++ default:
++ break;
+ }
+ ext_hdrs[ext_type-1] = (void *) p;
+ }
+@@ -1111,14 +1138,12 @@ static struct xfrm_state * pfkey_msg2xfr
+ key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
+ if (key != NULL &&
+ sa->sadb_sa_auth != SADB_X_AALG_NULL &&
+- ((key->sadb_key_bits+7) / 8 == 0 ||
+- (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t)))
++ key->sadb_key_bits == 0)
+ return ERR_PTR(-EINVAL);
+ key = ext_hdrs[SADB_EXT_KEY_ENCRYPT-1];
+ if (key != NULL &&
+ sa->sadb_sa_encrypt != SADB_EALG_NULL &&
+- ((key->sadb_key_bits+7) / 8 == 0 ||
+- (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t)))
++ key->sadb_key_bits == 0)
+ return ERR_PTR(-EINVAL);
+
+ x = xfrm_state_alloc(net);
x86-fpu-fix-early-fpu-command-line-parsing.patch
x86-remove-unused-function-cpu_has_ht_siblings.patch
x86-cpufeature-remove-unused-and-seldomly-used-cpu_has_xx-macros.patch
-x86-cpufeature-remove-cpu_has_arch_perfmon.patch
-x86-mm-pat-x86-cpufeature-remove-cpu_has_pat.patch
-x86-cpufeature-remove-cpu_has_osxsave.patch
-x86-cpufeature-remove-cpu_has_x2apic.patch
-x86-cpufeature-remove-cpu_has_gbpages.patch
-x86-cpufeature-remove-cpu_has_clflush.patch
-x86-cpufeature-remove-cpu_has_xmm2.patch
-x86-cpufeature-remove-cpu_has_pse.patch
-x86-cpufeature-replace-cpu_has_avx2-with-boot_cpu_has-usage.patch
-x86-cpufeature-replace-cpu_has_aes-with-boot_cpu_has-usage.patch
x86-fpu-disable-mpx-when-eagerfpu-is-off.patch
x86-fpu-disable-avx-when-eagerfpu-is-off.patch
x86-fpu-default-eagerfpu-on-on-all-cpus.patch
x86-fpu-hard-disable-lazy-fpu-mode.patch
x86-fpu-fix-fnsave-usage-in-eagerfpu-mode.patch
x86-fpu-fix-math-emulation-in-eager-fpu-mode.patch
+af_key-always-verify-length-of-provided-sadb_key.patch
+++ /dev/null
-From 7b5e74e637e4a977c7cf40fd7de332f60b68180e Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:41:54 +0200
-Subject: x86/cpufeature: Remove cpu_has_arch_perfmon
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 7b5e74e637e4a977c7cf40fd7de332f60b68180e upstream.
-
-Use boot_cpu_has() instead.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: oprofile-list@lists.sf.net
-Link: http://lkml.kernel.org/r/1459266123-21878-2-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/oprofile/nmi_int.c | 4 ++--
- arch/x86/oprofile/op_model_ppro.c | 2 +-
- 3 files changed, 3 insertions(+), 4 deletions(-)
-
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -380,7 +380,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
- #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
- #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
--#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
- #define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT)
- #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
---- a/arch/x86/oprofile/nmi_int.c
-+++ b/arch/x86/oprofile/nmi_int.c
-@@ -635,7 +635,7 @@ static int __init ppro_init(char **cpu_t
- __u8 cpu_model = boot_cpu_data.x86_model;
- struct op_x86_model_spec *spec = &op_ppro_spec; /* default */
-
-- if (force_cpu_type == arch_perfmon && cpu_has_arch_perfmon)
-+ if (force_cpu_type == arch_perfmon && boot_cpu_has(X86_FEATURE_ARCH_PERFMON))
- return 0;
-
- /*
-@@ -760,7 +760,7 @@ int __init op_nmi_init(struct oprofile_o
- if (cpu_type)
- break;
-
-- if (!cpu_has_arch_perfmon)
-+ if (!boot_cpu_has(X86_FEATURE_ARCH_PERFMON))
- return -ENODEV;
-
- /* use arch perfmon as fallback */
---- a/arch/x86/oprofile/op_model_ppro.c
-+++ b/arch/x86/oprofile/op_model_ppro.c
-@@ -75,7 +75,7 @@ static void ppro_setup_ctrs(struct op_x8
- u64 val;
- int i;
-
-- if (cpu_has_arch_perfmon) {
-+ if (boot_cpu_has(X86_FEATURE_ARCH_PERFMON)) {
- union cpuid10_eax eax;
- eax.full = cpuid_eax(0xa);
-
+++ /dev/null
-From 906bf7fda2c9cf5c1762ec607943ed54b6c5b203 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:41:59 +0200
-Subject: x86/cpufeature: Remove cpu_has_clflush
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 906bf7fda2c9cf5c1762ec607943ed54b6c5b203 upstream.
-
-Use the fast variant in the DRM code.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: dri-devel@lists.freedesktop.org
-Cc: intel-gfx@lists.freedesktop.org
-Link: http://lkml.kernel.org/r/1459266123-21878-7-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/kernel/cpu/intel.c | 2 +-
- arch/x86/kernel/tce_64.c | 2 +-
- arch/x86/mm/pageattr.c | 2 +-
- drivers/gpu/drm/drm_cache.c | 6 +++---
- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +-
- 6 files changed, 7 insertions(+), 8 deletions(-)
-
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -378,7 +378,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)
- #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
--#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
- #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
---- a/arch/x86/kernel/cpu/intel.c
-+++ b/arch/x86/kernel/cpu/intel.c
-@@ -455,7 +455,7 @@ static void init_intel(struct cpuinfo_x8
- set_cpu_cap(c, X86_FEATURE_PEBS);
- }
-
-- if (c->x86 == 6 && cpu_has_clflush &&
-+ if (c->x86 == 6 && boot_cpu_has(X86_FEATURE_CLFLUSH) &&
- (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
- set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);
-
---- a/arch/x86/kernel/tce_64.c
-+++ b/arch/x86/kernel/tce_64.c
-@@ -40,7 +40,7 @@
- static inline void flush_tce(void* tceaddr)
- {
- /* a single tce can't cross a cache line */
-- if (cpu_has_clflush)
-+ if (boot_cpu_has(X86_FEATURE_CLFLUSH))
- clflush(tceaddr);
- else
- wbinvd();
---- a/arch/x86/mm/pageattr.c
-+++ b/arch/x86/mm/pageattr.c
-@@ -1481,7 +1481,7 @@ static int change_page_attr_set_clr(unsi
- * error case we fall back to cpa_flush_all (which uses
- * WBINVD):
- */
-- if (!ret && cpu_has_clflush) {
-+ if (!ret && boot_cpu_has(X86_FEATURE_CLFLUSH)) {
- if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) {
- cpa_flush_array(addr, numpages, cache,
- cpa.flags, pages);
---- a/drivers/gpu/drm/drm_cache.c
-+++ b/drivers/gpu/drm/drm_cache.c
-@@ -72,7 +72,7 @@ drm_clflush_pages(struct page *pages[],
- {
-
- #if defined(CONFIG_X86)
-- if (cpu_has_clflush) {
-+ if (static_cpu_has(X86_FEATURE_CLFLUSH)) {
- drm_cache_flush_clflush(pages, num_pages);
- return;
- }
-@@ -105,7 +105,7 @@ void
- drm_clflush_sg(struct sg_table *st)
- {
- #if defined(CONFIG_X86)
-- if (cpu_has_clflush) {
-+ if (static_cpu_has(X86_FEATURE_CLFLUSH)) {
- struct sg_page_iter sg_iter;
-
- mb();
-@@ -129,7 +129,7 @@ void
- drm_clflush_virt_range(void *addr, unsigned long length)
- {
- #if defined(CONFIG_X86)
-- if (cpu_has_clflush) {
-+ if (static_cpu_has(X86_FEATURE_CLFLUSH)) {
- const int size = boot_cpu_data.x86_clflush_size;
- void *end = addr + length;
- addr = (void *)(((unsigned long)addr) & -size);
---- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-@@ -466,7 +466,7 @@ i915_gem_execbuffer_relocate_entry(struc
- ret = relocate_entry_cpu(obj, reloc, target_offset);
- else if (obj->map_and_fenceable)
- ret = relocate_entry_gtt(obj, reloc, target_offset);
-- else if (cpu_has_clflush)
-+ else if (static_cpu_has(X86_FEATURE_CLFLUSH))
- ret = relocate_entry_clflush(obj, reloc, target_offset);
- else {
- WARN_ONCE(1, "Impossible case in relocation handling\n");
+++ /dev/null
-From b8291adc191abec2095f03a130ac91506d345cae Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:41:58 +0200
-Subject: x86/cpufeature: Remove cpu_has_gbpages
-
-From: Borislav Petkov <bp@suse.de>
-
-commit b8291adc191abec2095f03a130ac91506d345cae upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Link: http://lkml.kernel.org/r/1459266123-21878-6-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/kvm/mmu.c | 3 ++-
- arch/x86/mm/hugetlbpage.c | 4 ++--
- arch/x86/mm/init.c | 2 +-
- arch/x86/mm/ioremap.c | 2 +-
- 5 files changed, 6 insertions(+), 6 deletions(-)
-
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -379,7 +379,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
- #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
--#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
- #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
---- a/arch/x86/kvm/mmu.c
-+++ b/arch/x86/kvm/mmu.c
-@@ -3789,7 +3789,8 @@ reset_tdp_shadow_zero_bits_mask(struct k
- __reset_rsvds_bits_mask(vcpu, &context->shadow_zero_check,
- boot_cpu_data.x86_phys_bits,
- context->shadow_root_level, false,
-- cpu_has_gbpages, true, true);
-+ boot_cpu_has(X86_FEATURE_GBPAGES),
-+ true, true);
- else
- __reset_rsvds_bits_mask_ept(&context->shadow_zero_check,
- boot_cpu_data.x86_phys_bits,
---- a/arch/x86/mm/hugetlbpage.c
-+++ b/arch/x86/mm/hugetlbpage.c
-@@ -162,7 +162,7 @@ static __init int setup_hugepagesz(char
- unsigned long ps = memparse(opt, &opt);
- if (ps == PMD_SIZE) {
- hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
-- } else if (ps == PUD_SIZE && cpu_has_gbpages) {
-+ } else if (ps == PUD_SIZE && boot_cpu_has(X86_FEATURE_GBPAGES)) {
- hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
- } else {
- printk(KERN_ERR "hugepagesz: Unsupported page size %lu M\n",
-@@ -177,7 +177,7 @@ __setup("hugepagesz=", setup_hugepagesz)
- static __init int gigantic_pages_init(void)
- {
- /* With CMA we can allocate gigantic pages at runtime */
-- if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT))
-+ if (boot_cpu_has(X86_FEATURE_GBPAGES) && !size_to_hstate(1UL << PUD_SHIFT))
- hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
- return 0;
- }
---- a/arch/x86/mm/init.c
-+++ b/arch/x86/mm/init.c
-@@ -172,7 +172,7 @@ static void __init probe_page_size_mask(
- __supported_pte_mask &= ~_PAGE_GLOBAL;
-
- /* Enable 1 GB linear kernel mappings if available: */
-- if (direct_gbpages && cpu_has_gbpages) {
-+ if (direct_gbpages && boot_cpu_has(X86_FEATURE_GBPAGES)) {
- printk(KERN_INFO "Using GB pages for direct mapping\n");
- page_size_mask |= 1 << PG_LEVEL_1G;
- } else {
---- a/arch/x86/mm/ioremap.c
-+++ b/arch/x86/mm/ioremap.c
-@@ -378,7 +378,7 @@ EXPORT_SYMBOL(iounmap);
- int __init arch_ioremap_pud_supported(void)
- {
- #ifdef CONFIG_X86_64
-- return cpu_has_gbpages;
-+ return boot_cpu_has(X86_FEATURE_GBPAGES);
- #else
- return 0;
- #endif
+++ /dev/null
-From ab4a56fa2c6ce9384ca077b6570c56fe18361f17 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:41:56 +0200
-Subject: x86/cpufeature: Remove cpu_has_osxsave
-
-From: Borislav Petkov <bp@suse.de>
-
-commit ab4a56fa2c6ce9384ca077b6570c56fe18361f17 upstream.
-
-Use boot_cpu_has() instead.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: linux-crypto@vger.kernel.org
-Link: http://lkml.kernel.org/r/1459266123-21878-4-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++-
- arch/x86/crypto/camellia_aesni_avx_glue.c | 2 +-
- arch/x86/crypto/serpent_avx2_glue.c | 2 +-
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/include/asm/xor_avx.h | 4 ++--
- 5 files changed, 6 insertions(+), 6 deletions(-)
-
---- a/arch/x86/crypto/camellia_aesni_avx2_glue.c
-+++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c
-@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(vo
- {
- const char *feature_name;
-
-- if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
-+ if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes ||
-+ !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX2 or AES-NI instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/crypto/camellia_aesni_avx_glue.c
-+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
-@@ -554,7 +554,7 @@ static int __init camellia_aesni_init(vo
- {
- const char *feature_name;
-
-- if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
-+ if (!cpu_has_avx || !cpu_has_aes || !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX or AES-NI instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/crypto/serpent_avx2_glue.c
-+++ b/arch/x86/crypto/serpent_avx2_glue.c
-@@ -538,7 +538,7 @@ static int __init init(void)
- {
- const char *feature_name;
-
-- if (!cpu_has_avx2 || !cpu_has_osxsave) {
-+ if (!cpu_has_avx2 || !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX2 instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -383,7 +383,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
--#define cpu_has_osxsave boot_cpu_has(X86_FEATURE_OSXSAVE)
- #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
- /*
- * Do not add any more of those clumsy macros - use static_cpu_has_safe() for
---- a/arch/x86/include/asm/xor_avx.h
-+++ b/arch/x86/include/asm/xor_avx.h
-@@ -167,12 +167,12 @@ static struct xor_block_template xor_blo
-
- #define AVX_XOR_SPEED \
- do { \
-- if (cpu_has_avx && cpu_has_osxsave) \
-+ if (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE)) \
- xor_speed(&xor_block_avx); \
- } while (0)
-
- #define AVX_SELECT(FASTEST) \
-- (cpu_has_avx && cpu_has_osxsave ? &xor_block_avx : FASTEST)
-+ (cpu_has_avx && boot_cpu_has(X86_FEATURE_OSXSAVE) ? &xor_block_avx : FASTEST)
-
- #else
-
+++ /dev/null
-From 16bf92261b1b6cb1a1c0671b445a2fcb5a1ecc96 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:42:03 +0200
-Subject: x86/cpufeature: Remove cpu_has_pse
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 16bf92261b1b6cb1a1c0671b445a2fcb5a1ecc96 upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Link: http://lkml.kernel.org/r/1459266123-21878-11-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/include/asm/hugetlb.h | 2 +-
- arch/x86/include/asm/pgtable.h | 2 +-
- arch/x86/mm/init.c | 4 ++--
- arch/x86/mm/init_32.c | 2 +-
- arch/x86/mm/init_64.c | 4 ++--
- arch/x86/mm/ioremap.c | 2 +-
- arch/x86/power/hibernate_32.c | 2 +-
- arch/x86/xen/enlighten.c | 2 +-
- 9 files changed, 10 insertions(+), 11 deletions(-)
-
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -368,7 +368,6 @@ extern const char * const x86_bug_flags[
- #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
-
- #define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
--#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE)
- #define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)
- #define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE)
- #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
---- a/arch/x86/include/asm/hugetlb.h
-+++ b/arch/x86/include/asm/hugetlb.h
-@@ -4,7 +4,7 @@
- #include <asm/page.h>
- #include <asm-generic/hugetlb.h>
-
--#define hugepages_supported() cpu_has_pse
-+#define hugepages_supported() boot_cpu_has(X86_FEATURE_PSE)
-
- static inline int is_hugepage_only_range(struct mm_struct *mm,
- unsigned long addr,
---- a/arch/x86/include/asm/pgtable.h
-+++ b/arch/x86/include/asm/pgtable.h
-@@ -183,7 +183,7 @@ static inline int pmd_trans_huge(pmd_t p
-
- static inline int has_transparent_hugepage(void)
- {
-- return cpu_has_pse;
-+ return boot_cpu_has(X86_FEATURE_PSE);
- }
- #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
-
---- a/arch/x86/mm/init.c
-+++ b/arch/x86/mm/init.c
-@@ -156,12 +156,12 @@ static void __init probe_page_size_mask(
- * This will simplify cpa(), which otherwise needs to support splitting
- * large pages into small in interrupt context, etc.
- */
-- if (cpu_has_pse)
-+ if (boot_cpu_has(X86_FEATURE_PSE))
- page_size_mask |= 1 << PG_LEVEL_2M;
- #endif
-
- /* Enable PSE if available */
-- if (cpu_has_pse)
-+ if (boot_cpu_has(X86_FEATURE_PSE))
- cr4_set_bits_and_update_boot(X86_CR4_PSE);
-
- /* Enable PGE if available */
---- a/arch/x86/mm/init_32.c
-+++ b/arch/x86/mm/init_32.c
-@@ -284,7 +284,7 @@ kernel_physical_mapping_init(unsigned lo
- */
- mapping_iter = 1;
-
-- if (!cpu_has_pse)
-+ if (!boot_cpu_has(X86_FEATURE_PSE))
- use_pse = 0;
-
- repeat:
---- a/arch/x86/mm/init_64.c
-+++ b/arch/x86/mm/init_64.c
-@@ -1306,7 +1306,7 @@ int __meminit vmemmap_populate(unsigned
- {
- int err;
-
-- if (cpu_has_pse)
-+ if (boot_cpu_has(X86_FEATURE_PSE))
- err = vmemmap_populate_hugepages(start, end, node);
- else
- err = vmemmap_populate_basepages(start, end, node);
-@@ -1345,7 +1345,7 @@ void register_page_bootmem_memmap(unsign
- }
- get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
-
-- if (!cpu_has_pse) {
-+ if (!boot_cpu_has(X86_FEATURE_PSE)) {
- next = (addr + PAGE_SIZE) & PAGE_MASK;
- pmd = pmd_offset(pud, addr);
- if (pmd_none(*pmd))
---- a/arch/x86/mm/ioremap.c
-+++ b/arch/x86/mm/ioremap.c
-@@ -386,7 +386,7 @@ int __init arch_ioremap_pud_supported(vo
-
- int __init arch_ioremap_pmd_supported(void)
- {
-- return cpu_has_pse;
-+ return boot_cpu_has(X86_FEATURE_PSE);
- }
-
- /*
---- a/arch/x86/power/hibernate_32.c
-+++ b/arch/x86/power/hibernate_32.c
-@@ -106,7 +106,7 @@ static int resume_physical_mapping_init(
- * normal page tables.
- * NOTE: We can mark everything as executable here
- */
-- if (cpu_has_pse) {
-+ if (boot_cpu_has(X86_FEATURE_PSE)) {
- set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE_EXEC));
- pfn += PTRS_PER_PTE;
- } else {
---- a/arch/x86/xen/enlighten.c
-+++ b/arch/x86/xen/enlighten.c
-@@ -1482,7 +1482,7 @@ static void xen_pvh_set_cr_flags(int cpu
- * For BSP, PSE PGE are set in probe_page_size_mask(), for APs
- * set them here. For all, OSFXSR OSXMMEXCPT are set in fpu__init_cpu().
- */
-- if (cpu_has_pse)
-+ if (boot_cpu_has(X86_FEATURE_PSE))
- cr4_set_bits_and_update_boot(X86_CR4_PSE);
-
- if (cpu_has_pge)
+++ /dev/null
-From 62436a4d36c94d202784cd8a997ff8bb4b880237 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:41:57 +0200
-Subject: x86/cpufeature: Remove cpu_has_x2apic
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 62436a4d36c94d202784cd8a997ff8bb4b880237 upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Acked-by: Tony Luck <tony.luck@intel.com>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Link: http://lkml.kernel.org/r/1459266123-21878-5-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/ia64/include/asm/iommu.h | 1 -
- arch/x86/include/asm/apic.h | 4 ++--
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/kernel/apic/apic.c | 2 +-
- 4 files changed, 3 insertions(+), 5 deletions(-)
-
---- a/arch/ia64/include/asm/iommu.h
-+++ b/arch/ia64/include/asm/iommu.h
-@@ -1,7 +1,6 @@
- #ifndef _ASM_IA64_IOMMU_H
- #define _ASM_IA64_IOMMU_H 1
-
--#define cpu_has_x2apic 0
- /* 10 seconds */
- #define DMAR_OPERATION_TIMEOUT (((cycles_t) local_cpu_data->itc_freq)*10)
-
---- a/arch/x86/include/asm/apic.h
-+++ b/arch/x86/include/asm/apic.h
-@@ -235,10 +235,10 @@ extern void __init check_x2apic(void);
- extern void x2apic_setup(void);
- static inline int x2apic_enabled(void)
- {
-- return cpu_has_x2apic && apic_is_x2apic_enabled();
-+ return boot_cpu_has(X86_FEATURE_X2APIC) && apic_is_x2apic_enabled();
- }
-
--#define x2apic_supported() (cpu_has_x2apic)
-+#define x2apic_supported() (boot_cpu_has(X86_FEATURE_X2APIC))
- #else /* !CONFIG_X86_X2APIC */
- static inline void check_x2apic(void) { }
- static inline void x2apic_setup(void) { }
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -380,7 +380,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
- #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
- #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
--#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
- #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
---- a/arch/x86/kernel/apic/apic.c
-+++ b/arch/x86/kernel/apic/apic.c
-@@ -1551,7 +1551,7 @@ void __init check_x2apic(void)
- pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n");
- x2apic_mode = 1;
- x2apic_state = X2APIC_ON;
-- } else if (!cpu_has_x2apic) {
-+ } else if (!boot_cpu_has(X86_FEATURE_X2APIC)) {
- x2apic_state = X2APIC_DISABLED;
- }
- }
+++ /dev/null
-From 054efb6467f84490bdf92afab6d9dbd5102e620a Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:42:00 +0200
-Subject: x86/cpufeature: Remove cpu_has_xmm2
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 054efb6467f84490bdf92afab6d9dbd5102e620a upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: linux-crypto@vger.kernel.org
-Link: http://lkml.kernel.org/r/1459266123-21878-8-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/crypto/poly1305_glue.c | 2 +-
- arch/x86/crypto/serpent_sse2_glue.c | 2 +-
- arch/x86/include/asm/cpufeature.h | 1 -
- arch/x86/kernel/cpu/amd.c | 2 +-
- arch/x86/kernel/cpu/intel.c | 2 +-
- arch/x86/lib/usercopy_32.c | 4 ++--
- 6 files changed, 6 insertions(+), 7 deletions(-)
-
---- a/arch/x86/crypto/poly1305_glue.c
-+++ b/arch/x86/crypto/poly1305_glue.c
-@@ -178,7 +178,7 @@ static struct shash_alg alg = {
-
- static int __init poly1305_simd_mod_init(void)
- {
-- if (!cpu_has_xmm2)
-+ if (!boot_cpu_has(X86_FEATURE_XMM2))
- return -ENODEV;
-
- #ifdef CONFIG_AS_AVX2
---- a/arch/x86/crypto/serpent_sse2_glue.c
-+++ b/arch/x86/crypto/serpent_sse2_glue.c
-@@ -605,7 +605,7 @@ static struct crypto_alg serpent_algs[10
-
- static int __init serpent_sse2_init(void)
- {
-- if (!cpu_has_xmm2) {
-+ if (!boot_cpu_has(X86_FEATURE_XMM2)) {
- printk(KERN_INFO "SSE2 instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -374,7 +374,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
- #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
- #define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
--#define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2)
- #define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)
- #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
---- a/arch/x86/kernel/cpu/amd.c
-+++ b/arch/x86/kernel/cpu/amd.c
-@@ -745,7 +745,7 @@ static void init_amd(struct cpuinfo_x86
- if (c->x86 >= 0xf)
- set_cpu_cap(c, X86_FEATURE_K8);
-
-- if (cpu_has_xmm2) {
-+ if (cpu_has(c, X86_FEATURE_XMM2)) {
- unsigned long long val;
- int ret;
-
---- a/arch/x86/kernel/cpu/intel.c
-+++ b/arch/x86/kernel/cpu/intel.c
-@@ -443,7 +443,7 @@ static void init_intel(struct cpuinfo_x8
- set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
- }
-
-- if (cpu_has_xmm2)
-+ if (cpu_has(c, X86_FEATURE_XMM2))
- set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
-
- if (boot_cpu_has(X86_FEATURE_DS)) {
---- a/arch/x86/lib/usercopy_32.c
-+++ b/arch/x86/lib/usercopy_32.c
-@@ -612,7 +612,7 @@ unsigned long __copy_from_user_ll_nocach
- {
- stac();
- #ifdef CONFIG_X86_INTEL_USERCOPY
-- if (n > 64 && cpu_has_xmm2)
-+ if (n > 64 && static_cpu_has(X86_FEATURE_XMM2))
- n = __copy_user_zeroing_intel_nocache(to, from, n);
- else
- __copy_user_zeroing(to, from, n);
-@@ -629,7 +629,7 @@ unsigned long __copy_from_user_ll_nocach
- {
- stac();
- #ifdef CONFIG_X86_INTEL_USERCOPY
-- if (n > 64 && cpu_has_xmm2)
-+ if (n > 64 && static_cpu_has(X86_FEATURE_XMM2))
- n = __copy_user_intel_nocache(to, from, n);
- else
- __copy_user(to, from, n);
+++ /dev/null
-From 1f4dd7938ea575a2d1972e180eaef31e6edb1808 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Mon, 4 Apr 2016 22:24:55 +0200
-Subject: x86/cpufeature: Replace cpu_has_aes with boot_cpu_has() usage
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 1f4dd7938ea575a2d1972e180eaef31e6edb1808 upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Andy Lutomirski <luto@amacapital.net>
-Cc: Borislav Petkov <bp@alien8.de>
-Cc: Brian Gerst <brgerst@gmail.com>
-Cc: Denys Vlasenko <dvlasenk@redhat.com>
-Cc: H. Peter Anvin <hpa@zytor.com>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: linux-crypto@vger.kernel.org
-Link: http://lkml.kernel.org/r/1459801503-15600-3-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 ++-
- arch/x86/crypto/camellia_aesni_avx_glue.c | 4 +++-
- arch/x86/include/asm/cpufeature.h | 1 -
- 3 files changed, 5 insertions(+), 3 deletions(-)
-
---- a/arch/x86/crypto/camellia_aesni_avx2_glue.c
-+++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c
-@@ -562,7 +562,8 @@ static int __init camellia_aesni_init(vo
- {
- const char *feature_name;
-
-- if (!boot_cpu_has(X86_FEATURE_AVX2) || !cpu_has_avx || !cpu_has_aes ||
-+ if (!boot_cpu_has(X86_FEATURE_AVX2) || !cpu_has_avx ||
-+ !boot_cpu_has(X86_FEATURE_AES) ||
- !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX2 or AES-NI instructions are not detected.\n");
- return -ENODEV;
---- a/arch/x86/crypto/camellia_aesni_avx_glue.c
-+++ b/arch/x86/crypto/camellia_aesni_avx_glue.c
-@@ -554,7 +554,9 @@ static int __init camellia_aesni_init(vo
- {
- const char *feature_name;
-
-- if (!cpu_has_avx || !cpu_has_aes || !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-+ if (!cpu_has_avx ||
-+ !boot_cpu_has(X86_FEATURE_AES) ||
-+ !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX or AES-NI instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -373,7 +373,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
- #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
- #define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
--#define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)
- #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
+++ /dev/null
-From abcfdfe07de75f830cbec1aa3eb17833a0166697 Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Mon, 4 Apr 2016 22:24:54 +0200
-Subject: x86/cpufeature: Replace cpu_has_avx2 with boot_cpu_has() usage
-
-From: Borislav Petkov <bp@suse.de>
-
-commit abcfdfe07de75f830cbec1aa3eb17833a0166697 upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Cc: Andy Lutomirski <luto@amacapital.net>
-Cc: Borislav Petkov <bp@alien8.de>
-Cc: Brian Gerst <brgerst@gmail.com>
-Cc: Denys Vlasenko <dvlasenk@redhat.com>
-Cc: H. Peter Anvin <hpa@zytor.com>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: linux-crypto@vger.kernel.org
-Link: http://lkml.kernel.org/r/1459801503-15600-2-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/crypto/camellia_aesni_avx2_glue.c | 2 +-
- arch/x86/crypto/chacha20_glue.c | 2 +-
- arch/x86/crypto/poly1305_glue.c | 2 +-
- arch/x86/crypto/serpent_avx2_glue.c | 2 +-
- arch/x86/include/asm/cpufeature.h | 1 -
- 5 files changed, 4 insertions(+), 5 deletions(-)
-
---- a/arch/x86/crypto/camellia_aesni_avx2_glue.c
-+++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c
-@@ -562,7 +562,7 @@ static int __init camellia_aesni_init(vo
- {
- const char *feature_name;
-
-- if (!cpu_has_avx2 || !cpu_has_avx || !cpu_has_aes ||
-+ if (!boot_cpu_has(X86_FEATURE_AVX2) || !cpu_has_avx || !cpu_has_aes ||
- !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX2 or AES-NI instructions are not detected.\n");
- return -ENODEV;
---- a/arch/x86/crypto/chacha20_glue.c
-+++ b/arch/x86/crypto/chacha20_glue.c
-@@ -129,7 +129,7 @@ static int __init chacha20_simd_mod_init
- return -ENODEV;
-
- #ifdef CONFIG_AS_AVX2
-- chacha20_use_avx2 = cpu_has_avx && cpu_has_avx2 &&
-+ chacha20_use_avx2 = cpu_has_avx && boot_cpu_has(X86_FEATURE_AVX2) &&
- cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
- #endif
- return crypto_register_alg(&alg);
---- a/arch/x86/crypto/poly1305_glue.c
-+++ b/arch/x86/crypto/poly1305_glue.c
-@@ -182,7 +182,7 @@ static int __init poly1305_simd_mod_init
- return -ENODEV;
-
- #ifdef CONFIG_AS_AVX2
-- poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 &&
-+ poly1305_use_avx2 = cpu_has_avx && boot_cpu_has(X86_FEATURE_AVX2) &&
- cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL);
- alg.descsize = sizeof(struct poly1305_simd_desc_ctx);
- if (poly1305_use_avx2)
---- a/arch/x86/crypto/serpent_avx2_glue.c
-+++ b/arch/x86/crypto/serpent_avx2_glue.c
-@@ -538,7 +538,7 @@ static int __init init(void)
- {
- const char *feature_name;
-
-- if (!cpu_has_avx2 || !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
-+ if (!boot_cpu_has(X86_FEATURE_AVX2) || !boot_cpu_has(X86_FEATURE_OSXSAVE)) {
- pr_info("AVX2 instructions are not detected.\n");
- return -ENODEV;
- }
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -375,7 +375,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
- #define cpu_has_aes boot_cpu_has(X86_FEATURE_AES)
- #define cpu_has_avx boot_cpu_has(X86_FEATURE_AVX)
--#define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
- #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR)
+++ /dev/null
-From 568a58e5dfbcb88011cad7f87ed046aa00f19d1a Mon Sep 17 00:00:00 2001
-From: Borislav Petkov <bp@suse.de>
-Date: Tue, 29 Mar 2016 17:42:01 +0200
-Subject: x86/mm/pat, x86/cpufeature: Remove cpu_has_pat
-
-From: Borislav Petkov <bp@suse.de>
-
-commit 568a58e5dfbcb88011cad7f87ed046aa00f19d1a upstream.
-
-Signed-off-by: Borislav Petkov <bp@suse.de>
-Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Thomas Gleixner <tglx@linutronix.de>
-Cc: intel-gfx@lists.freedesktop.org
-Link: http://lkml.kernel.org/r/1459266123-21878-9-git-send-email-bp@alien8.de
-Signed-off-by: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- arch/x86/include/asm/cpufeature.h | 1 -
- drivers/gpu/drm/i915/i915_gem.c | 2 +-
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
---- a/arch/x86/include/asm/cpufeature.h
-+++ b/arch/x86/include/asm/cpufeature.h
-@@ -380,7 +380,6 @@ extern const char * const x86_bug_flags[
- #define cpu_has_avx2 boot_cpu_has(X86_FEATURE_AVX2)
- #define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
- #define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
--#define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT)
- #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC)
- #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE)
- #define cpu_has_xsaves boot_cpu_has(X86_FEATURE_XSAVES)
---- a/drivers/gpu/drm/i915/i915_gem.c
-+++ b/drivers/gpu/drm/i915/i915_gem.c
-@@ -1730,7 +1730,7 @@ i915_gem_mmap_ioctl(struct drm_device *d
- if (args->flags & ~(I915_MMAP_WC))
- return -EINVAL;
-
-- if (args->flags & I915_MMAP_WC && !cpu_has_pat)
-+ if (args->flags & I915_MMAP_WC && !boot_cpu_has(X86_FEATURE_PAT))
- return -ENODEV;
-
- obj = drm_gem_object_lookup(dev, file, args->handle);