aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 14:12:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 14:12:27 -0400
commit19caf581ba441659f1a71e9a5baed032fdcfceef (patch)
tree5937b0280fa6c5fb9eb67bdf6a0cf1aef364d683
parenta75eda7bce5e8ffdebe6ddfe513b31e5ec3527d2 (diff)
parentffc8599aa9763f39f6736a79da4d1575e7006f9a (diff)
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "A set of x86 fixes: - Prevent potential NULL pointer dereferences in the HPET and HyperV code - Exclude the GART aperture from /proc/kcore to prevent kernel crashes on access - Use the correct macros for Cyrix I/O on Geode processors - Remove yet another kernel address printk leak - Announce microcode reload completion as requested by quite some people. Microcode loading has become popular recently. - Some 'Make Clang' happy fixlets - A few cleanups for recently added code" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/gart: Exclude GART aperture from kcore x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error x86/mm/pti: Make local symbols static x86/cpu/cyrix: Remove {get,set}Cx86_old macros used for Cyrix processors x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors x86/microcode: Announce reload operation's completion x86/hyperv: Prevent potential NULL pointer dereference x86/hpet: Prevent potential NULL pointer dereference x86/lib: Fix indentation issue, remove extra tab x86/boot: Restrict header scope to make Clang happy x86/mm: Don't leak kernel addresses x86/cpufeature: Fix various quality problems in the <asm/cpu_device_hd.h> header
-rw-r--r--arch/x86/boot/string.c3
-rw-r--r--arch/x86/hyperv/hv_init.c6
-rw-r--r--arch/x86/include/asm/cpu_device_id.h31
-rw-r--r--arch/x86/include/asm/processor-cyrix.h21
-rw-r--r--arch/x86/kernel/aperture_64.c20
-rw-r--r--arch/x86/kernel/cpu/cyrix.c14
-rw-r--r--arch/x86/kernel/cpu/microcode/core.c2
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/hw_breakpoint.c1
-rw-r--r--arch/x86/kernel/mpparse.c4
-rw-r--r--arch/x86/lib/csum-partial_64.c2
-rw-r--r--arch/x86/mm/pti.c4
-rw-r--r--fs/proc/kcore.c27
-rw-r--r--include/linux/kcore.h2
14 files changed, 81 insertions, 58 deletions
<
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 315a67b8896b..90154df8f125 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -13,8 +13,9 @@
13 */ 13 */
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/compiler.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/limits.h>
18#include <asm/asm.h> 19#include <asm/asm.h>
19#include "ctype.h" 20#include "ctype.h"
20#include "string.h" 21#include "string.h"
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 6461a16b4559..e4ba467a9fc6 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -103,9 +103,13 @@ static int hv_cpu_init(unsigned int cpu)
103 u64 msr_vp_index; 103 u64 msr_vp_index;
104 struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()]; 104 struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()];
105 void **input_arg; 105 void **input_arg;
106 struct page *pg;
106 107
107 input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg); 108 input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
108 *input_arg = page_address(alloc_page(GFP_KERNEL)); 109 pg = alloc_page(GFP_KERNEL);
110 if (unlikely(!pg))
111 return -ENOMEM;
112 *input_arg = page_address(pg);
109 113
110 hv_get_vp_index(msr_vp_index); 114 hv_get_vp_index(msr_vp_index);
111 115
diff --git a/arch/x86/include/asm/cpu_device_id.h b/arch/x86/include/asm/cpu_device_id.h
index 3417110574c1..31c379c1da41 100644
--- a/arch/x86/include/asm/cpu_device_id.h
+++ b/arch/x86/include/asm/cpu_device_id.h
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _CPU_DEVICE_ID 2#ifndef _ASM_X86_CPU_DEVICE_ID
3#define _CPU_DEVICE_ID 1 3#define _ASM_X86_CPU_DEVICE_ID
4 4
5/* 5/*
6 * Declare drivers belonging to specific x86 CPUs 6 * Declare drivers belonging to specific x86 CPUs
@@ -9,8 +9,6 @@
9 9
10#include <linux/mod_devicetable.h> 10#include <linux/mod_devicetable.h>
11 11
12extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
13
14/* 12/*
15 * Match specific microcode revisions. 13 * Match specific microcode revisions.
16 * 14 *
@@ -22,21 +20,22 @@ extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
22 */ 20 */
23 21
24struct x86_cpu_desc { 22struct x86_cpu_desc {
25 __u8 x86_family; 23 u8 x86_family;
26 __u8 x86_vendor; 24 u8 x86_vendor;
27 __u8 x86_model; 25 u8 x86_model;
28 __u8 x86_stepping; 26 u8 x86_stepping;
29 __u32 x86_microcode_rev; 27 u32 x86_microcode_rev;
30}; 28};
31 29
32#define INTEL_CPU_DESC(mod, step, rev) { \ 30#define INTEL_CPU_DESC(model, stepping, revision) { \
33 .x86_family = 6, \ 31 .x86_family = 6, \
34 .x86_vendor = X86_VENDOR_INTEL, \ 32 .x86_vendor = X86_VENDOR_INTEL, \
35 .x86_model = mod, \ 33 .x86_model = (model), \
36 .x86_stepping = step, \ 34 .x86_stepping = (stepping), \
37 .x86_microcode_rev = rev, \ 35 .x86_microcode_rev = (revision), \
38} 36}
39 37
38extern const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match);
40extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table); 39extern bool x86_cpu_has_min_microcode_rev(const struct x86_cpu_desc *table);
41 40
42#endif 41#endif /* _ASM_X86_CPU_DEVICE_ID */
diff --git a/arch/x86/include/asm/processor-cyrix.h b/arch/x86/include/asm/processor-cyrix.h
index aaedd73ea2c6..df700a6cc869 100644
--- a/arch/x86/include/asm/processor-cyrix.h
+++ b/arch/x86/include/asm/processor-cyrix.h
@@ -3,19 +3,6 @@
3 * NSC/Cyrix CPU indexed register access. Must be inlined instead of 3 * NSC/Cyrix CPU indexed register access. Must be inlined instead of
4 * macros to ensure correct access ordering 4 * macros to ensure correct access ordering
5 * Access order is always 0x22 (=offset), 0x23 (=value) 5 * Access order is always 0x22 (=offset), 0x23 (=value)
6 *
7 * When using the old macros a line like
8 * setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
9 * gets expanded to:
10 * do {
11 * outb((CX86_CCR2), 0x22);
12 * outb((({
13 * outb((CX86_CCR2), 0x22);
14 * inb(0x23);
15 * }) | 0x88), 0x23);
16 * } while (0);
17 *
18 * which in fact violates the access order (= 0x22, 0x22, 0x23, 0x23).
19 */ 6 */
20 7
21static inline u8 getCx86(u8 reg) 8static inline u8 getCx86(u8 reg)
@@ -29,11 +16,3 @@ static inline void setCx86(u8 reg, u8 data)
29 outb(reg, 0x22); 16 outb(reg, 0x22);
30 outb(data, 0x23); 17 outb(data, 0x23);
31} 18}
32
33#define getCx86_old(reg) ({ outb((reg), 0x22); inb(0x23); })
34
35#define setCx86_old(reg, data) do { \
36 outb((reg), 0x22); \
37 outb((data), 0x23); \
38} while (0)
39
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 58176b56354e..294ed4392a0e 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -14,6 +14,7 @@
14#define pr_fmt(fmt) "AGP: " fmt 14#define pr_fmt(fmt) "AGP: " fmt
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/kcore.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/memblock.h> 20#include <linux/memblock.h>
@@ -57,7 +58,7 @@ int fallback_aper_force __initdata;
57 58
58int fix_aperture __initdata = 1; 59int fix_aperture __initdata = 1;
59 60
60#ifdef CONFIG_PROC_VMCORE 61#if defined(CONFIG_PROC_VMCORE) || defined(CONFIG_PROC_KCORE)
61/* 62/*
62 * If the first kernel maps the aperture over e820 RAM, the kdump kernel will 63 * If the first kernel maps the aperture over e820 RAM, the kdump kernel will
63 * use the same range because it will remain configured in the northbridge. 64 * use the same range because it will remain configured in the northbridge.
@@ -66,20 +67,25 @@ int fix_aperture __initdata = 1;
66 */ 67 */
67static unsigned long aperture_pfn_start, aperture_page_count; 68static unsigned long aperture_pfn_start, aperture_page_count;
68 69
69static int gart_oldmem_pfn_is_ram(unsigned long pfn) 70static int gart_mem_pfn_is_ram(unsigned long pfn)
70{ 71{
71 return likely((pfn < aperture_pfn_start) || 72 return likely((pfn < aperture_pfn_start) ||
72 (pfn >= aperture_pfn_start + aperture_page_count)); 73 (pfn >= aperture_pfn_start + aperture_page_count));
73} 74}
74 75
75static void exclude_from_vmcore(u64 aper_base, u32 aper_order) 76static void __init exclude_from_core(u64 aper_base, u32 aper_order)
76{ 77{
77 aperture_pfn_start = aper_base >> PAGE_SHIFT; 78 aperture_pfn_start = aper_base >> PAGE_SHIFT;
78 aperture_page_count = (32 * 1024 * 1024) << aper_order >> PAGE_SHIFT; 79 aperture_page_count = (32 * 1024 * 1024) << aper_order >> PAGE_SHIFT;
79 WARN_ON(register_oldmem_pfn_is_ram(&gart_oldmem_pfn_is_ram)); 80#ifdef CONFIG_PROC_VMCORE
81