diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-03 21:25:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-03 21:25:17 -0400 |
commit | 601a88077cf6e5c85a776cf27f643e5d563b29fb (patch) | |
tree | 132f349aa6b13676ad42ed54808f6a23a29039fc | |
parent | 01897f3e05ede4d66c0f9df465fde1d67a1d733f (diff) | |
parent | 23a12ddee1ce28065b71f14ccc695b5a0c8a64ff (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
"A number of fixes and some late updates:
- make in_compat_syscall() behavior on x86-32 similar to other
platforms, this touches a number of generic files but is not
intended to impact non-x86 platforms.
- objtool fixes
- PAT preemption fix
- paravirt fixes/cleanups
- cpufeatures updates for new instructions
- earlyprintk quirk
- make microcode version in sysfs world-readable (it is already
world-readable in procfs)
- minor cleanups and fixes"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
compat: Cleanup in_compat_syscall() callers
x86/compat: Adjust in_compat_syscall() to generic code under !COMPAT
objtool: Support GCC 9 cold subfunction naming scheme
x86/numa_emulation: Fix uniform-split numa emulation
x86/paravirt: Remove unused _paravirt_ident_32
x86/mm/pat: Disable preemption around __flush_tlb_all()
x86/paravirt: Remove GPL from pv_ops export
x86/traps: Use format string with panic() call
x86: Clean up 'sizeof x' => 'sizeof(x)'
x86/cpufeatures: Enumerate MOVDIR64B instruction
x86/cpufeatures: Enumerate MOVDIRI instruction
x86/earlyprintk: Add a force option for pciserial device
objtool: Support per-function rodata sections
x86/microcode: Make revision and processor flags world-readable
47 files changed, 198 insertions, 171 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index b90fe3b6bc6c..81d1d5a74728 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
@@ -1068,7 +1068,7 @@ | |||
1068 | earlyprintk=serial[,0x...[,baudrate]] | 1068 | earlyprintk=serial[,0x...[,baudrate]] |
1069 | earlyprintk=ttySn[,baudrate] | 1069 | earlyprintk=ttySn[,baudrate] |
1070 | earlyprintk=dbgp[debugController#] | 1070 | earlyprintk=dbgp[debugController#] |
1071 | earlyprintk=pciserial,bus:device.function[,baudrate] | 1071 | earlyprintk=pciserial[,force],bus:device.function[,baudrate] |
1072 | earlyprintk=xdbc[xhciController#] | 1072 | earlyprintk=xdbc[xhciController#] |
1073 | 1073 | ||
1074 | earlyprintk is useful when the kernel crashes before | 1074 | earlyprintk is useful when the kernel crashes before |
@@ -1100,6 +1100,10 @@ | |||
1100 | 1100 | ||
1101 | The sclp output can only be used on s390. | 1101 | The sclp output can only be used on s390. |
1102 | 1102 | ||
1103 | The optional "force" to "pciserial" enables use of a | ||
1104 | PCI device even when its classcode is not of the | ||
1105 | UART class. | ||
1106 | |||
1103 | edac_report= [HW,EDAC] Control how to report EDAC event | 1107 | edac_report= [HW,EDAC] Control how to report EDAC event |
1104 | Format: {"on" | "off" | "force"} | 1108 | Format: {"on" | "off" | "force"} |
1105 | on: enable EDAC to report H/W event. May be overridden | 1109 | on: enable EDAC to report H/W event. May be overridden |
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c index 8f0c4c9fc904..51079fc9298f 100644 --- a/arch/x86/boot/cpucheck.c +++ b/arch/x86/boot/cpucheck.c | |||
@@ -113,7 +113,7 @@ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr) | |||
113 | { | 113 | { |
114 | int err; | 114 | int err; |
115 | 115 | ||
116 | memset(&cpu.flags, 0, sizeof cpu.flags); | 116 | memset(&cpu.flags, 0, sizeof(cpu.flags)); |
117 | cpu.level = 3; | 117 | cpu.level = 3; |
118 | 118 | ||
119 | if (has_eflag(X86_EFLAGS_AC)) | 119 | if (has_eflag(X86_EFLAGS_AC)) |
diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c index b25c53527a94..023bf1c3de8b 100644 --- a/arch/x86/boot/early_serial_console.c +++ b/arch/x86/boot/early_serial_console.c | |||
@@ -50,7 +50,7 @@ static void parse_earlyprintk(void) | |||
50 | int pos = 0; | 50 | int pos = 0; |
51 | int port = 0; | 51 | int port = 0; |
52 | 52 | ||
53 | if (cmdline_find_option("earlyprintk", arg, sizeof arg) > 0) { | 53 | if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) { |
54 | char *e; | 54 | char *e; |
55 | 55 | ||
56 | if (!strncmp(arg, "serial", 6)) { | 56 | if (!strncmp(arg, "serial", 6)) { |
@@ -124,7 +124,7 @@ static void parse_console_uart8250(void) | |||
124 | * console=uart8250,io,0x3f8,115200n8 | 124 | * console=uart8250,io,0x3f8,115200n8 |
125 | * need to make sure it is last one console ! | 125 | * need to make sure it is last one console ! |
126 | */ | 126 | */ |
127 | if (cmdline_find_option("console", optstr, sizeof optstr) <= 0) | 127 | if (cmdline_find_option("console", optstr, sizeof(optstr)) <= 0) |
128 | return; | 128 | return; |
129 | 129 | ||
130 | options = optstr; | 130 | options = optstr; |
diff --git a/arch/x86/boot/edd.c b/arch/x86/boot/edd.c index 223e42527077..6c176b6a42ad 100644 --- a/arch/x86/boot/edd.c +++ b/arch/x86/boot/edd.c | |||
@@ -76,7 +76,7 @@ static int get_edd_info(u8 devno, struct edd_info *ei) | |||
76 | { | 76 | { |
77 | struct biosregs ireg, oreg; | 77 | struct biosregs ireg, oreg; |
78 | 78 | ||
79 | memset(ei, 0, sizeof *ei); | 79 | memset(ei, 0, sizeof(*ei)); |
80 | 80 | ||
81 | /* Check Extensions Present */ | 81 | /* Check Extensions Present */ |
82 | 82 | ||
@@ -133,7 +133,7 @@ void query_edd(void) | |||
133 | struct edd_info ei, *edp; | 133 | struct edd_info ei, *edp; |
134 | u32 *mbrptr; | 134 | u32 *mbrptr; |
135 | 135 | ||
136 | if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { | 136 | if (cmdline_find_option("edd", eddarg, sizeof(eddarg)) > 0) { |
137 | if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) { | 137 | if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) { |
138 | do_edd = 1; | 138 | do_edd = 1; |
139 | do_mbr = 0; | 139 | do_mbr = 0; |
@@ -166,7 +166,7 @@ void query_edd(void) | |||
166 | */ | 166 | */ |
167 | if (!get_edd_info(devno, &ei) | 167 | if (!get_edd_info(devno, &ei) |
168 | && boot_params.eddbuf_entries < EDDMAXNR) { | 168 | && boot_params.eddbuf_entries < EDDMAXNR) { |
169 | memcpy(edp, &ei, sizeof ei); | 169 | memcpy(edp, &ei, sizeof(ei)); |
170 | edp++; | 170 | edp++; |
171 | boot_params.eddbuf_entries++; | 171 | boot_params.eddbuf_entries++; |
172 | } | 172 | } |
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 9bcea386db65..73532543d689 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c | |||
@@ -36,8 +36,8 @@ static void copy_boot_params(void) | |||
36 | const struct old_cmdline * const oldcmd = | 36 | const struct old_cmdline * const oldcmd = |
37 | (const struct old_cmdline *)OLD_CL_ADDRESS; | 37 | (const struct old_cmdline *)OLD_CL_ADDRESS; |
38 | 38 | ||
39 | BUILD_BUG_ON(sizeof boot_params != 4096); | 39 | BUILD_BUG_ON(sizeof(boot_params) != 4096); |
40 | memcpy(&boot_params.hdr, &hdr, sizeof hdr); | 40 | memcpy(&boot_params.hdr, &hdr, sizeof(hdr)); |
41 | 41 | ||
42 | if (!boot_params.hdr.cmd_line_ptr && | 42 | if (!boot_params.hdr.cmd_line_ptr && |
43 | oldcmd->cl_magic == OLD_CL_MAGIC) { | 43 | oldcmd->cl_magic == OLD_CL_MAGIC) { |
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index d9c28c87e477..7df2b28207be 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c | |||
@@ -26,7 +26,7 @@ static int detect_memory_e820(void) | |||
26 | 26 | ||
27 | initregs(&ireg); | 27 | initregs(&ireg); |
28 | ireg.ax = 0xe820; | 28 | ireg.ax = 0xe820; |
29 | ireg.cx = sizeof buf; | 29 | ireg.cx = sizeof(buf); |
30 | ireg.edx = SMAP; | 30 | ireg.edx = SMAP; |
31 | ireg.di = (size_t)&buf; | 31 | ireg.di = (size_t)&buf; |
32 | 32 | ||
diff --git a/arch/x86/boot/regs.c b/arch/x86/boot/regs.c index c0fb356a3092..2fe3616ba161 100644 --- a/arch/x86/boot/regs.c +++ b/arch/x86/boot/regs.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | void initregs(struct biosregs *reg) | 22 | void initregs(struct biosregs *reg) |
23 | { | 23 | { |
24 | memset(reg, 0, sizeof *reg); | 24 | memset(reg, 0, sizeof(*reg)); |
25 | reg->eflags |= X86_EFLAGS_CF; | 25 | reg->eflags |= X86_EFLAGS_CF; |
26 | reg->ds = ds(); | 26 | reg->ds = ds(); |
27 | reg->es = ds(); | 27 | reg->es = ds(); |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index ba3e100654db..3ecc11a9c440 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -62,7 +62,7 @@ static int vesa_probe(void) | |||
62 | if (mode & ~0x1ff) | 62 | if (mode & ~0x1ff) |
63 | continue; | 63 | continue; |
64 | 64 | ||
65 | memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ | 65 | memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */ |
66 | 66 | ||
67 | ireg.ax = 0x4f01; | 67 | ireg.ax = 0x4f01; |
68 | ireg.cx = mode; | 68 | ireg.cx = mode; |
@@ -109,7 +109,7 @@ static int vesa_set_mode(struct mode_info *mode) | |||
109 | int is_graphic; | 109 | int is_graphic; |
110 | u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA; | 110 | u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA; |
111 | 111 | ||
112 | memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ | 112 | memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */ |
113 | 113 | ||
114 | initregs(&ireg); | 114 | initregs(&ireg); |
115 | ireg.ax = 0x4f01; | 115 | ireg.ax = 0x4f01; |
@@ -241,7 +241,7 @@ void vesa_store_edid(void) | |||
241 | struct biosregs ireg, oreg; | 241 | struct biosregs ireg, oreg; |
242 | 242 | ||
243 | /* Apparently used as a nonsense token... */ | 243 | /* Apparently used as a nonsense token... */ |
244 | memset(&boot_params.edid_info, 0x13, sizeof boot_params.edid_info); | 244 | memset(&boot_params.edid_info, 0x13, sizeof(boot_params.edid_info)); |
245 | 245 | ||
246 | if (vginfo.version < 0x0200) | 246 | if (vginfo.version < 0x0200) |
247 | return; /* EDID requires VBE 2.0+ */ | 247 | return; /* EDID requires VBE 2.0+ */ |
diff --git a/arch/x86/boot/video.c b/arch/x86/boot/video.c index 77780e386e9b..ac89b6624a40 100644 --- a/arch/x86/boot/video.c +++ b/arch/x86/boot/video.c | |||
@@ -115,7 +115,7 @@ static unsigned int get_entry(void) | |||
115 | } else if ((key >= '0' && key <= '9') || | 115 | } else if ((key >= '0' && key <= '9') || |
116 | (key >= 'A' && key <= 'Z') || | 116 | (key >= 'A' && key <= 'Z') || |
117 | (key >= 'a' && key <= 'z')) { | 117 | (key >= 'a' && key <= 'z')) { |
118 | if (len < sizeof entry_buf) { | 118 | if (len < sizeof(entry_buf)) { |
119 | entry_buf[len++] = key; | 119 | entry_buf[len++] = key; |
120 | putchar(key); | 120 | putchar(key); |
121 | } | 121 | } |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 0fb8659b20d8..273c62e81546 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -4535,7 +4535,7 @@ __init int intel_pmu_init(void) | |||
4535 | } | 4535 | } |
4536 | } | 4536 | } |
4537 | 4537 | ||
4538 | snprintf(pmu_name_str, sizeof pmu_name_str, "%s", name); | 4538 | snprintf(pmu_name_str, sizeof(pmu_name_str), "%s", name); |
4539 | 4539 | ||
4540 | if (version >= 2 && extra_attr) { | 4540 | if (version >= 2 && extra_attr) { |
4541 | x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr, | 4541 | x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr, |
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index fab4df16a3c4..22c4dfe65992 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h | |||
@@ -217,11 +217,18 @@ static inline bool in_x32_syscall(void) | |||
217 | return false; | 217 | return false; |
218 | } | 218 | } |
219 | 219 | ||
220 | static inline bool in_compat_syscall(void) | 220 | static inline bool in_32bit_syscall(void) |
221 | { | 221 | { |
222 | return in_ia32_syscall() || in_x32_syscall(); | 222 | return in_ia32_syscall() || in_x32_syscall(); |
223 | } | 223 | } |
224 | |||
225 | #ifdef CONFIG_COMPAT | ||
226 | static inline bool in_compat_syscall(void) | ||
227 | { | ||
228 | return in_32bit_syscall(); | ||
229 | } | ||
224 | #define in_compat_syscall in_compat_syscall /* override the generic impl */ | 230 | #define in_compat_syscall in_compat_syscall /* override the generic impl */ |
231 | #endif | ||
225 | 232 | ||
226 | struct compat_siginfo; | 233 | struct compat_siginfo; |
227 | int __copy_siginfo_to_user32(struct compat_siginfo __user *to, | 234 | int __copy_siginfo_to_user32(struct compat_siginfo __user *to, |
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 89a048c2faec..28c4a502b419 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h | |||
@@ -331,6 +331,8 @@ | |||
331 | #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ | 331 | #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ |
332 | #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ | 332 | #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ |
333 | #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ | 333 | #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ |
334 | #define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */ | ||
335 | #define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */ | ||
334 | 336 | ||
335 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ | 337 | /* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */ |
336 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ | 338 | #define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */ |
diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index c18ed65287d5..cf350639e76d 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h | |||
@@ -76,9 +76,7 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name | |||
76 | #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 | 76 | #define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1 |
77 | static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) | 77 | static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) |
78 | { | 78 | { |
79 | if (in_compat_syscall()) | 79 | return in_32bit_syscall(); |
80 | return true; | ||
81 | return false; | ||
82 | } | 80 | } |
83 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ | 81 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ |
84 | #endif /* !COMPILE_OFFSETS */ | 82 | #endif /* !COMPILE_OFFSETS */ |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index fba54ca23b2a..26942ad63830 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
@@ -361,7 +361,6 @@ extern struct paravirt_patch_template pv_ops; | |||
361 | __visible extern const char start_##ops##_##name[], end_##ops##_##name[]; \ | 361 | __visible extern const char start_##ops##_##name[], end_##ops##_##name[]; \ |
362 | asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name)) | 362 | asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name)) |
363 | 363 | ||
364 | unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len); | ||
365 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len); | 364 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len); |
366 | unsigned paravirt_patch_default(u8 type, void *insnbuf, | 365 | unsigned paravirt_patch_default(u8 type, void *insnbuf, |
367 | unsigned long addr, unsigned len); | 366 | unsigned long addr, unsigned len); |
@@ -651,7 +650,6 @@ void paravirt_leave_lazy_mmu(void); | |||
651 | void paravirt_flush_lazy_mmu(void); | 650 | void paravirt_flush_lazy_mmu(void); |
652 | 651 | ||
653 | void _paravirt_nop(void); | 652 | void _paravirt_nop(void); |
654 | u32 _paravirt_ident_32(u32); | ||
655 | u64 _paravirt_ident_64(u64); | 653 | u64 _paravirt_ident_64(u64); |
656 | 654 | ||
657 | #define paravirt_nop ((void *)_paravirt_nop) | 655 | #define paravirt_nop ((void *)_paravirt_nop) |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 323a313947e0..d760611cfc35 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -453,6 +453,12 @@ static inline void __native_flush_tlb_one_user(unsigned long addr) | |||
453 | */ | 453 | */ |
454 | static inline void __flush_tlb_all(void) | 454 | static inline void __flush_tlb_all(void) |
455 | { | 455 | { |
456 | /* | ||
457 | * This is to catch users with enabled preemption and the PGE feature | ||
458 | * and don't trigger the warning in __native_flush_tlb(). | ||
459 | */ | ||
460 | VM_WARN_ON_ONCE(preemptible()); | ||
461 | |||
456 | if (boot_cpu_has(X86_FEATURE_PGE)) { | 462 | if (boot_cpu_has(X86_FEATURE_PGE)) { |
457 | __flush_tlb_global(); | 463 | __flush_tlb_global(); |
458 | } else { | 464 | } else { |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index cbbd57ae06ee..ffb181f959d2 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1074,7 +1074,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) | |||
1074 | #endif | 1074 | #endif |
1075 | c->x86_cache_alignment = c->x86_clflush_size; | 1075 | c->x86_cache_alignment = c->x86_clflush_size; |
1076 | 1076 | ||
1077 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 1077 | memset(&c->x86_capability, 0, sizeof(c->x86_capability)); |
1078 | c->extended_cpuid_level = 0; | 1078 | c->extended_cpuid_level = 0; |
1079 | 1079 | ||
1080 | if (!have_cpuid_p()) | 1080 | if (!have_cpuid_p()) |
@@ -1317,7 +1317,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) | |||
1317 | c->x86_virt_bits = 32; | 1317 | c->x86_virt_bits = 32; |
1318 | #endif | 1318 | #endif |
1319 | c->x86_cache_alignment = c->x86_clflush_size; | 1319 | c->x86_cache_alignment = c->x86_clflush_size; |
1320 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 1320 | memset(&c->x86_capability, 0, sizeof(c->x86_capability)); |
1321 | 1321 | ||
1322 | generic_identify(c); | 1322 | generic_identify(c); |
1323 | 1323 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 8cb3c02980cf..8c66d2fc8f81 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -2215,7 +2215,7 @@ static int mce_device_create(unsigned int cpu) | |||
2215 | if (dev) | 2215 | if (dev) |
2216 | return 0; | 2216 | return 0; |
2217 | 2217 | ||
2218 | dev = kzalloc(sizeof *dev, GFP_KERNEL); | 2218 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
2219 | if (!dev) | 2219 | if (!dev) |
2220 | return -ENOMEM; | 2220 | return -ENOMEM; |
2221 | dev->id = cpu; | 2221 | dev->id = cpu; |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index b9bc8a1a584e..2637ff09d6a0 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c | |||
@@ -666,8 +666,8 @@ static ssize_t pf_show(struct device *dev, | |||
666 | } | 666 | } |
667 | 667 | ||
668 | static DEVICE_ATTR_WO(reload); | 668 | static DEVICE_ATTR_WO(reload); |
669 | static DEVICE_ATTR(version, 0400, version_show, NULL); | 669 | static DEVICE_ATTR(version, 0444, version_show, NULL); |
670 | static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL); | 670 | static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL); |
671 | 671 | ||
672 | static struct attribute *mc_default_attrs[] = { | 672 | static struct attribute *mc_default_attrs[] = { |
673 | &dev_attr_version.attr, | 673 | &dev_attr_version.attr, |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index e12ee86906c6..86e277f8daf4 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -798,7 +798,7 @@ static void generic_set_all(void) | |||
798 | local_irq_restore(flags); | 798 | local_irq_restore(flags); |
799 | 799 | ||
800 | /* Use the atomic bitops to update the global mask */ | 800 | /* Use the atomic bitops to update the global mask */ |
801 | for (count = 0; count < sizeof mask * 8; ++count) { | 801 | for (count = 0; count < sizeof(mask) * 8; ++count) { |
802 | if (mask & 0x01) | 802 | if (mask & 0x01) |
803 | set_bit(count, &smp_changes_mask); | 803 | set_bit(count, &smp_changes_mask); |
804 | mask >>= 1; | 804 | mask >>= 1; |
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c index 40eee6cc4124..2e173d47b450 100644 --- a/arch/x86/kernel/cpu/mtrr/if.c +++ b/arch/x86/kernel/cpu/mtrr/if.c | |||
@@ -174,12 +174,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) | |||
174 | case MTRRIOC_SET_PAGE_ENTRY: | 174 | case MTRRIOC_SET_PAGE_ENTRY: |
175 | case MTRRIOC_DEL_PAGE_ENTRY: | 175 | case MTRRIOC_DEL_PAGE_ENTRY: |
176 | case MTRRIOC_KILL_PAGE_ENTRY: | 176 | case MTRRIOC_KILL_PAGE_ENTRY: |
177 | if (copy_from_user(&sentry, arg, sizeof sentry)) | 177 | if (copy_from_user(&sentry, arg, sizeof(sentry))) |
178 | return -EFAULT; | 178 | return -EFAULT; |
179 | break; | 179 | break; |
180 | case MTRRIOC_GET_ENTRY: | 180 | case MTRRIOC_GET_ENTRY: |
181 | case MTRRIOC_GET_PAGE_ENTRY: | 181 | case MTRRIOC_GET_PAGE_ENTRY: |
182 | if (copy_from_user(&gentry, arg, sizeof gentry)) | 182 | if (copy_from_user(&gentry, arg, sizeof(gentry))) |
183 | return -EFAULT; | 183 | return -EFAULT; |
184 | break; | 184 | break; |
185 | #ifdef CONFIG_COMPAT | 185 | #ifdef CONFIG_COMPAT |
@@ -332,7 +332,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) | |||
332 | switch (cmd) { | 332 | switch (cmd) { |
333 | case MTRRIOC_GET_ENTRY: | 333 | case MTRRIOC_GET_ENTRY: |
334 | case MTRRIOC_GET_PAGE_ENTRY: | 334 | case MTRRIOC_GET_PAGE_ENTRY: |
335 | if (copy_to_user(arg, &gentry, sizeof gentry)) | 335 | if (copy_to_user(arg, &gentry, sizeof(gentry))) |
336 | err = -EFAULT; | 336 | err = -EFAULT; |
337 | break; | 337 | break; |
338 | #ifdef CONFIG_COMPAT | 338 | #ifdef CONFIG_COMPAT |
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index 5e801c8c8ce7..374a52fa5296 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c | |||
@@ -213,8 +213,9 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset) | |||
213 | * early_pci_serial_init() | 213 | * early_pci_serial_init() |
214 | * | 214 | * |
215 | * This function is invoked when the early_printk param starts with "pciserial" | 215 | * This function is invoked when the early_printk param starts with "pciserial" |
216 | * The rest of the param should be ",B:D.F,baud" where B, D & F describe the | 216 | * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe |
217 | * location of a PCI device that must be a UART device. | 217 | * the location of a PCI device that must be a UART device. "force" is optional |
218 | * and overrides the use of an UART device with a wrong PCI class code. | ||
218 | */ | 219 | */ |
219 | static __init void early_pci_serial_init(char *s) | 220 | static __init void early_pci_serial_init(char *s) |
220 | { | 221 | { |
@@ -224,17 +225,23 @@ static __init void early_pci_serial_init(char *s) | |||
224 | u32 classcode, bar0; | 225 | u32 classcode, bar0; |
225 | u16 cmdreg; | 226 | u16 cmdreg; |
226 | char *e; | 227 | char *e; |
228 | int force = 0; | ||
227 | 229 | ||
228 | |||
229 | /* | ||
230 | * First, part the param to get the BDF values | ||
231 | */ | ||
232 | if (*s == ',') | 230 | if (*s == ',') |
233 | ++s; | 231 | ++s; |
234 | 232 | ||
235 | if (*s == 0) | 233 | if (*s == 0) |
236 | return; | 234 | return; |
237 | 235 | ||
236 | /* Force the use of an UART device with wrong class code */ | ||
237 | if (!strncmp(s, "force,", 6)) { | ||
238 | force = 1; | ||
239 | s += 6; | ||
240 | } | ||
241 | |||
242 | /* | ||
243 | * Part the param to get the BDF values | ||
244 | */ | ||
238 | bus = (u8)simple_strtoul(s, &e, 16); | 245 | bus = (u8)simple_strtoul(s, &e, 16); |
239 | s = e; | 246 | s = e; |
240 | if (*s != ':') | 247 | if (*s != ':') |
@@ -253,7 +260,7 @@ static __init void early_pci_serial_init(char *s) | |||
253 | s++; | 260 | s++; |
254 | 261 | ||
255 | /* | 262 | /* |
256 | * Second, find the device from the BDF | 263 | * Find the device from the BDF |
257 | */ | 264 | */ |
258 | cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND); | 265 | cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND); |
259 | classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION); | 266 | classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION); |
@@ -264,8 +271,10 @@ static __init void early_pci_serial_init(char *s) | |||
264 | */ | 271 | */ |
265 | if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && | 272 | if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && |
266 | (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || | 273 | (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || |
267 | (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ | 274 | (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ { |
268 | return; | 275 | if (!force) |
276 | return; | ||
277 | } | ||
269 | 278 | ||
270 | /* | 279 | /* |
271 | * Determine if it is IO or memory mapped | 280 | * Determine if it is IO or memory mapped |
@@ -289,7 +298,7 @@ static __init void early_pci_serial_init(char *s) | |||
289 | } | 298 | } |
290 | 299 | ||
291 | /* | 300 | /* |
292 | * Lastly, initialize the hardware | 301 | * Initialize the hardware |
293 | */ | 302 | */ |
294 | if (*s) { | 303 | if (*s) { |
295 | if (strcmp(s, "nocfg") == 0) | 304 | if (strcmp(s, "nocfg") == 0) |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 5dc377dc9d7b..7663a8eb602b 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -385,7 +385,7 @@ static void __init copy_bootdata(char *real_mode_data) | |||
385 | */ | 385 | */ |
386 | sme_map_bootdata(real_mode_data); | 386 | sme_map_bootdata(real_mode_data); |
387 | 387 | ||
388 | memcpy(&boot_params, real_mode_data, sizeof boot_params); | 388 | memcpy(&boot_params, real_mode_data, sizeof(boot_params)); |
389 | sanitize_boot_params(&boot_params); | 389 | sanitize_boot_params(&boot_params); |
390 | cmd_line_ptr = get_cmd_line_ptr(); | 390 | cmd_line_ptr = get_cmd_line_ptr(); |
391 | if (cmd_line_ptr) { | 391 | if (cmd_line_ptr) { |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index ef688804f80d..4588414e2561 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -115,14 +115,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) | |||
115 | err = -EBADF; | 115 | err = -EBADF; |
116 | break; | 116 | break; |
117 | } | 117 | } |
118 | if (copy_from_user(®s, uregs, sizeof regs)) { | 118 | if (copy_from_user(®s, uregs, sizeof(regs))) { |
119 | err = -EFAULT; | 119 | err = -EFAULT; |
120 | break; | 120 | break; |
121 | } | 121 | } |
122 | err = rdmsr_safe_regs_on_cpu(cpu, regs); | 122 | err = rdmsr_safe_regs_on_cpu(cpu, regs); |
123 | if (err) | 123 | if (err) |
124 | break; | 124 | break; |
125 | if (copy_to_user(uregs, ®s, sizeof regs)) | 125 | if (copy_to_user(uregs, ®s, sizeof(regs))) |
126 | err = -EFAULT; | 126 | err = -EFAULT; |
127 | break; | 127 | break; |
128 | 128 | ||
@@ -131,14 +131,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) | |||
131 | err = -EBADF; | 131 | err = -EBADF; |
132 | break; | 132 | break; |
133 | } | 133 | } |
134 | if (copy_from_user(®s, uregs, sizeof regs)) { | 134 | if (copy_from_user(®s, uregs, sizeof(regs))) { |
135 | err = -EFAULT; | 135 | err = -EFAULT; |
136 | break; | 136 | break; |
137 | } | 137 | } |
138 | err = wrmsr_safe_regs_on_cpu(cpu, regs); | 138 | err = wrmsr_safe_regs_on_cpu(cpu, regs); |
139 | if (err) | 139 | if (err) |
140 | break; | 140 | break; |
141 | if (copy_to_user(uregs, ®s, sizeof regs)) | 141 | if (copy_to_user(uregs, ®s, sizeof(regs))) |
142 | err = -EFAULT; | 142 | err = -EFAULT; |
143 | break; | 143 | break; |
144 | 144 | ||
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index e4d4df37922a..c0e0101133f3 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -56,17 +56,6 @@ asm (".pushsection .entry.text, \"ax\"\n" | |||
56 | ".type _paravirt_nop, @function\n\t" | 56 | ".type _paravirt_nop, @function\n\t" |
57 | ".popsection"); | 57 | ".popsection"); |
58 | 58 | ||
59 | /* identity function, which can be inlined */ | ||
60 | u32 notrace _paravirt_ident_32(u32 x) | ||
61 | { | ||
62 | return x; | ||
63 | } | ||
64 | |||
65 | u64 notrace _paravirt_ident_64(u64 x) | ||
66 | { | ||
67 | return x; | ||
68 | } | ||
69 | |||
70 | void __init default_banner(void) | 59 | void __init default_banner(void) |
71 | { | 60 | { |
72 | printk(KERN_INFO "Booting paravirtualized kernel on %s\n", | 61 | printk(KERN_INFO "Booting paravirtualized kernel on %s\n", |
@@ -102,6 +91,12 @@ static unsigned paravirt_patch_call(void *insnbuf, const void *target, | |||
102 | } | 91 | } |
103 | 92 | ||
104 | #ifdef CONFIG_PARAVIRT_XXL | 93 | #ifdef CONFIG_PARAVIRT_XXL |
94 | /* identity function, which can be inlined */ | ||
95 | u64 notrace _paravirt_ident_64(u64 x) | ||
96 | { | ||
97 | return x; | ||
98 | } | ||
99 | |||
105 | static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, | 100 | static unsigned paravirt_patch_jmp(void *insnbuf, const void *target, |
106 | unsigned long addr, unsigned len) | 101 | unsigned long addr, unsigned len) |
107 | { | 102 | { |
@@ -146,13 +141,11 @@ unsigned paravirt_patch_default(u8 type, void *insnbuf, | |||
146 | else if (opfunc == _paravirt_nop) | 141 | else if (opfunc == _paravirt_nop) |
147 | ret = 0; | 142 | ret = 0; |
148 | 143 | ||
144 | #ifdef CONFIG_PARAVIRT_XXL | ||
149 | /* identity functions just return their single argument */ | 145 | /* identity functions just return their single argument */ |
150 | else if (opfunc == _paravirt_ident_32) | ||
151 | ret = paravirt_patch_ident_32(insnbuf, len); | ||
152 | else if (opfunc == _paravirt_ident_64) | 146 | else if (opfunc == _paravirt_ident_64) |
153 | ret = paravirt_patch_ident_64(insnbuf, len); | 147 | ret = paravirt_patch_ident_64(insnbuf, len); |
154 | 148 | ||
155 | #ifdef CONFIG_PARAVIRT_XXL | ||
156 | else if (type == PARAVIRT_PATCH(cpu.iret) || | 149 | else if (type == PARAVIRT_PATCH(cpu.iret) || |
157 | type == PARAVIRT_PATCH(cpu.usergs_sysret64)) | 150 | type == PARAVIRT_PATCH(cpu.usergs_sysret64)) |
158 | /* If operation requires a jmp, then jmp */ | 151 | /* If operation requires a jmp, then jmp */ |
@@ -309,13 +302,8 @@ struct pv_info pv_info = { | |||
309 | #endif | 302 | #endif |
310 | }; | 303 | }; |
311 | 304 | ||
312 | #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) | ||
313 | /* 32-bit pagetable entries */ | ||
314 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_32) | ||
315 | #else | ||
316 | /* 64-bit pagetable entries */ | 305 | /* 64-bit pagetable entries */ |
317 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64) | 306 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64) |
318 | #endif | ||
319 | 307 | ||
320 | struct paravirt_patch_template pv_ops = { | 308 | struct paravirt_patch_template pv_ops = { |
321 | /* Init ops. */ | 309 | /* Init ops. */ |
@@ -483,5 +471,5 @@ NOKPROBE_SYMBOL(native_set_debugreg); | |||
483 | NOKPROBE_SYMBOL(native_load_idt); | 471 | NOKPROBE_SYMBOL(native_load_idt); |
484 | #endif | 472 | #endif |
485 | 473 | ||
486 | EXPORT_SYMBOL_GPL(pv_ops); | 474 | EXPORT_SYMBOL(pv_ops); |
487 | EXPORT_SYMBOL_GPL(pv_info); | 475 | EXPORT_SYMBOL_GPL(pv_info); |
diff --git a/arch/x86/kernel/paravirt_patch_32.c b/arch/x86/kernel/paravirt_patch_32.c index 6368c22fa1fa..de138d3912e4 100644 --- a/arch/x86/kernel/paravirt_patch_32.c +++ b/arch/x86/kernel/paravirt_patch_32.c | |||
@@ -10,24 +10,18 @@ DEF_NATIVE(cpu, iret, "iret"); | |||
10 | DEF_NATIVE(mmu, read_cr2, "mov %cr2, %eax"); | 10 | DEF_NATIVE(mmu, read_cr2, "mov %cr2, %eax"); |
11 | DEF_NATIVE(mmu, write_cr3, "mov %eax, %cr3"); | 11 | DEF_NATIVE(mmu, write_cr3, "mov %eax, %cr3"); |
12 | DEF_NATIVE(mmu, read_cr3, "mov %cr3, %eax"); | 12 | DEF_NATIVE(mmu, read_cr3, "mov %cr3, %eax"); |
13 | #endif | ||
14 | |||
15 | #if defined(CONFIG_PARAVIRT_SPINLOCKS) | ||
16 | DEF_NATIVE(lock, queued_spin_unlock, "movb $0, (%eax)"); | ||
17 | DEF_NATIVE(lock, vcpu_is_preempted, "xor %eax, %eax"); | ||
18 | #endif | ||
19 | |||
20 | unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len) | ||
21 | { | ||
22 | /* arg in %eax, return in %eax */ | ||
23 | return 0; | ||
24 | } | ||
25 | 13 | ||
26 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len) | 14 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len) |
27 | { | 15 | { |
28 | /* arg in %edx:%eax, return in %edx:%eax */ | 16 | /* arg in %edx:%eax, return in %edx:%eax */ |
29 | return 0; | 17 | return 0; |
30 | } | 18 | } |
19 | #endif | ||
20 | |||
21 | #if defined(CONFIG_PARAVIRT_SPINLOCKS) | ||
22 | DEF_NATIVE(lock, queued_spin_unlock, "movb $0, (%eax)"); | ||
23 | DEF_NATIVE(lock, vcpu_is_preempted, "xor %eax, %eax"); | ||
24 | #endif | ||
31 | 25 | ||
32 | extern bool pv_is_native_spin_unlock(void); | 26 | extern bool pv_is_native_spin_unlock(void); |
33 | extern bool pv_is_native_vcpu_is_preempted(void); | 27 | extern bool pv_is_native_vcpu_is_preempted(void); |
diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c index 7ca9cb726f4d..9d9e04b31077 100644 --- a/arch/x86/kernel/paravirt_patch_64.c +++ b/arch/x86/kernel/paravirt_patch_64.c | |||
@@ -15,27 +15,19 @@ DEF_NATIVE(cpu, wbinvd, "wbinvd"); | |||
15 | 15 | ||
16 | DEF_NATIVE(cpu, usergs_sysret64, "swapgs; sysretq"); | 16 | DEF_NATIVE(cpu, usergs_sysret64, "swapgs; sysretq"); |
17 | DEF_NATIVE(cpu, swapgs, "swapgs"); | 17 | DEF_NATIVE(cpu, swapgs, "swapgs"); |
18 | #endif | ||
19 | |||
20 | DEF_NATIVE(, mov32, "mov %edi, %eax"); | ||
21 | DEF_NATIVE(, mov64, "mov %rdi, %rax"); | 18 | DEF_NATIVE(, mov64, "mov %rdi, %rax"); |
22 | 19 | ||
23 | #if defined(CONFIG_PARAVIRT_SPINLOCKS) | ||
24 | DEF_NATIVE(lock, queued_spin_unlock, "movb $0, (%rdi)"); | ||
25 | DEF_NATIVE(lock, vcpu_is_preempted, "xor %eax, %eax"); | ||
26 | #endif | ||
27 | |||
28 | unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len) | ||
29 | { | ||
30 | return paravirt_patch_insns(insnbuf, len, | ||
31 | start__mov32, end__mov32); | ||
32 | } | ||
33 | |||
34 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len) | 20 | unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len) |
35 | { | 21 | { |
36 | return paravirt_patch_insns(insnbuf, len, | 22 | return paravirt_patch_insns(insnbuf, len, |
37 | start__mov64, end__mov64); | 23 | start__mov64, end__mov64); |
38 | } | 24 | } |
25 | #endif | ||
26 | |||
27 | #if defined(CONFIG_PARAVIRT_SPINLOCKS) | ||
28 | DEF_NATIVE(lock, queued_spin_unlock, "movb $0, (%rdi)"); | ||
29 | DEF_NATIVE(lock, vcpu_is_preempted, "xor %eax, %eax"); | ||
30 | #endif | ||
39 | 31 | ||
40 | extern bool pv_is_native_spin_unlock(void); | 32 | extern bool pv_is_native_spin_unlock(void); |
41 | extern bool pv_is_native_vcpu_is_preempted(void); | 33 | extern bool pv_is_native_vcpu_is_preempted(void); |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 31b4755369f0..0e0b4288a4b2 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -701,10 +701,10 @@ static void __set_personality_x32(void) | |||
701 | current->mm->context.ia32_compat = TIF_X32; | 701 | current->mm->context.ia32_compat = TIF_X32; |
702 | current->personality &= ~READ_IMPLIES_EXEC; | 702 | current->personality &= ~READ_IMPLIES_EXEC; |
703 | /* | 703 | /* |
704 | * in_compat_syscall() uses the presence of the x32 syscall bit | 704 | * in_32bit_syscall() uses the presence of the x32 syscall bit |
705 | * flag to determine compat status. The x86 mmap() code relies on | 705 | * flag to determine compat status. The x86 mmap() code relies on |
706 | * the syscall bitness so set x32 syscall bit right here to make | 706 | * the syscall bitness so set x32 syscall bit right here to make |
707 | * in_compat_syscall() work during exec(). | 707 | * in_32bit_syscall() work during exec(). |
708 | * | 708 | * |
709 | * Pretend to come from a x32 execve. | 709 | * Pretend to come from a x32 execve. |
710 | */ | 710 | */ |
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 6a78d4b36a79..f7476ce23b6e 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -105,7 +105,7 @@ out: | |||
105 | static void find_start_end(unsigned long addr, unsigned long flags, | 105 | static void find_start_end(unsigned long addr, unsigned long flags, |
106 | unsigned long *begin, unsigned long *end) | 106 | unsigned long *begin, unsigned long *end) |
107 | { | 107 | { |
108 | if (!in_compat_syscall() && (flags & MAP_32BIT)) { | 108 | if (!in_32bit_syscall() && (flags & MAP_32BIT)) { |
109 | /* This is usually used needed to map code in small | 109 | /* This is usually used needed to map code in small |
110 | model, so it needs to be in the first 31bit. Limit | 110 | model, so it needs to be in the first 31bit. Limit |
111 | it to that. This means we need to move the | 111 | it to that. This means we need to move the |
@@ -122,7 +122,7 @@ static void find_start_end(unsigned long addr, unsigned long flags, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | *begin = get_mmap_base(1); | 124 | *begin = get_mmap_base(1); |
125 | if (in_compat_syscall()) | 125 | if (in_32bit_syscall()) |
126 | *end = task_size_32bit(); | 126 | *end = task_size_32bit(); |
127 | else | 127 | else |
128 | *end = task_size_64bit(addr > DEFAULT_MAP_WINDOW); | 128 | *end = task_size_64bit(addr > DEFAULT_MAP_WINDOW); |
@@ -193,7 +193,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, | |||
193 | return addr; | 193 | return addr; |
194 | 194 | ||
195 | /* for MAP_32BIT mappings we force the legacy mmap base */ | 195 | /* for MAP_32BIT mappings we force the legacy mmap base */ |
196 | if (!in_compat_syscall() && (flags & MAP_32BIT)) | 196 | if (!in_32bit_syscall() && (flags & MAP_32BIT)) |
197 | goto bottomup; | 197 | goto bottomup; |
198 | 198 | ||
199 | /* requesting a specific address */ | 199 | /* requesting a specific address */ |
@@ -217,9 +217,10 @@ get_unmapped_area: | |||
217 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area | 217 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area |
218 | * in the full address space. | 218 | * in the full address space. |
219 | * | 219 | * |
220 | * !in_compat_syscall() check to avoid high addresses for x32. | 220 | * !in_32bit_syscall() check to avoid high addresses for x32 |
221 | * (and make it no op on native i386). | ||
221 | */ | 222 | */ |
222 | if (addr > DEFAULT_MAP_WINDOW && !in_compat_syscall()) | 223 | if (addr > DEFAULT_MAP_WINDOW && !in_32bit_syscall()) |
223 | info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW; | 224 | info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW; |
224 | 225 | ||
225 | info.align_mask = 0; | 226 | info.align_mask = 0; |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 8f6dcd88202e..9b7c4ca8f0a7 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -306,7 +306,7 @@ __visible void __noreturn handle_stack_overflow(const char *message, | |||
306 | die(message, regs, 0); | 306 | die(message, regs, 0); |
307 | 307 | ||
308 | /* Be absolutely certain we don't return. */ | 308 | /* Be absolutely certain we don't return. */ |
309 | panic(message); | 309 | panic("%s", message); |
310 | } | 310 | } |
311 | #endif | 311 | #endif |
312 | 312 | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 34edf198708f..78e430f4e15c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1509,7 +1509,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, | |||
1509 | return emulate_gp(ctxt, index << 3 | 0x2); | 1509 | return emulate_gp(ctxt, index << 3 | 0x2); |
1510 | 1510 | ||
1511 | addr = dt.address + index * 8; | 1511 | addr = dt.address + index * 8; |
1512 | return linear_read_system(ctxt, addr, desc, sizeof *desc); | 1512 | return linear_read_system(ctxt, addr, desc, sizeof(*desc)); |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, | 1515 | static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, |
@@ -1522,7 +1522,7 @@ static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, | |||
1522 | struct desc_struct desc; | 1522 | struct desc_struct desc; |
1523 | u16 sel; | 1523 | u16 sel; |
1524 | 1524 | ||
1525 | memset (dt, 0, sizeof *dt); | 1525 | memset(dt, 0, sizeof(*dt)); |
1526 | if (!ops->get_segment(ctxt, &sel, &desc, &base3, | 1526 | if (!ops->get_segment(ctxt, &sel, &desc, &base3, |
1527 | VCPU_SREG_LDTR)) | 1527 | VCPU_SREG_LDTR)) |
1528 | return; | 1528 | return; |
@@ -1586,7 +1586,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt, | |||
1586 | if (rc != X86EMUL_CONTINUE) | 1586 | if (rc != X86EMUL_CONTINUE) |
1587 | return rc; | 1587 | return rc; |
1588 | 1588 | ||
1589 | return linear_write_system(ctxt, addr, desc, sizeof *desc); | 1589 | return linear_write_system(ctxt, addr, desc, sizeof(*desc)); |
1590 | } | 1590 | } |
1591 | 1591 | ||
1592 | static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, | 1592 | static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, |
@@ -1604,7 +1604,7 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, | |||
1604 | u16 dummy; | 1604 | u16 dummy; |
1605 | u32 base3 = 0; | 1605 | u32 base3 = 0; |
1606 | 1606 | ||
1607 | memset(&seg_desc, 0, sizeof seg_desc); | 1607 | memset(&seg_desc, 0, sizeof(seg_desc)); |
1608 | 1608 | ||
1609 | if (ctxt->mode == X86EMUL_MODE_REAL) { | 1609 | if (ctxt->mode == X86EMUL_MODE_REAL) { |
1610 | /* set real mode segment descriptor (keep limit etc. for | 1610 | /* set real mode segment descriptor (keep limit etc. for |
@@ -3075,17 +3075,17 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt, | |||
3075 | int ret; | 3075 | int ret; |
3076 | u32 new_tss_base = get_desc_base(new_desc); | 3076 | u32 new_tss_base = get_desc_base(new_desc); |
3077 | 3077 | ||
3078 | ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg); | 3078 | ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg)); |
3079 | if (ret != X86EMUL_CONTINUE) | 3079 | if (ret != X86EMUL_CONTINUE) |
3080 | return ret; | 3080 | return ret; |
3081 | 3081 | ||
3082 | save_state_to_tss16(ctxt, &tss_seg); | 3082 | save_state_to_tss16(ctxt, &tss_seg); |
3083 | 3083 | ||
3084 | ret = linear_write_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg); | 3084 | ret = linear_write_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg)); |
3085 | if (ret != X86EMUL_CONTINUE) | 3085 | if (ret != X86EMUL_CONTINUE) |
3086 | return ret; | 3086 | return ret; |
3087 | 3087 | ||
3088 | ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof tss_seg); | 3088 | ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof(tss_seg)); |
3089 | if (ret != X86EMUL_CONTINUE) | 3089 | if (ret != X86EMUL_CONTINUE) |
3090 | return ret; | 3090 | return ret; |
3091 | 3091 | ||
@@ -3094,7 +3094,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt, | |||
3094 | 3094 | ||
3095 | ret = linear_write_system(ctxt, new_tss_base, | 3095 | ret = linear_write_system(ctxt, new_tss_base, |
3096 | &tss_seg.prev_task_link, | 3096 | &tss_seg.prev_task_link, |
3097 | sizeof tss_seg.prev_task_link); | 3097 | sizeof(tss_seg.prev_task_link)); |
3098 | if (ret != X86EMUL_CONTINUE) | 3098 | if (ret != X86EMUL_CONTINUE) |
3099 | return ret; | 3099 | return ret; |
3100 | } | 3100 | } |
@@ -3216,7 +3216,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, | |||
3216 | u32 eip_offset = offsetof(struct tss_segment_32, eip); | 3216 | u32 eip_offset = offsetof(struct tss_segment_32, eip); |
3217 | u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector); | 3217 | u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector); |
3218 | 3218 | ||
3219 | ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg); | 3219 | ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg)); |
3220 | if (ret != X86EMUL_CONTINUE) | 3220 | if (ret != X86EMUL_CONTINUE) |
3221 | return ret; | 3221 | return ret; |
3222 | 3222 | ||
@@ -3228,7 +3228,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, | |||
3228 | if (ret != X86EMUL_CONTINUE) | 3228 | if (ret != X86EMUL_CONTINUE) |
3229 | return ret; | 3229 | return ret; |
3230 | 3230 | ||
3231 | ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof tss_seg); | 3231 | ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof(tss_seg)); |
3232 | if (ret != X86EMUL_CONTINUE) | 3232 | if (ret != X86EMUL_CONTINUE) |
3233 | return ret; | 3233 | return ret; |
3234 | 3234 | ||
@@ -3237,7 +3237,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, | |||
3237 | 3237 | ||
3238 | ret = linear_write_system(ctxt, new_tss_base, | 3238 | ret = linear_write_system(ctxt, new_tss_base, |
3239 | &tss_seg.prev_task_link, | 3239 | &tss_seg.prev_task_link, |
3240 | sizeof tss_seg.prev_task_link); | 3240 | sizeof(tss_seg.prev_task_link)); |
3241 | if (ret != X86EMUL_CONTINUE) | 3241 | if (ret != X86EMUL_CONTINUE) |
3242 | return ret; | 3242 | return ret; |
3243 | } | 3243 | } |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 3cd227ff807f..89db20f8cb70 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -2409,7 +2409,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) | |||
2409 | r = kvm_apic_state_fixup(vcpu, s, true); | 2409 | r = kvm_apic_state_fixup(vcpu, s, true); |
2410 | if (r) | 2410 | if (r) |
2411 | return r; | 2411 | return r; |
2412 | memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s); | 2412 | memcpy(vcpu->arch.apic->regs, s->regs, sizeof(*s)); |
2413 | 2413 | ||
2414 | recalculate_apic_map(vcpu->kvm); | 2414 | recalculate_apic_map(vcpu->kvm); |
2415 | kvm_apic_set_version(vcpu); | 2415 | kvm_apic_set_version(vcpu); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 66d66d77caee..5cd5647120f2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2924,7 +2924,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs, | |||
2924 | unsigned size; | 2924 | unsigned size; |
2925 | 2925 | ||
2926 | r = -EFAULT; | 2926 | r = -EFAULT; |
2927 | if (copy_from_user(&msrs, user_msrs, sizeof msrs)) | 2927 | if (copy_from_user(&msrs, user_msrs, sizeof(msrs))) |
2928 | goto out; | 2928 | goto out; |
2929 | 2929 | ||
2930 | r = -E2BIG; | 2930 | r = -E2BIG; |
@@ -3091,11 +3091,11 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
3091 | unsigned n; | 3091 | unsigned n; |
3092 | 3092 | ||
3093 | r = -EFAULT; | 3093 | r = -EFAULT; |
3094 | if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list)) | 3094 | if (copy_from_user(&msr_list, user_msr_list, sizeof(msr_list))) |
3095 | goto out; | 3095 | goto out; |
3096 | n = msr_list.nmsrs; | 3096 | n = msr_list.nmsrs; |
3097 | msr_list.nmsrs = num_msrs_to_save + num_emulated_msrs; | 3097 | msr_list.nmsrs = num_msrs_to_save + num_emulated_msrs; |
3098 | if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list)) | 3098 | if (copy_to_user(user_msr_list, &msr_list, sizeof(msr_list))) |
3099 | goto out; | 3099 | goto out; |
3100 | r = -E2BIG; | 3100 | r = -E2BIG; |
3101 | if (n < msr_list.nmsrs) | 3101 | if (n < msr_list.nmsrs) |
@@ -3117,7 +3117,7 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
3117 | struct kvm_cpuid2 cpuid; | 3117 | struct kvm_cpuid2 cpuid; |
3118 | 3118 | ||
3119 | r = -EFAULT; | 3119 | r = -EFAULT; |
3120 | if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) | 3120 | if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) |
3121 | goto out; | 3121 | goto out; |
3122 | 3122 | ||
3123 | r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries, | 3123 | r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries, |
@@ -3126,7 +3126,7 @@ long kvm_arch_dev_ioctl(struct file *filp, | |||
3126 | goto out; | 3126 | goto out; |
3127 | 3127 | ||
3128 | r = -EFAULT; | 3128 | r = -EFAULT; |
3129 | if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid)) | 3129 | if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid))) |
3130 | goto out; | 3130 | goto out; |
3131 | r = 0; | 3131 | r = 0; |
3132 | break; | 3132 | break; |
@@ -3894,7 +3894,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3894 | struct kvm_interrupt irq; | 3894 | struct kvm_interrupt irq; |
3895 | 3895 | ||
3896 | r = -EFAULT; | 3896 | r = -EFAULT; |
3897 | if (copy_from_user(&irq, argp, sizeof irq)) | 3897 | if (copy_from_user(&irq, argp, sizeof(irq))) |
3898 | goto out; | 3898 | goto out; |
3899 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); | 3899 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); |
3900 | break; | 3900 | break; |
@@ -3912,7 +3912,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3912 | struct kvm_cpuid cpuid; | 3912 | struct kvm_cpuid cpuid; |
3913 | 3913 | ||
3914 | r = -EFAULT; | 3914 | r = -EFAULT; |
3915 | if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) | 3915 | if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) |
3916 | goto out; | 3916 | goto out; |
3917 | r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); | 3917 | r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); |
3918 | break; | 3918 | break; |
@@ -3922,7 +3922,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3922 | struct kvm_cpuid2 cpuid; | 3922 | struct kvm_cpuid2 cpuid; |
3923 | 3923 | ||
3924 | r = -EFAULT; | 3924 | r = -EFAULT; |
3925 | if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) | 3925 | if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) |
3926 | goto out; | 3926 | goto out; |
3927 | r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, | 3927 | r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, |
3928 | cpuid_arg->entries); | 3928 | cpuid_arg->entries); |
@@ -3933,14 +3933,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3933 | struct kvm_cpuid2 cpuid; | 3933 | struct kvm_cpuid2 cpuid; |
3934 | 3934 | ||
3935 | r = -EFAULT; | 3935 | r = -EFAULT; |
3936 | if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) | 3936 | if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid))) |
3937 | goto out; | 3937 | goto out; |
3938 | r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid, | 3938 | r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid, |
3939 | cpuid_arg->entries); | 3939 | cpuid_arg->entries); |
3940 | if (r) | 3940 | if (r) |
3941 | goto out; | 3941 | goto out; |
3942 | r = -EFAULT; | 3942 | r = -EFAULT; |
3943 | if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid)) | 3943 | if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid))) |
3944 | goto out; | 3944 | goto out; |
3945 | r = 0; | 3945 | r = 0; |
3946 | break; | 3946 | break; |
@@ -3961,13 +3961,13 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3961 | struct kvm_tpr_access_ctl tac; | 3961 | struct kvm_tpr_access_ctl tac; |
3962 | 3962 | ||
3963 | r = -EFAULT; | 3963 | r = -EFAULT; |
3964 | if (copy_from_user(&tac, argp, sizeof tac)) | 3964 | if (copy_from_user(&tac, argp, sizeof(tac))) |
3965 | goto out; | 3965 | goto out; |
3966 | r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac); | 3966 | r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac); |
3967 | if (r) | 3967 | if (r) |
3968 | goto out; | 3968 | goto out; |
3969 | r = -EFAULT; | 3969 | r = -EFAULT; |
3970 | if (copy_to_user(argp, &tac, sizeof tac)) | 3970 | if (copy_to_user(argp, &tac, sizeof(tac))) |
3971 | goto out; | 3971 | goto out; |
3972 | r = 0; | 3972 | r = 0; |
3973 | break; | 3973 | break; |
@@ -3980,7 +3980,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3980 | if (!lapic_in_kernel(vcpu)) | 3980 | if (!lapic_in_kernel(vcpu)) |
3981 | goto out; | 3981 | goto out; |
3982 | r = -EFAULT; | 3982 | r = -EFAULT; |
3983 | if (copy_from_user(&va, argp, sizeof va)) | 3983 | if (copy_from_user(&va, argp, sizeof(va))) |
3984 | goto out; | 3984 | goto out; |
3985 | idx = srcu_read_lock(&vcpu->kvm->srcu); | 3985 | idx = srcu_read_lock(&vcpu->kvm->srcu); |
3986 | r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); | 3986 | r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); |
@@ -3991,7 +3991,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
3991 | u64 mcg_cap; | 3991 | u64 mcg_cap; |
3992 | 3992 | ||
3993 | r = -EFAULT; | 3993 | r = -EFAULT; |
3994 | if (copy_from_user(&mcg_cap, argp, sizeof mcg_cap)) | 3994 | if (copy_from_user(&mcg_cap, argp, sizeof(mcg_cap))) |
3995 | goto out; | 3995 | goto out; |
3996 | r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap); | 3996 | r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap); |
3997 | break; | 3997 | break; |
@@ -4000,7 +4000,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
4000 | struct kvm_x86_mce mce; | 4000 | struct kvm_x86_mce mce; |
4001 | 4001 | ||
4002 | r = -EFAULT; | 4002 | r = -EFAULT; |
4003 | if (copy_from_user(&mce, argp, sizeof mce)) | 4003 | if (copy_from_user(&mce, argp, sizeof(mce))) |
4004 | goto out; | 4004 | goto out; |
4005 | r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce); | 4005 | r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce); |
4006 | break; | 4006 | break; |
@@ -4536,7 +4536,7 @@ long kvm_arch_vm_ioctl(struct file *filp, | |||
4536 | if (kvm->created_vcpus) | 4536 | if (kvm->created_vcpus) |
4537 | goto set_identity_unlock; | 4537 | goto set_identity_unlock; |
4538 | r = -EFAULT; | 4538 | r = -EFAULT; |
4539 | if (copy_from_user(&ident_addr, argp, sizeof ident_addr)) | 4539 | if (copy_from_user(&ident_addr, argp, sizeof(ident_addr))) |
4540 | goto set_identity_unlock; | 4540 | goto set_identity_unlock; |
4541 | r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); | 4541 | r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); |
4542 | set_identity_unlock: | 4542 | set_identity_unlock: |
@@ -4620,7 +4620,7 @@ set_identity_unlock: | |||
4620 | if (r) | 4620 | if (r) |
4621 | goto get_irqchip_out; | 4621 | goto get_irqchip_out; |
4622 | r = -EFAULT; | 4622 | r = -EFAULT; |
4623 | if (copy_to_user(argp, chip, sizeof *chip)) | 4623 | if (copy_to_user(argp, chip, sizeof(*chip))) |
4624 | goto get_irqchip_out; | 4624 | goto get_irqchip_out; |
4625 | r = 0; | 4625 | r = 0; |
4626 | get_irqchip_out: | 4626 | get_irqchip_out: |
@@ -4666,7 +4666,7 @@ set_identity_unlock: | |||
4666 | } | 4666 | } |
4667 | case KVM_SET_PIT: { | 4667 | case KVM_SET_PIT: { |
4668 | r = -EFAULT; | 4668 | r = -EFAULT; |
4669 | if (copy_from_user(&u.ps, argp, sizeof u.ps)) | 4669 | if (copy_from_user(&u.ps, argp, sizeof(u.ps))) |
4670 | goto out; | 4670 | goto out; |
4671 | r = -ENXIO; | 4671 | r = -ENXIO; |
4672 | if (!kvm->arch.vpit) | 4672 | if (!kvm->arch.vpit) |
@@ -8205,7 +8205,7 @@ static void __get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) | |||
8205 | sregs->efer = vcpu->arch.efer; | 8205 | sregs->efer = vcpu->arch.efer; |
8206 | sregs->apic_base = kvm_get_apic_base(vcpu); | 8206 | sregs->apic_base = kvm_get_apic_base(vcpu); |
8207 | 8207 | ||
8208 | memset(sregs->interrupt_bitmap, 0, sizeof sregs->interrupt_bitmap); | 8208 | memset(sregs->interrupt_bitmap, 0, sizeof(sregs->interrupt_bitmap)); |
8209 | 8209 | ||
8210 | if (vcpu->arch.interrupt.injected && !vcpu->arch.interrupt.soft) | 8210 | if (vcpu->arch.interrupt.injected && !vcpu->arch.interrupt.soft) |
8211 | set_bit(vcpu->arch.interrupt.nr, | 8211 | set_bit(vcpu->arch.interrupt.nr, |
@@ -8509,7 +8509,7 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
8509 | fpu->last_opcode = fxsave->fop; | 8509 | fpu->last_opcode = fxsave->fop; |
8510 | fpu->last_ip = fxsave->rip; | 8510 | fpu->last_ip = fxsave->rip; |
8511 | fpu->last_dp = fxsave->rdp; | 8511 | fpu->last_dp = fxsave->rdp; |
8512 | memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space); | 8512 | memcpy(fpu->xmm, fxsave->xmm_space, sizeof(fxsave->xmm_space)); |
8513 | 8513 | ||
8514 | vcpu_put(vcpu); | 8514 | vcpu_put(vcpu); |
8515 | return 0; | 8515 | return 0; |
@@ -8530,7 +8530,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
8530 | fxsave->fop = fpu->last_opcode; | 8530 | fxsave->fop = fpu->last_opcode; |
8531 | fxsave->rip = fpu->last_ip; | 8531 | fxsave->rip = fpu->last_ip; |
8532 | fxsave->rdp = fpu->last_dp; | 8532 | fxsave->rdp = fpu->last_dp; |
8533 | memcpy(fxsave->xmm_space, fpu->xmm, sizeof fxsave->xmm_space); | 8533 | memcpy(fxsave->xmm_space, fpu->xmm, sizeof(fxsave->xmm_space)); |
8534 | 8534 | ||
8535 | vcpu_put(vcpu); | 8535 | vcpu_put(vcpu); |
8536 | return 0; | 8536 | return 0; |
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c index 00b296617ca4..92e4c4b85bba 100644 --- a/arch/x86/mm/hugetlbpage.c +++ b/arch/x86/mm/hugetlbpage.c | |||
@@ -92,7 +92,7 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file, | |||
92 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area | 92 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area |
93 | * in the full address space. | 93 | * in the full address space. |
94 | */ | 94 | */ |
95 | info.high_limit = in_compat_syscall() ? | 95 | info.high_limit = in_32bit_syscall() ? |
96 | task_size_32bit() : task_size_64bit(addr > DEFAULT_MAP_WINDOW); | 96 | task_size_32bit() : task_size_64bit(addr > DEFAULT_MAP_WINDOW); |
97 | 97 | ||
98 | info.align_mask = PAGE_MASK & ~huge_page_mask(h); | 98 | info.align_mask = PAGE_MASK & ~huge_page_mask(h); |
@@ -116,7 +116,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file, | |||
116 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area | 116 | * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area |
117 | * in the full address space. | 117 | * in the full address space. |
118 | */ | 118 | */ |
119 | if (addr > DEFAULT_MAP_WINDOW && !in_compat_syscall()) | 119 | if (addr > DEFAULT_MAP_WINDOW && !in_32bit_syscall()) |
120 | info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW; | 120 | info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW; |
121 | 121 | ||
122 | info.align_mask = PAGE_MASK & ~huge_page_mask(h); | 122 | info.align_mask = PAGE_MASK & ~huge_page_mask(h); |
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index 1e95d57760cf..db3165714521 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c | |||
@@ -166,7 +166,7 @@ unsigned long get_mmap_base(int is_legacy) | |||
166 | struct mm_struct *mm = current->mm; | 166 | struct mm_struct *mm = current->mm; |
167 | 167 | ||
168 | #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES | 168 | #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES |
169 | if (in_compat_syscall()) { | 169 | if (in_32bit_syscall()) { |
170 | return is_legacy ? mm->mmap_compat_legacy_base | 170 | return is_legacy ? mm->mmap_compat_legacy_base |
171 | : mm->mmap_compat_base; | 171 | : mm->mmap_compat_base; |
172 | } | 172 | } |
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c index a80fdd7fb40f..abffa0be80da 100644 --- a/arch/x86/mm/numa_emulation.c +++ b/arch/x86/mm/numa_emulation.c | |||
@@ -399,9 +399,17 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) | |||
399 | n = simple_strtoul(emu_cmdline, &emu_cmdline, 0); | 399 | n = simple_strtoul(emu_cmdline, &emu_cmdline, 0); |
400 | ret = -1; | 400 | ret = -1; |
401 | for_each_node_mask(i, physnode_mask) { | 401 | for_each_node_mask(i, physnode_mask) { |
402 | /* | ||
403 | * The reason we pass in blk[0] is due to | ||
404 | * numa_remove_memblk_from() called by | ||
405 | * emu_setup_memblk() will delete entry 0 | ||
406 | * and then move everything else up in the pi.blk | ||
407 | * array. Therefore we should always be looking | ||
408 | * at blk[0]. | ||
409 | */ | ||
402 | ret = split_nodes_size_interleave_uniform(&ei, &pi, | 410 | ret = split_nodes_size_interleave_uniform(&ei, &pi, |
403 | pi.blk[i].start, pi.blk[i].end, 0, | 411 | pi.blk[0].start, pi.blk[0].end, 0, |
404 | n, &pi.blk[i], nid); | 412 | n, &pi.blk[0], nid); |
405 | if (ret < 0) | 413 | if (ret < 0) |
406 | break; | 414 | break; |
407 | if (ret < n) { | 415 | if (ret < n) { |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index f799076e3d57..db7a10082238 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -2309,9 +2309,13 @@ void __kernel_map_pages(struct page *page, int numpages, int enable) | |||
2309 | 2309 | ||
2310 | /* | 2310 | /* |
2311 | * We should perform an IPI and flush all tlbs, | 2311 | * We should perform an IPI and flush all tlbs, |
2312 | * but that can deadlock->flush only current cpu: | 2312 | * but that can deadlock->flush only current cpu. |
2313 | * Preemption needs to be disabled around __flush_tlb_all() due to | ||
2314 | * CR3 reload in __native_flush_tlb(). | ||
2313 | */ | 2315 | */ |
2316 | preempt_disable(); | ||
2314 | __flush_tlb_all(); | 2317 | __flush_tlb_all(); |
2318 | preempt_enable(); | ||
2315 | 2319 | ||
2316 | arch_flush_lazy_mmu_mode(); | 2320 | arch_flush_lazy_mmu_mode(); |
2317 | } | 2321 | } |
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index 0b08067c45f3..b629f6992d9f 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c | |||
@@ -130,7 +130,7 @@ static void regex_init(int use_real_mode) | |||
130 | REG_EXTENDED|REG_NOSUB); | 130 | REG_EXTENDED|REG_NOSUB); |
131 | 131 | ||
132 | if (err) { | 132 | if (err) { |
133 | regerror(err, &sym_regex_c[i], errbuf, sizeof errbuf); | 133 | regerror(err, &sym_regex_c[i], errbuf, sizeof(errbuf)); |
134 | die("%s", errbuf); | 134 | die("%s", errbuf); |
135 | } | 135 | } |
136 | } | 136 | } |
@@ -405,7 +405,7 @@ static void read_shdrs(FILE *fp) | |||
405 | } | 405 | } |
406 | for (i = 0; i < ehdr.e_shnum; i++) { | 406 | for (i = 0; i < ehdr.e_shnum; i++) { |
407 | struct section *sec = &secs[i]; | 407 | struct section *sec = &secs[i]; |
408 | if (fread(&shdr, sizeof shdr, 1, fp) != 1) | 408 | if (fread(&shdr, sizeof(shdr), 1, fp) != 1) |
409 | die("Cannot read ELF section headers %d/%d: %s\n", | 409 | die("Cannot read ELF section headers %d/%d: %s\n", |
410 | i, ehdr.e_shnum, strerror(errno)); | 410 | i, ehdr.e_shnum, strerror(errno)); |
411 | sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name); | 411 | sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name); |
diff --git a/arch/x86/um/asm/elf.h b/arch/x86/um/asm/elf.h index 413f3519d9a1..c907b20d4993 100644 --- a/arch/x86/um/asm/elf.h +++ b/arch/x86/um/asm/elf.h | |||
@@ -194,7 +194,7 @@ extern unsigned long um_vdso_addr; | |||
194 | 194 | ||
195 | typedef unsigned long elf_greg_t; | 195 | typedef unsigned long elf_greg_t; |
196 | 196 | ||
197 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | 197 | #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) |
198 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | 198 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
199 | 199 | ||
200 | typedef struct user_i387_struct elf_fpregset_t; | 200 | typedef struct user_i387_struct elf_fpregset_t; |
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c index 3e626fd9bd4e..8061667a6765 100644 --- a/drivers/firmware/efi/efivars.c +++ b/drivers/firmware/efi/efivars.c | |||
@@ -229,14 +229,6 @@ sanity_check(struct efi_variable *var, efi_char16_t *name, efi_guid_t vendor, | |||
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | static inline bool is_compat(void) | ||
233 | { | ||
234 | if (IS_ENABLED(CONFIG_COMPAT) && in_compat_syscall()) | ||
235 | return true; | ||
236 | |||
237 | return false; | ||
238 | } | ||
239 | |||
240 | static void | 232 | static void |
241 | copy_out_compat(struct efi_variable *dst, struct compat_efi_variable *src) | 233 | copy_out_compat(struct efi_variable *dst, struct compat_efi_variable *src) |
242 | { | 234 | { |
@@ -263,7 +255,7 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | |||
263 | u8 *data; | 255 | u8 *data; |
264 | int err; | 256 | int err; |
265 | 257 | ||
266 | if (is_compat()) { | 258 | if (in_compat_syscall()) { |
267 | struct compat_efi_variable *compat; | 259 | struct compat_efi_variable *compat; |
268 | 260 | ||
269 | if (count != sizeof(*compat)) | 261 | if (count != sizeof(*compat)) |
@@ -324,7 +316,7 @@ efivar_show_raw(struct efivar_entry *entry, char *buf) | |||
324 | &entry->var.DataSize, entry->var.Data)) | 316 | &entry->var.DataSize, entry->var.Data)) |
325 | return -EIO; | 317 | return -EIO; |
326 | 318 | ||
327 | if (is_compat()) { | 319 | if (in_compat_syscall()) { |
328 | compat = (struct compat_efi_variable *)buf; | 320 | compat = (struct compat_efi_variable *)buf; |
329 | 321 | ||
330 | size = sizeof(*compat); | 322 | size = sizeof(*compat); |
@@ -418,7 +410,7 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
418 | struct compat_efi_variable *compat = (struct compat_efi_variable *)buf; | 410 | struct compat_efi_variable *compat = (struct compat_efi_variable *)buf; |
419 | struct efi_variable *new_var = (struct efi_variable *)buf; | 411 | struct efi_variable *new_var = (struct efi_variable *)buf; |
420 | struct efivar_entry *new_entry; | 412 | struct efivar_entry *new_entry; |
421 | bool need_compat = is_compat(); | 413 | bool need_compat = in_compat_syscall(); |
422 | efi_char16_t *name; | 414 | efi_char16_t *name; |
423 | unsigned long size; | 415 | unsigned long size; |
424 | u32 attributes; | 416 | u32 attributes; |
@@ -495,7 +487,7 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, | |||
495 | if (!capable(CAP_SYS_ADMIN)) | 487 | if (!capable(CAP_SYS_ADMIN)) |
496 | return -EACCES; | 488 | return -EACCES; |
497 | 489 | ||
498 | if (is_compat()) { | 490 | if (in_compat_syscall()) { |
499 | if (count != sizeof(*compat)) | 491 | if (count != sizeof(*compat)) |
500 | return -EINVAL; | 492 | return -EINVAL; |
501 | 493 | ||
diff --git a/include/linux/compat.h b/include/linux/compat.h index 06e77473f175..88720b443cd6 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -1032,9 +1032,9 @@ int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz, | |||
1032 | #else /* !CONFIG_COMPAT */ | 1032 | #else /* !CONFIG_COMPAT */ |
1033 | 1033 | ||
1034 | #define is_compat_task() (0) | 1034 | #define is_compat_task() (0) |
1035 | #ifndef in_compat_syscall | 1035 | /* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */ |
1036 | #define in_compat_syscall in_compat_syscall | ||
1036 | static inline bool in_compat_syscall(void) { return false; } | 1037 | static inline bool in_compat_syscall(void) { return false; } |
1037 | #endif | ||
1038 | 1038 | ||
1039 | #endif /* CONFIG_COMPAT */ | 1039 | #endif /* CONFIG_COMPAT */ |
1040 | 1040 | ||
diff --git a/kernel/time/time.c b/kernel/time/time.c index e3a7f7fd3abc..ad204cf6d001 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -842,7 +842,7 @@ int get_timespec64(struct timespec64 *ts, | |||
842 | ts->tv_sec = kts.tv_sec; | 842 | ts->tv_sec = kts.tv_sec; |
843 | 843 | ||
844 | /* Zero out the padding for 32 bit systems or in compat mode */ | 844 | /* Zero out the padding for 32 bit systems or in compat mode */ |
845 | if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall())) | 845 | if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall()) |
846 | kts.tv_nsec &= 0xFFFFFFFFUL; | 846 | kts.tv_nsec &= 0xFFFFFFFFUL; |
847 | 847 | ||
848 | ts->tv_nsec = kts.tv_nsec; | 848 | ts->tv_nsec = kts.tv_nsec; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index b669262682c9..dc4a9f1fb941 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -2077,10 +2077,8 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen | |||
2077 | struct xfrm_mgr *km; | 2077 | struct xfrm_mgr *km; |
2078 | struct xfrm_policy *pol = NULL; | 2078 | struct xfrm_policy *pol = NULL; |
2079 | 2079 | ||
2080 | #ifdef CONFIG_COMPAT | ||
2081 | if (in_compat_syscall()) | 2080 | if (in_compat_syscall()) |
2082 | return -EOPNOTSUPP; | 2081 | return -EOPNOTSUPP; |
2083 | #endif | ||
2084 | 2082 | ||
2085 | if (!optval && !optlen) { | 2083 | if (!optval && !optlen) { |
2086 | xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); | 2084 | xfrm_sk_policy_insert(sk, XFRM_POLICY_IN, NULL); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ca7a207b81a9..c9a84e22f5d5 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -2621,10 +2621,8 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2621 | const struct xfrm_link *link; | 2621 | const struct xfrm_link *link; |
2622 | int type, err; | 2622 | int type, err; |
2623 | 2623 | ||
2624 | #ifdef CONFIG_COMPAT | ||
2625 | if (in_compat_syscall()) | 2624 | if (in_compat_syscall()) |
2626 | return -EOPNOTSUPP; | 2625 | return -EOPNOTSUPP; |
2627 | #endif | ||
2628 | 2626 | ||
2629 | type = nlh->nlmsg_type; | 2627 | type = nlh->nlmsg_type; |
2630 | if (type > XFRM_MSG_MAX) | 2628 | if (type > XFRM_MSG_MAX) |
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2928939b98ec..0414a0d52262 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c | |||
@@ -836,7 +836,7 @@ static int add_switch_table(struct objtool_file *file, struct instruction *insn, | |||
836 | struct symbol *pfunc = insn->func->pfunc; | 836 | struct symbol *pfunc = insn->func->pfunc; |
837 | unsigned int prev_offset = 0; | 837 | unsigned int prev_offset = 0; |
838 | 838 | ||
839 | list_for_each_entry_from(rela, &file->rodata->rela->rela_list, list) { | 839 | list_for_each_entry_from(rela, &table->rela_sec->rela_list, list) { |
840 | if (rela == next_table) | 840 | if (rela == next_table) |
841 | break; | 841 | break; |
842 | 842 | ||
@@ -926,6 +926,7 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
926 | { | 926 | { |
927 | struct rela *text_rela, *rodata_rela; | 927 | struct rela *text_rela, *rodata_rela; |
928 | struct instruction *orig_insn = insn; | 928 | struct instruction *orig_insn = insn; |
929 | struct section *rodata_sec; | ||
929 | unsigned long table_offset; | 930 | unsigned long table_offset; |
930 | 931 | ||
931 | /* | 932 | /* |
@@ -953,10 +954,13 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
953 | /* look for a relocation which references .rodata */ | 954 | /* look for a relocation which references .rodata */ |
954 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, | 955 | text_rela = find_rela_by_dest_range(insn->sec, insn->offset, |
955 | insn->len); | 956 | insn->len); |
956 | if (!text_rela || text_rela->sym != file->rodata->sym) | 957 | if (!text_rela || text_rela->sym->type != STT_SECTION || |
958 | !text_rela->sym->sec->rodata) | ||
957 | continue; | 959 | continue; |
958 | 960 | ||
959 | table_offset = text_rela->addend; | 961 | table_offset = text_rela->addend; |
962 | rodata_sec = text_rela->sym->sec; | ||
963 | |||
960 | if (text_rela->type == R_X86_64_PC32) | 964 | if (text_rela->type == R_X86_64_PC32) |
961 | table_offset += 4; | 965 | table_offset += 4; |
962 | 966 | ||
@@ -964,10 +968,10 @@ static struct rela *find_switch_table(struct objtool_file *file, | |||
964 | * Make sure the .rodata address isn't associated with a | 968 | * Make sure the .rodata address isn't associated with a |
965 | * symbol. gcc jump tables are anonymous data. | 969 | * symbol. gcc jump tables are anonymous data. |
966 | */ | 970 | */ |
967 | if (find_symbol_containing(file->rodata, table_offset)) | 971 | if (find_symbol_containing(rodata_sec, table_offset)) |
968 | continue; | 972 | continue; |
969 | 973 | ||
970 | rodata_rela = find_rela_by_dest(file->rodata, table_offset); | 974 | rodata_rela = find_rela_by_dest(rodata_sec, table_offset); |
971 | if (rodata_rela) { | 975 | if (rodata_rela) { |
972 | /* | 976 | /* |
973 | * Use of RIP-relative switch jumps is quite rare, and | 977 | * Use of RIP-relative switch jumps is quite rare, and |
@@ -1052,7 +1056,7 @@ static int add_switch_table_alts(struct objtool_file *file) | |||
1052 | struct symbol *func; | 1056 | struct symbol *func; |
1053 | int ret; | 1057 | int ret; |
1054 | 1058 | ||
1055 | if (!file->rodata || !file->rodata->rela) | 1059 | if (!file->rodata) |
1056 | return 0; | 1060 | return 0; |
1057 | 1061 | ||
1058 | for_each_sec(file, sec) { | 1062 | for_each_sec(file, sec) { |
@@ -1198,10 +1202,33 @@ static int read_retpoline_hints(struct objtool_file *file) | |||
1198 | return 0; | 1202 | return 0; |
1199 | } | 1203 | } |
1200 | 1204 | ||
1205 | static void mark_rodata(struct objtool_file *file) | ||
1206 | { | ||
1207 | struct section *sec; | ||
1208 | bool found = false; | ||
1209 | |||
1210 | /* | ||
1211 | * This searches for the .rodata section or multiple .rodata.func_name | ||
1212 | * sections if -fdata-sections is being used. The .str.1.1 and .str.1.8 | ||
1213 | * rodata sections are ignored as they don't contain jump tables. | ||
1214 | */ | ||
1215 | for_each_sec(file, sec) { | ||
1216 | if (!strncmp(sec->name, ".rodata", 7) && | ||
1217 | !strstr(sec->name, ".str1.")) { | ||
1218 | sec->rodata = true; | ||
1219 | found = true; | ||
1220 | } | ||
1221 | } | ||
1222 | |||
1223 | file->rodata = found; | ||
1224 | } | ||
1225 | |||
1201 | static int decode_sections(struct objtool_file *file) | 1226 | static int decode_sections(struct objtool_file *file) |
1202 | { | 1227 | { |
1203 | int ret; | 1228 | int ret; |
1204 | 1229 | ||
1230 | mark_rodata(file); | ||
1231 | |||
1205 | ret = decode_instructions(file); | 1232 | ret = decode_instructions(file); |
1206 | if (ret) | 1233 | if (ret) |
1207 | return ret; | 1234 | return ret; |
@@ -2171,7 +2198,6 @@ int check(const char *_objname, bool orc) | |||
2171 | INIT_LIST_HEAD(&file.insn_list); | 2198 | INIT_LIST_HEAD(&file.insn_list); |
2172 | hash_init(file.insn_hash); | 2199 | hash_init(file.insn_hash); |
2173 | file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard"); | 2200 | file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard"); |
2174 | file.rodata = find_section_by_name(file.elf, ".rodata"); | ||
2175 | file.c_file = find_section_by_name(file.elf, ".comment"); | 2201 | file.c_file = find_section_by_name(file.elf, ".comment"); |
2176 | file.ignore_unreachables = no_unreachable; | 2202 | file.ignore_unreachables = no_unreachable; |
2177 | file.hints = false; | 2203 | file.hints = false; |
diff --git a/tools/objtool/check.h b/tools/objtool/check.h index 95700a2bcb7c..e6e8a655b556 100644 --- a/tools/objtool/check.h +++ b/tools/objtool/check.h | |||
@@ -60,8 +60,8 @@ struct objtool_file { | |||
60 | struct elf *elf; | 60 | struct elf *elf; |
61 | struct list_head insn_list; | 61 | struct list_head insn_list; |
62 | DECLARE_HASHTABLE(insn_hash, 16); | 62 | DECLARE_HASHTABLE(insn_hash, 16); |
63 | struct section *rodata, *whitelist; | 63 | struct section *whitelist; |
64 | bool ignore_unreachables, c_file, hints; | 64 | bool ignore_unreachables, c_file, hints, rodata; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | int check(const char *objname, bool orc); | 67 | int check(const char *objname, bool orc); |
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 7ec85d567598..6dbb9fae0f9d 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c | |||
@@ -301,7 +301,7 @@ static int read_symbols(struct elf *elf) | |||
301 | if (sym->type != STT_FUNC) | 301 | if (sym->type != STT_FUNC) |
302 | continue; | 302 | continue; |
303 | sym->pfunc = sym->cfunc = sym; | 303 | sym->pfunc = sym->cfunc = sym; |
304 | coldstr = strstr(sym->name, ".cold."); | 304 | coldstr = strstr(sym->name, ".cold"); |
305 | if (!coldstr) | 305 | if (!coldstr) |
306 | continue; | 306 | continue; |
307 | 307 | ||
@@ -379,6 +379,7 @@ static int read_relas(struct elf *elf) | |||
379 | rela->offset = rela->rela.r_offset; | 379 | rela->offset = rela->rela.r_offset; |
380 | symndx = GELF_R_SYM(rela->rela.r_info); | 380 | symndx = GELF_R_SYM(rela->rela.r_info); |
381 | rela->sym = find_symbol_by_index(elf, symndx); | 381 | rela->sym = find_symbol_by_index(elf, symndx); |
382 | rela->rela_sec = sec; | ||
382 | if (!rela->sym) { | 383 | if (!rela->sym) { |
383 | WARN("can't find rela entry symbol %d for %s", | 384 | WARN("can't find rela entry symbol %d for %s", |
384 | symndx, sec->name); | 385 | symndx, sec->name); |
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index de5cd2ddded9..bc97ed86b9cd 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h | |||
@@ -48,7 +48,7 @@ struct section { | |||
48 | char *name; | 48 | char *name; |
49 | int idx; | 49 | int idx; |
50 | unsigned int len; | 50 | unsigned int len; |
51 | bool changed, text; | 51 | bool changed, text, rodata; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct symbol { | 54 | struct symbol { |
@@ -68,6 +68,7 @@ struct rela { | |||
68 | struct list_head list; | 68 | struct list_head list; |
69 | struct hlist_node hash; | 69 | struct hlist_node hash; |
70 | GElf_Rela rela; | 70 | GElf_Rela rela; |
71 | struct section *rela_sec; | ||
71 | struct symbol *sym; | 72 | struct symbol *sym; |
72 | unsigned int type; | 73 | unsigned int type; |
73 | unsigned long offset; | 74 | unsigned long offset; |