Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
"The biggest part is a series of reverts for the macro based GCC
inlining workarounds. It caused regressions in distro build and other
kernel tooling environments, and the GCC project was very receptive to
fixing the underlying inliner weaknesses - so as time ran out we
decided to do a reasonably straightforward revert of the patches. The
plan is to rely on the 'asm inline' GCC 9 feature, which might be
backported to GCC 8 and could thus become reasonably widely available
on modern distros.

Other than those reverts, there's misc fixes from all around the
place.

I wish our final x86 pull request for v4.20 was smaller..."

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
Revert "kbuild/Makefile: Prepare for using macros in inline assembly code to work around asm() related GCC inlining bugs"
Revert "x86/objtool: Use asm macros to work around GCC inlining bugs"
Revert "x86/refcount: Work around GCC inlining bug"
Revert "x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs"
Revert "x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs"
Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops"
Revert "x86/extable: Macrofy inline assembly code to work around GCC inlining bugs"
Revert "x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs"
Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs"
x86/mtrr: Don't copy uninitialized gentry fields back to userspace
x86/fsgsbase/64: Fix the base write helper functions
x86/mm/cpa: Fix cpa_flush_array() TLB invalidation
x86/vdso: Pass --eh-frame-hdr to the linker
x86/mm: Fix decoy address handling vs 32-bit builds
x86/intel_rdt: Ensure a CPU remains online for the region's pseudo-locking sequence
x86/dump_pagetables: Fix LDT remap address marker
x86/mm: Fix guard hole handling

+385 -392
+2 -7
Makefile
··· 1076 1076 # version.h and scripts_basic is processed / created. 1077 1077 1078 1078 # Listed in dependency order 1079 - PHONY += prepare archprepare macroprepare prepare0 prepare1 prepare2 prepare3 1079 + PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 1080 1080 1081 1081 # prepare3 is used to check if we are building in a separate output directory, 1082 1082 # and if so do: ··· 1099 1099 prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h 1100 1100 $(cmd_crmodverdir) 1101 1101 1102 - macroprepare: prepare1 archmacros 1103 - 1104 - archprepare: archheaders archscripts macroprepare scripts_basic 1102 + archprepare: archheaders archscripts prepare1 scripts_basic 1105 1103 1106 1104 prepare0: archprepare gcc-plugins 1107 1105 $(Q)$(MAKE) $(build)=. ··· 1174 1176 1175 1177 PHONY += archscripts 1176 1178 archscripts: 1177 - 1178 - PHONY += archmacros 1179 - archmacros: 1180 1179 1181 1180 PHONY += __headers 1182 1181 __headers: $(version_h) scripts_basic uapi-asm-generic archheaders archscripts
-7
arch/x86/Makefile
··· 232 232 archheaders: 233 233 $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all 234 234 235 - archmacros: 236 - $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s 237 - 238 - ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s 239 - export ASM_MACRO_FLAGS 240 - KBUILD_CFLAGS += $(ASM_MACRO_FLAGS) 241 - 242 235 ### 243 236 # Kernel objects 244 237
+1 -1
arch/x86/entry/calling.h
··· 352 352 .macro CALL_enter_from_user_mode 353 353 #ifdef CONFIG_CONTEXT_TRACKING 354 354 #ifdef HAVE_JUMP_LABEL 355 - STATIC_BRANCH_JMP l_yes=.Lafter_call_\@, key=context_tracking_enabled, branch=1 355 + STATIC_JUMP_IF_FALSE .Lafter_call_\@, context_tracking_enabled, def=0 356 356 #endif 357 357 call enter_from_user_mode 358 358 .Lafter_call_\@:
+2 -1
arch/x86/entry/vdso/Makefile
··· 171 171 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' 172 172 173 173 VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \ 174 - $(call ld-option, --build-id) -Bsymbolic 174 + $(call ld-option, --build-id) $(call ld-option, --eh-frame-hdr) \ 175 + -Bsymbolic 175 176 GCOV_PROFILE := n 176 177 177 178 #
+6 -14
arch/x86/include/asm/alternative-asm.h
··· 7 7 #include <asm/asm.h> 8 8 9 9 #ifdef CONFIG_SMP 10 - .macro LOCK_PREFIX_HERE 10 + .macro LOCK_PREFIX 11 + 672: lock 11 12 .pushsection .smp_locks,"a" 12 13 .balign 4 13 - .long 671f - . # offset 14 + .long 672b - . 14 15 .popsection 15 - 671: 16 - .endm 17 - 18 - .macro LOCK_PREFIX insn:vararg 19 - LOCK_PREFIX_HERE 20 - lock \insn 21 - .endm 16 + .endm 22 17 #else 23 - .macro LOCK_PREFIX_HERE 24 - .endm 25 - 26 - .macro LOCK_PREFIX insn:vararg 27 - .endm 18 + .macro LOCK_PREFIX 19 + .endm 28 20 #endif 29 21 30 22 /*
+9 -2
arch/x86/include/asm/alternative.h
··· 31 31 */ 32 32 33 33 #ifdef CONFIG_SMP 34 - #define LOCK_PREFIX_HERE "LOCK_PREFIX_HERE\n\t" 35 - #define LOCK_PREFIX "LOCK_PREFIX " 34 + #define LOCK_PREFIX_HERE \ 35 + ".pushsection .smp_locks,\"a\"\n" \ 36 + ".balign 4\n" \ 37 + ".long 671f - .\n" /* offset */ \ 38 + ".popsection\n" \ 39 + "671:" 40 + 41 + #define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; " 42 + 36 43 #else /* ! CONFIG_SMP */ 37 44 #define LOCK_PREFIX_HERE "" 38 45 #define LOCK_PREFIX ""
+33 -20
arch/x86/include/asm/asm.h
··· 120 120 /* Exception table entry */ 121 121 #ifdef __ASSEMBLY__ 122 122 # define _ASM_EXTABLE_HANDLE(from, to, handler) \ 123 - ASM_EXTABLE_HANDLE from to handler 124 - 125 - .macro ASM_EXTABLE_HANDLE from:req to:req handler:req 126 - .pushsection "__ex_table","a" 127 - .balign 4 128 - .long (\from) - . 129 - .long (\to) - . 130 - .long (\handler) - . 123 + .pushsection "__ex_table","a" ; \ 124 + .balign 4 ; \ 125 + .long (from) - . ; \ 126 + .long (to) - . ; \ 127 + .long (handler) - . ; \ 131 128 .popsection 132 - .endm 133 - #else /* __ASSEMBLY__ */ 134 - 135 - # define _ASM_EXTABLE_HANDLE(from, to, handler) \ 136 - "ASM_EXTABLE_HANDLE from=" #from " to=" #to \ 137 - " handler=\"" #handler "\"\n\t" 138 - 139 - /* For C file, we already have NOKPROBE_SYMBOL macro */ 140 - 141 - #endif /* __ASSEMBLY__ */ 142 129 143 130 # define _ASM_EXTABLE(from, to) \ 144 131 _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) ··· 148 161 _ASM_PTR (entry); \ 149 162 .popsection 150 163 151 - #ifdef __ASSEMBLY__ 152 164 .macro ALIGN_DESTINATION 153 165 /* check for bad alignment of destination */ 154 166 movl %edi,%ecx ··· 171 185 _ASM_EXTABLE_UA(100b, 103b) 172 186 _ASM_EXTABLE_UA(101b, 103b) 173 187 .endm 174 - #endif /* __ASSEMBLY__ */ 188 + 189 + #else 190 + # define _EXPAND_EXTABLE_HANDLE(x) #x 191 + # define _ASM_EXTABLE_HANDLE(from, to, handler) \ 192 + " .pushsection \"__ex_table\",\"a\"\n" \ 193 + " .balign 4\n" \ 194 + " .long (" #from ") - .\n" \ 195 + " .long (" #to ") - .\n" \ 196 + " .long (" _EXPAND_EXTABLE_HANDLE(handler) ") - .\n" \ 197 + " .popsection\n" 198 + 199 + # define _ASM_EXTABLE(from, to) \ 200 + _ASM_EXTABLE_HANDLE(from, to, ex_handler_default) 201 + 202 + # define _ASM_EXTABLE_UA(from, to) \ 203 + _ASM_EXTABLE_HANDLE(from, to, ex_handler_uaccess) 204 + 205 + # define _ASM_EXTABLE_FAULT(from, to) \ 206 + _ASM_EXTABLE_HANDLE(from, to, ex_handler_fault) 207 + 208 + # define _ASM_EXTABLE_EX(from, to) \ 209 + _ASM_EXTABLE_HANDLE(from, to, ex_handler_ext) 210 + 211 + # define _ASM_EXTABLE_REFCOUNT(from, to) \ 212 + _ASM_EXTABLE_HANDLE(from, to, ex_handler_refcount) 213 + 214 + /* For C file, we already have NOKPROBE_SYMBOL macro */ 215 + #endif 175 216 176 217 #ifndef __ASSEMBLY__ 177 218 /*
+42 -56
arch/x86/include/asm/bug.h
··· 4 4 5 5 #include <linux/stringify.h> 6 6 7 - #ifndef __ASSEMBLY__ 8 - 9 7 /* 10 8 * Despite that some emulators terminate on UD2, we use it for WARN(). 11 9 * ··· 20 22 21 23 #define LEN_UD2 2 22 24 25 + #ifdef CONFIG_GENERIC_BUG 26 + 27 + #ifdef CONFIG_X86_32 28 + # define __BUG_REL(val) ".long " __stringify(val) 29 + #else 30 + # define __BUG_REL(val) ".long " __stringify(val) " - 2b" 31 + #endif 32 + 33 + #ifdef CONFIG_DEBUG_BUGVERBOSE 34 + 23 35 #define _BUG_FLAGS(ins, flags) \ 24 36 do { \ 25 - asm volatile("ASM_BUG ins=\"" ins "\" file=%c0 line=%c1 " \ 26 - "flags=%c2 size=%c3" \ 27 - : : "i" (__FILE__), "i" (__LINE__), \ 28 - "i" (flags), \ 37 + asm volatile("1:\t" ins "\n" \ 38 + ".pushsection __bug_table,\"aw\"\n" \ 39 + "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 40 + "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ 41 + "\t.word %c1" "\t# bug_entry::line\n" \ 42 + "\t.word %c2" "\t# bug_entry::flags\n" \ 43 + "\t.org 2b+%c3\n" \ 44 + ".popsection" \ 45 + : : "i" (__FILE__), "i" (__LINE__), \ 46 + "i" (flags), \ 29 47 "i" (sizeof(struct bug_entry))); \ 30 48 } while (0) 49 + 50 + #else /* !CONFIG_DEBUG_BUGVERBOSE */ 51 + 52 + #define _BUG_FLAGS(ins, flags) \ 53 + do { \ 54 + asm volatile("1:\t" ins "\n" \ 55 + ".pushsection __bug_table,\"aw\"\n" \ 56 + "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 57 + "\t.word %c0" "\t# bug_entry::flags\n" \ 58 + "\t.org 2b+%c1\n" \ 59 + ".popsection" \ 60 + : : "i" (flags), \ 61 + "i" (sizeof(struct bug_entry))); \ 62 + } while (0) 63 + 64 + #endif /* CONFIG_DEBUG_BUGVERBOSE */ 65 + 66 + #else 67 + 68 + #define _BUG_FLAGS(ins, flags) asm volatile(ins) 69 + 70 + #endif /* CONFIG_GENERIC_BUG */ 31 71 32 72 #define HAVE_ARCH_BUG 33 73 #define BUG() \ ··· 81 45 } while (0) 82 46 83 47 #include <asm-generic/bug.h> 84 - 85 - #else /* __ASSEMBLY__ */ 86 - 87 - #ifdef CONFIG_GENERIC_BUG 88 - 89 - #ifdef CONFIG_X86_32 90 - .macro __BUG_REL val:req 91 - .long \val 92 - .endm 93 - #else 94 - .macro __BUG_REL val:req 95 - .long \val - 2b 96 - .endm 97 - #endif 98 - 99 - #ifdef CONFIG_DEBUG_BUGVERBOSE 100 - 101 - .macro ASM_BUG ins:req file:req line:req flags:req size:req 102 - 1: \ins 103 - .pushsection __bug_table,"aw" 104 - 2: __BUG_REL val=1b # bug_entry::bug_addr 105 - __BUG_REL val=\file # bug_entry::file 106 - .word \line # bug_entry::line 107 - .word \flags # bug_entry::flags 108 - .org 2b+\size 109 - .popsection 110 - .endm 111 - 112 - #else /* !CONFIG_DEBUG_BUGVERBOSE */ 113 - 114 - .macro ASM_BUG ins:req file:req line:req flags:req size:req 115 - 1: \ins 116 - .pushsection __bug_table,"aw" 117 - 2: __BUG_REL val=1b # bug_entry::bug_addr 118 - .word \flags # bug_entry::flags 119 - .org 2b+\size 120 - .popsection 121 - .endm 122 - 123 - #endif /* CONFIG_DEBUG_BUGVERBOSE */ 124 - 125 - #else /* CONFIG_GENERIC_BUG */ 126 - 127 - .macro ASM_BUG ins:req file:req line:req flags:req size:req 128 - \ins 129 - .endm 130 - 131 - #endif /* CONFIG_GENERIC_BUG */ 132 - 133 - #endif /* __ASSEMBLY__ */ 134 48 135 49 #endif /* _ASM_X86_BUG_H */
+35 -47
arch/x86/include/asm/cpufeature.h
··· 2 2 #ifndef _ASM_X86_CPUFEATURE_H 3 3 #define _ASM_X86_CPUFEATURE_H 4 4 5 - #ifdef __KERNEL__ 6 - #ifndef __ASSEMBLY__ 7 - 8 5 #include <asm/processor.h> 6 + 7 + #if defined(__KERNEL__) && !defined(__ASSEMBLY__) 8 + 9 9 #include <asm/asm.h> 10 10 #include <linux/bitops.h> 11 11 ··· 161 161 */ 162 162 static __always_inline __pure bool _static_cpu_has(u16 bit) 163 163 { 164 - asm_volatile_goto("STATIC_CPU_HAS bitnum=%[bitnum] " 165 - "cap_byte=\"%[cap_byte]\" " 166 - "feature=%P[feature] t_yes=%l[t_yes] " 167 - "t_no=%l[t_no] always=%P[always]" 164 + asm_volatile_goto("1: jmp 6f\n" 165 + "2:\n" 166 + ".skip -(((5f-4f) - (2b-1b)) > 0) * " 167 + "((5f-4f) - (2b-1b)),0x90\n" 168 + "3:\n" 169 + ".section .altinstructions,\"a\"\n" 170 + " .long 1b - .\n" /* src offset */ 171 + " .long 4f - .\n" /* repl offset */ 172 + " .word %P[always]\n" /* always replace */ 173 + " .byte 3b - 1b\n" /* src len */ 174 + " .byte 5f - 4f\n" /* repl len */ 175 + " .byte 3b - 2b\n" /* pad len */ 176 + ".previous\n" 177 + ".section .altinstr_replacement,\"ax\"\n" 178 + "4: jmp %l[t_no]\n" 179 + "5:\n" 180 + ".previous\n" 181 + ".section .altinstructions,\"a\"\n" 182 + " .long 1b - .\n" /* src offset */ 183 + " .long 0\n" /* no replacement */ 184 + " .word %P[feature]\n" /* feature bit */ 185 + " .byte 3b - 1b\n" /* src len */ 186 + " .byte 0\n" /* repl len */ 187 + " .byte 0\n" /* pad len */ 188 + ".previous\n" 189 + ".section .altinstr_aux,\"ax\"\n" 190 + "6:\n" 191 + " testb %[bitnum],%[cap_byte]\n" 192 + " jnz %l[t_yes]\n" 193 + " jmp %l[t_no]\n" 194 + ".previous\n" 168 195 : : [feature] "i" (bit), 169 196 [always] "i" (X86_FEATURE_ALWAYS), 170 197 [bitnum] "i" (1 << (bit & 7)), ··· 226 199 #define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \ 227 200 boot_cpu_data.x86_model 228 201 229 - #else /* __ASSEMBLY__ */ 230 - 231 - .macro STATIC_CPU_HAS bitnum:req cap_byte:req feature:req t_yes:req t_no:req always:req 232 - 1: 233 - jmp 6f 234 - 2: 235 - .skip -(((5f-4f) - (2b-1b)) > 0) * ((5f-4f) - (2b-1b)),0x90 236 - 3: 237 - .section .altinstructions,"a" 238 - .long 1b - . /* src offset */ 239 - .long 4f - . /* repl offset */ 240 - .word \always /* always replace */ 241 - .byte 3b - 1b /* src len */ 242 - .byte 5f - 4f /* repl len */ 243 - .byte 3b - 2b /* pad len */ 244 - .previous 245 - .section .altinstr_replacement,"ax" 246 - 4: 247 - jmp \t_no 248 - 5: 249 - .previous 250 - .section .altinstructions,"a" 251 - .long 1b - . /* src offset */ 252 - .long 0 /* no replacement */ 253 - .word \feature /* feature bit */ 254 - .byte 3b - 1b /* src len */ 255 - .byte 0 /* repl len */ 256 - .byte 0 /* pad len */ 257 - .previous 258 - .section .altinstr_aux,"ax" 259 - 6: 260 - testb \bitnum,\cap_byte 261 - jnz \t_yes 262 - jmp \t_no 263 - .previous 264 - .endm 265 - 266 - #endif /* __ASSEMBLY__ */ 267 - 268 - #endif /* __KERNEL__ */ 202 + #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ 269 203 #endif /* _ASM_X86_CPUFEATURE_H */
+11 -4
arch/x86/include/asm/fsgsbase.h
··· 16 16 */ 17 17 extern unsigned long x86_fsbase_read_task(struct task_struct *task); 18 18 extern unsigned long x86_gsbase_read_task(struct task_struct *task); 19 - extern int x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase); 20 - extern int x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase); 19 + extern void x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase); 20 + extern void x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase); 21 21 22 22 /* Helper functions for reading/writing FS/GS base */ 23 23 ··· 39 39 return gsbase; 40 40 } 41 41 42 - extern void x86_fsbase_write_cpu(unsigned long fsbase); 43 - extern void x86_gsbase_write_cpu_inactive(unsigned long gsbase); 42 + static inline void x86_fsbase_write_cpu(unsigned long fsbase) 43 + { 44 + wrmsrl(MSR_FS_BASE, fsbase); 45 + } 46 + 47 + static inline void x86_gsbase_write_cpu_inactive(unsigned long gsbase) 48 + { 49 + wrmsrl(MSR_KERNEL_GS_BASE, gsbase); 50 + } 44 51 45 52 #endif /* CONFIG_X86_64 */ 46 53
+54 -18
arch/x86/include/asm/jump_label.h
··· 2 2 #ifndef _ASM_X86_JUMP_LABEL_H 3 3 #define _ASM_X86_JUMP_LABEL_H 4 4 5 + #ifndef HAVE_JUMP_LABEL 6 + /* 7 + * For better or for worse, if jump labels (the gcc extension) are missing, 8 + * then the entire static branch patching infrastructure is compiled out. 9 + * If that happens, the code in here will malfunction. Raise a compiler 10 + * error instead. 11 + * 12 + * In theory, jump labels and the static branch patching infrastructure 13 + * could be decoupled to fix this. 14 + */ 15 + #error asm/jump_label.h included on a non-jump-label kernel 16 + #endif 17 + 5 18 #define JUMP_LABEL_NOP_SIZE 5 6 19 7 20 #ifdef CONFIG_X86_64 ··· 33 20 34 21 static __always_inline bool arch_static_branch(struct static_key *key, bool branch) 35 22 { 36 - asm_volatile_goto("STATIC_BRANCH_NOP l_yes=\"%l[l_yes]\" key=\"%c0\" " 37 - "branch=\"%c1\"" 38 - : : "i" (key), "i" (branch) : : l_yes); 23 + asm_volatile_goto("1:" 24 + ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" 25 + ".pushsection __jump_table, \"aw\" \n\t" 26 + _ASM_ALIGN "\n\t" 27 + ".long 1b - ., %l[l_yes] - . \n\t" 28 + _ASM_PTR "%c0 + %c1 - .\n\t" 29 + ".popsection \n\t" 30 + : : "i" (key), "i" (branch) : : l_yes); 31 + 39 32 return false; 40 33 l_yes: 41 34 return true; ··· 49 30 50 31 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) 51 32 { 52 - asm_volatile_goto("STATIC_BRANCH_JMP l_yes=\"%l[l_yes]\" key=\"%c0\" " 53 - "branch=\"%c1\"" 33 + asm_volatile_goto("1:" 34 + ".byte 0xe9\n\t .long %l[l_yes] - 2f\n\t" 35 + "2:\n\t" 36 + ".pushsection __jump_table, \"aw\" \n\t" 37 + _ASM_ALIGN "\n\t" 38 + ".long 1b - ., %l[l_yes] - . \n\t" 39 + _ASM_PTR "%c0 + %c1 - .\n\t" 40 + ".popsection \n\t" 54 41 : : "i" (key), "i" (branch) : : l_yes); 55 42 56 43 return false; ··· 66 41 67 42 #else /* __ASSEMBLY__ */ 68 43 69 - .macro STATIC_BRANCH_NOP l_yes:req key:req branch:req 70 - .Lstatic_branch_nop_\@: 71 - .byte STATIC_KEY_INIT_NOP 72 - .Lstatic_branch_no_after_\@: 44 + .macro STATIC_JUMP_IF_TRUE target, key, def 45 + .Lstatic_jump_\@: 46 + .if \def 47 + /* Equivalent to "jmp.d32 \target" */ 48 + .byte 0xe9 49 + .long \target - .Lstatic_jump_after_\@ 50 + .Lstatic_jump_after_\@: 51 + .else 52 + .byte STATIC_KEY_INIT_NOP 53 + .endif 73 54 .pushsection __jump_table, "aw" 74 55 _ASM_ALIGN 75 - .long .Lstatic_branch_nop_\@ - ., \l_yes - . 76 - _ASM_PTR \key + \branch - . 56 + .long .Lstatic_jump_\@ - ., \target - . 57 + _ASM_PTR \key - . 77 58 .popsection 78 59 .endm 79 60 80 - .macro STATIC_BRANCH_JMP l_yes:req key:req branch:req 81 - .Lstatic_branch_jmp_\@: 82 - .byte 0xe9 83 - .long \l_yes - .Lstatic_branch_jmp_after_\@ 84 - .Lstatic_branch_jmp_after_\@: 61 + .macro STATIC_JUMP_IF_FALSE target, key, def 62 + .Lstatic_jump_\@: 63 + .if \def 64 + .byte STATIC_KEY_INIT_NOP 65 + .else 66 + /* Equivalent to "jmp.d32 \target" */ 67 + .byte 0xe9 68 + .long \target - .Lstatic_jump_after_\@ 69 + .Lstatic_jump_after_\@: 70 + .endif 85 71 .pushsection __jump_table, "aw" 86 72 _ASM_ALIGN 87 - .long .Lstatic_branch_jmp_\@ - ., \l_yes - . 88 - _ASM_PTR \key + \branch - . 73 + .long .Lstatic_jump_\@ - ., \target - . 74 + _ASM_PTR \key + 1 - . 89 75 .popsection 90 76 .endm 91 77
+29 -27
arch/x86/include/asm/paravirt_types.h
··· 348 348 #define paravirt_clobber(clobber) \ 349 349 [paravirt_clobber] "i" (clobber) 350 350 351 + /* 352 + * Generate some code, and mark it as patchable by the 353 + * apply_paravirt() alternate instruction patcher. 354 + */ 355 + #define _paravirt_alt(insn_string, type, clobber) \ 356 + "771:\n\t" insn_string "\n" "772:\n" \ 357 + ".pushsection .parainstructions,\"a\"\n" \ 358 + _ASM_ALIGN "\n" \ 359 + _ASM_PTR " 771b\n" \ 360 + " .byte " type "\n" \ 361 + " .byte 772b-771b\n" \ 362 + " .short " clobber "\n" \ 363 + ".popsection\n" 364 + 351 365 /* Generate patchable code, with the default asm parameters. */ 352 - #define paravirt_call \ 353 - "PARAVIRT_CALL type=\"%c[paravirt_typenum]\"" \ 354 - " clobber=\"%c[paravirt_clobber]\"" \ 355 - " pv_opptr=\"%c[paravirt_opptr]\";" 366 + #define paravirt_alt(insn_string) \ 367 + _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]") 356 368 357 369 /* Simple instruction patching code. */ 358 370 #define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t" ··· 383 371 unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len); 384 372 385 373 int paravirt_disable_iospace(void); 374 + 375 + /* 376 + * This generates an indirect call based on the operation type number. 377 + * The type number, computed in PARAVIRT_PATCH, is derived from the 378 + * offset into the paravirt_patch_template structure, and can therefore be 379 + * freely converted back into a structure offset. 380 + */ 381 + #define PARAVIRT_CALL \ 382 + ANNOTATE_RETPOLINE_SAFE \ 383 + "call *%c[paravirt_opptr];" 386 384 387 385 /* 388 386 * These macros are intended to wrap calls through one of the paravirt ··· 531 509 /* since this condition will never hold */ \ 532 510 if (sizeof(rettype) > sizeof(unsigned long)) { \ 533 511 asm volatile(pre \ 534 - paravirt_call \ 512 + paravirt_alt(PARAVIRT_CALL) \ 535 513 post \ 536 514 : call_clbr, ASM_CALL_CONSTRAINT \ 537 515 : paravirt_type(op), \ ··· 541 519 __ret = (rettype)((((u64)__edx) << 32) | __eax); \ 542 520 } else { \ 543 521 asm volatile(pre \ 544 - paravirt_call \ 522 + paravirt_alt(PARAVIRT_CALL) \ 545 523 post \ 546 524 : call_clbr, ASM_CALL_CONSTRAINT \ 547 525 : paravirt_type(op), \ ··· 568 546 PVOP_VCALL_ARGS; \ 569 547 PVOP_TEST_NULL(op); \ 570 548 asm volatile(pre \ 571 - paravirt_call \ 549 + paravirt_alt(PARAVIRT_CALL) \ 572 550 post \ 573 551 : call_clbr, ASM_CALL_CONSTRAINT \ 574 552 : paravirt_type(op), \ ··· 685 663 686 664 extern struct paravirt_patch_site __parainstructions[], 687 665 __parainstructions_end[]; 688 - 689 - #else /* __ASSEMBLY__ */ 690 - 691 - /* 692 - * This generates an indirect call based on the operation type number. 693 - * The type number, computed in PARAVIRT_PATCH, is derived from the 694 - * offset into the paravirt_patch_template structure, and can therefore be 695 - * freely converted back into a structure offset. 696 - */ 697 - .macro PARAVIRT_CALL type:req clobber:req pv_opptr:req 698 - 771: ANNOTATE_RETPOLINE_SAFE 699 - call *\pv_opptr 700 - 772: .pushsection .parainstructions,"a" 701 - _ASM_ALIGN 702 - _ASM_PTR 771b 703 - .byte \type 704 - .byte 772b-771b 705 - .short \clobber 706 - .popsection 707 - .endm 708 666 709 667 #endif /* __ASSEMBLY__ */ 710 668
+5
arch/x86/include/asm/pgtable_64_types.h
··· 111 111 */ 112 112 #define MAXMEM (1UL << MAX_PHYSMEM_BITS) 113 113 114 + #define GUARD_HOLE_PGD_ENTRY -256UL 115 + #define GUARD_HOLE_SIZE (16UL << PGDIR_SHIFT) 116 + #define GUARD_HOLE_BASE_ADDR (GUARD_HOLE_PGD_ENTRY << PGDIR_SHIFT) 117 + #define GUARD_HOLE_END_ADDR (GUARD_HOLE_BASE_ADDR + GUARD_HOLE_SIZE) 118 + 114 119 #define LDT_PGD_ENTRY -240UL 115 120 #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) 116 121 #define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE)
+33 -48
arch/x86/include/asm/refcount.h
··· 4 4 * x86-specific implementation of refcount_t. Based on PAX_REFCOUNT from 5 5 * PaX/grsecurity. 6 6 */ 7 - 8 - #ifdef __ASSEMBLY__ 9 - 10 - #include <asm/asm.h> 11 - #include <asm/bug.h> 12 - 13 - .macro REFCOUNT_EXCEPTION counter:req 14 - .pushsection .text..refcount 15 - 111: lea \counter, %_ASM_CX 16 - 112: ud2 17 - ASM_UNREACHABLE 18 - .popsection 19 - 113: _ASM_EXTABLE_REFCOUNT(112b, 113b) 20 - .endm 21 - 22 - /* Trigger refcount exception if refcount result is negative. */ 23 - .macro REFCOUNT_CHECK_LT_ZERO counter:req 24 - js 111f 25 - REFCOUNT_EXCEPTION counter="\counter" 26 - .endm 27 - 28 - /* Trigger refcount exception if refcount result is zero or negative. */ 29 - .macro REFCOUNT_CHECK_LE_ZERO counter:req 30 - jz 111f 31 - REFCOUNT_CHECK_LT_ZERO counter="\counter" 32 - .endm 33 - 34 - /* Trigger refcount exception unconditionally. */ 35 - .macro REFCOUNT_ERROR counter:req 36 - jmp 111f 37 - REFCOUNT_EXCEPTION counter="\counter" 38 - .endm 39 - 40 - #else /* __ASSEMBLY__ */ 41 - 42 7 #include <linux/refcount.h> 43 8 #include <asm/bug.h> 44 9 ··· 15 50 * central refcount exception. The fixup address for the exception points 16 51 * back to the regular execution flow in .text. 17 52 */ 53 + #define _REFCOUNT_EXCEPTION \ 54 + ".pushsection .text..refcount\n" \ 55 + "111:\tlea %[var], %%" _ASM_CX "\n" \ 56 + "112:\t" ASM_UD2 "\n" \ 57 + ASM_UNREACHABLE \ 58 + ".popsection\n" \ 59 + "113:\n" \ 60 + _ASM_EXTABLE_REFCOUNT(112b, 113b) 61 + 62 + /* Trigger refcount exception if refcount result is negative. */ 63 + #define REFCOUNT_CHECK_LT_ZERO \ 64 + "js 111f\n\t" \ 65 + _REFCOUNT_EXCEPTION 66 + 67 + /* Trigger refcount exception if refcount result is zero or negative. */ 68 + #define REFCOUNT_CHECK_LE_ZERO \ 69 + "jz 111f\n\t" \ 70 + REFCOUNT_CHECK_LT_ZERO 71 + 72 + /* Trigger refcount exception unconditionally. */ 73 + #define REFCOUNT_ERROR \ 74 + "jmp 111f\n\t" \ 75 + _REFCOUNT_EXCEPTION 18 76 19 77 static __always_inline void refcount_add(unsigned int i, refcount_t *r) 20 78 { 21 79 asm volatile(LOCK_PREFIX "addl %1,%0\n\t" 22 - "REFCOUNT_CHECK_LT_ZERO counter=\"%[counter]\"" 23 - : [counter] "+m" (r->refs.counter) 80 + REFCOUNT_CHECK_LT_ZERO 81 + : [var] "+m" (r->refs.counter) 24 82 : "ir" (i) 25 83 : "cc", "cx"); 26 84 } ··· 51 63 static __always_inline void refcount_inc(refcount_t *r) 52 64 { 53 65 asm volatile(LOCK_PREFIX "incl %0\n\t" 54 - "REFCOUNT_CHECK_LT_ZERO counter=\"%[counter]\"" 55 - : [counter] "+m" (r->refs.counter) 66 + REFCOUNT_CHECK_LT_ZERO 67 + : [var] "+m" (r->refs.counter) 56 68 : : "cc", "cx"); 57 69 } 58 70 59 71 static __always_inline void refcount_dec(refcount_t *r) 60 72 { 61 73 asm volatile(LOCK_PREFIX "decl %0\n\t" 62 - "REFCOUNT_CHECK_LE_ZERO counter=\"%[counter]\"" 63 - : [counter] "+m" (r->refs.counter) 74 + REFCOUNT_CHECK_LE_ZERO 75 + : [var] "+m" (r->refs.counter) 64 76 : : "cc", "cx"); 65 77 } 66 78 67 79 static __always_inline __must_check 68 80 bool refcount_sub_and_test(unsigned int i, refcount_t *r) 69 81 { 70 - 71 82 return GEN_BINARY_SUFFIXED_RMWcc(LOCK_PREFIX "subl", 72 - "REFCOUNT_CHECK_LT_ZERO counter=\"%[var]\"", 83 + REFCOUNT_CHECK_LT_ZERO, 73 84 r->refs.counter, e, "er", i, "cx"); 74 85 } 75 86 76 87 static __always_inline __must_check bool refcount_dec_and_test(refcount_t *r) 77 88 { 78 89 return GEN_UNARY_SUFFIXED_RMWcc(LOCK_PREFIX "decl", 79 - "REFCOUNT_CHECK_LT_ZERO counter=\"%[var]\"", 90 + REFCOUNT_CHECK_LT_ZERO, 80 91 r->refs.counter, e, "cx"); 81 92 } 82 93 ··· 93 106 94 107 /* Did we try to increment from/to an undesirable state? */ 95 108 if (unlikely(c < 0 || c == INT_MAX || result < c)) { 96 - asm volatile("REFCOUNT_ERROR counter=\"%[counter]\"" 97 - : : [counter] "m" (r->refs.counter) 109 + asm volatile(REFCOUNT_ERROR 110 + : : [var] "m" (r->refs.counter) 98 111 : "cc", "cx"); 99 112 break; 100 113 } ··· 108 121 { 109 122 return refcount_add_not_zero(1, r); 110 123 } 111 - 112 - #endif /* __ASSEMBLY__ */ 113 124 114 125 #endif
+4
arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c
··· 23 23 24 24 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 25 25 26 + #include <linux/cpu.h> 26 27 #include <linux/kernfs.h> 27 28 #include <linux/seq_file.h> 28 29 #include <linux/slab.h> ··· 311 310 return -EINVAL; 312 311 buf[nbytes - 1] = '\0'; 313 312 313 + cpus_read_lock(); 314 314 rdtgrp = rdtgroup_kn_lock_live(of->kn); 315 315 if (!rdtgrp) { 316 316 rdtgroup_kn_unlock(of->kn); 317 + cpus_read_unlock(); 317 318 return -ENOENT; 318 319 } 319 320 rdt_last_cmd_clear(); ··· 370 367 371 368 out: 372 369 rdtgroup_kn_unlock(of->kn); 370 + cpus_read_unlock(); 373 371 return ret ?: nbytes; 374 372 } 375 373
+2
arch/x86/kernel/cpu/mtrr/if.c
··· 165 165 struct mtrr_gentry gentry; 166 166 void __user *arg = (void __user *) __arg; 167 167 168 + memset(&gentry, 0, sizeof(gentry)); 169 + 168 170 switch (cmd) { 169 171 case MTRRIOC_ADD_ENTRY: 170 172 case MTRRIOC_SET_ENTRY:
-16
arch/x86/kernel/macros.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - /* 4 - * This file includes headers whose assembly part includes macros which are 5 - * commonly used. The macros are precompiled into assmebly file which is later 6 - * assembled together with each compiled file. 7 - */ 8 - 9 - #include <linux/compiler.h> 10 - #include <asm/refcount.h> 11 - #include <asm/alternative-asm.h> 12 - #include <asm/bug.h> 13 - #include <asm/paravirt.h> 14 - #include <asm/asm.h> 15 - #include <asm/cpufeature.h> 16 - #include <asm/jump_label.h>
+55 -44
arch/x86/kernel/process_64.c
··· 339 339 return base; 340 340 } 341 341 342 - void x86_fsbase_write_cpu(unsigned long fsbase) 343 - { 344 - /* 345 - * Set the selector to 0 as a notion, that the segment base is 346 - * overwritten, which will be checked for skipping the segment load 347 - * during context switch. 348 - */ 349 - loadseg(FS, 0); 350 - wrmsrl(MSR_FS_BASE, fsbase); 351 - } 352 - 353 - void x86_gsbase_write_cpu_inactive(unsigned long gsbase) 354 - { 355 - /* Set the selector to 0 for the same reason as %fs above. */ 356 - loadseg(GS, 0); 357 - wrmsrl(MSR_KERNEL_GS_BASE, gsbase); 358 - } 359 - 360 342 unsigned long x86_fsbase_read_task(struct task_struct *task) 361 343 { 362 344 unsigned long fsbase; ··· 367 385 return gsbase; 368 386 } 369 387 370 - int x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase) 388 + void x86_fsbase_write_task(struct task_struct *task, unsigned long fsbase) 371 389 { 372 - /* 373 - * Not strictly needed for %fs, but do it for symmetry 374 - * with %gs 375 - */ 376 - if (unlikely(fsbase >= TASK_SIZE_MAX)) 377 - return -EPERM; 390 + WARN_ON_ONCE(task == current); 378 391 379 - preempt_disable(); 380 392 task->thread.fsbase = fsbase; 381 - if (task == current) 382 - x86_fsbase_write_cpu(fsbase); 383 - task->thread.fsindex = 0; 384 - preempt_enable(); 385 - 386 - return 0; 387 393 } 388 394 389 - int x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase) 395 + void x86_gsbase_write_task(struct task_struct *task, unsigned long gsbase) 390 396 { 391 - if (unlikely(gsbase >= TASK_SIZE_MAX)) 392 - return -EPERM; 397 + WARN_ON_ONCE(task == current); 393 398 394 - preempt_disable(); 395 399 task->thread.gsbase = gsbase; 396 - if (task == current) 397 - x86_gsbase_write_cpu_inactive(gsbase); 398 - task->thread.gsindex = 0; 399 - preempt_enable(); 400 - 401 - return 0; 402 400 } 403 401 404 402 int copy_thread_tls(unsigned long clone_flags, unsigned long sp, ··· 716 754 717 755 switch (option) { 718 756 case ARCH_SET_GS: { 719 - ret = x86_gsbase_write_task(task, arg2); 757 + if (unlikely(arg2 >= TASK_SIZE_MAX)) 758 + return -EPERM; 759 + 760 + preempt_disable(); 761 + /* 762 + * ARCH_SET_GS has always overwritten the index 763 + * and the base. Zero is the most sensible value 764 + * to put in the index, and is the only value that 765 + * makes any sense if FSGSBASE is unavailable. 766 + */ 767 + if (task == current) { 768 + loadseg(GS, 0); 769 + x86_gsbase_write_cpu_inactive(arg2); 770 + 771 + /* 772 + * On non-FSGSBASE systems, save_base_legacy() expects 773 + * that we also fill in thread.gsbase. 774 + */ 775 + task->thread.gsbase = arg2; 776 + 777 + } else { 778 + task->thread.gsindex = 0; 779 + x86_gsbase_write_task(task, arg2); 780 + } 781 + preempt_enable(); 720 782 break; 721 783 } 722 784 case ARCH_SET_FS: { 723 - ret = x86_fsbase_write_task(task, arg2); 785 + /* 786 + * Not strictly needed for %fs, but do it for symmetry 787 + * with %gs 788 + */ 789 + if (unlikely(arg2 >= TASK_SIZE_MAX)) 790 + return -EPERM; 791 + 792 + preempt_disable(); 793 + /* 794 + * Set the selector to 0 for the same reason 795 + * as %gs above. 796 + */ 797 + if (task == current) { 798 + loadseg(FS, 0); 799 + x86_fsbase_write_cpu(arg2); 800 + 801 + /* 802 + * On non-FSGSBASE systems, save_base_legacy() expects 803 + * that we also fill in thread.fsbase. 804 + */ 805 + task->thread.fsbase = arg2; 806 + } else { 807 + task->thread.fsindex = 0; 808 + x86_fsbase_write_task(task, arg2); 809 + } 810 + preempt_enable(); 724 811 break; 725 812 } 726 813 case ARCH_GET_FS: {
+5 -4
arch/x86/kernel/ptrace.c
··· 397 397 if (value >= TASK_SIZE_MAX) 398 398 return -EIO; 399 399 /* 400 - * When changing the FS base, use the same 401 - * mechanism as for do_arch_prctl_64(). 400 + * When changing the FS base, use do_arch_prctl_64() 401 + * to set the index to zero and to set the base 402 + * as requested. 402 403 */ 403 404 if (child->thread.fsbase != value) 404 - return x86_fsbase_write_task(child, value); 405 + return do_arch_prctl_64(child, ARCH_SET_FS, value); 405 406 return 0; 406 407 case offsetof(struct user_regs_struct,gs_base): 407 408 /* ··· 411 410 if (value >= TASK_SIZE_MAX) 412 411 return -EIO; 413 412 if (child->thread.gsbase != value) 414 - return x86_gsbase_write_task(child, value); 413 + return do_arch_prctl_64(child, ARCH_SET_GS, value); 415 414 return 0; 416 415 #endif 417 416 }
+6 -9
arch/x86/mm/dump_pagetables.c
··· 55 55 enum address_markers_idx { 56 56 USER_SPACE_NR = 0, 57 57 KERNEL_SPACE_NR, 58 - LOW_KERNEL_NR, 59 - #if defined(CONFIG_MODIFY_LDT_SYSCALL) && defined(CONFIG_X86_5LEVEL) 58 + #ifdef CONFIG_MODIFY_LDT_SYSCALL 60 59 LDT_NR, 61 60 #endif 61 + LOW_KERNEL_NR, 62 62 VMALLOC_START_NR, 63 63 VMEMMAP_START_NR, 64 64 #ifdef CONFIG_KASAN ··· 66 66 KASAN_SHADOW_END_NR, 67 67 #endif 68 68 CPU_ENTRY_AREA_NR, 69 - #if defined(CONFIG_MODIFY_LDT_SYSCALL) && !defined(CONFIG_X86_5LEVEL) 70 - LDT_NR, 71 - #endif 72 69 #ifdef CONFIG_X86_ESPFIX64 73 70 ESPFIX_START_NR, 74 71 #endif ··· 509 512 { 510 513 #ifdef CONFIG_X86_64 511 514 /* 512 - * ffff800000000000 - ffff87ffffffffff is reserved for 513 - * the hypervisor. 515 + * A hole in the beginning of kernel address space reserved 516 + * for a hypervisor. 514 517 */ 515 - return (idx >= pgd_index(__PAGE_OFFSET) - 16) && 516 - (idx < pgd_index(__PAGE_OFFSET)); 518 + return (idx >= pgd_index(GUARD_HOLE_BASE_ADDR)) && 519 + (idx < pgd_index(GUARD_HOLE_END_ADDR)); 517 520 #else 518 521 return false; 519 522 #endif
+16 -8
arch/x86/mm/pageattr.c
··· 285 285 on_each_cpu(__cpa_flush_all, (void *) cache, 1); 286 286 } 287 287 288 - static bool __cpa_flush_range(unsigned long start, int numpages, int cache) 288 + static bool __inv_flush_all(int cache) 289 289 { 290 290 BUG_ON(irqs_disabled() && !early_boot_irqs_disabled); 291 - 292 - WARN_ON(PAGE_ALIGN(start) != start); 293 291 294 292 if (cache && !static_cpu_has(X86_FEATURE_CLFLUSH)) { 295 293 cpa_flush_all(cache); 296 294 return true; 297 295 } 298 296 299 - flush_tlb_kernel_range(start, start + PAGE_SIZE * numpages); 300 - 301 - return !cache; 297 + return false; 302 298 } 303 299 304 300 static void cpa_flush_range(unsigned long start, int numpages, int cache) ··· 302 306 unsigned int i, level; 303 307 unsigned long addr; 304 308 305 - if (__cpa_flush_range(start, numpages, cache)) 309 + WARN_ON(PAGE_ALIGN(start) != start); 310 + 311 + if (__inv_flush_all(cache)) 312 + return; 313 + 314 + flush_tlb_kernel_range(start, start + PAGE_SIZE * numpages); 315 + 316 + if (!cache) 306 317 return; 307 318 308 319 /* ··· 335 332 { 336 333 unsigned int i, level; 337 334 338 - if (__cpa_flush_range(baddr, numpages, cache)) 335 + if (__inv_flush_all(cache)) 336 + return; 337 + 338 + flush_tlb_all(); 339 + 340 + if (!cache) 339 341 return; 340 342 341 343 /*
+11 -2
arch/x86/mm/pat.c
··· 519 519 * for a "decoy" virtual address (bit 63 clear) passed to 520 520 * set_memory_X(). __pa() on a "decoy" address results in a 521 521 * physical address with bit 63 set. 522 + * 523 + * Decoy addresses are not present for 32-bit builds, see 524 + * set_mce_nospec(). 522 525 */ 523 - return address & __PHYSICAL_MASK; 526 + if (IS_ENABLED(CONFIG_X86_64)) 527 + return address & __PHYSICAL_MASK; 528 + return address; 524 529 } 525 530 526 531 /* ··· 551 546 552 547 start = sanitize_phys(start); 553 548 end = sanitize_phys(end); 554 - BUG_ON(start >= end); /* end is exclusive */ 549 + if (start >= end) { 550 + WARN(1, "%s failed: [mem %#010Lx-%#010Lx], req %s\n", __func__, 551 + start, end - 1, cattr_name(req_type)); 552 + return -EINVAL; 553 + } 555 554 556 555 if (!pat_enabled()) { 557 556 /* This is identical to page table setting without PAT */
+6 -5
arch/x86/xen/mmu_pv.c
··· 648 648 unsigned long limit) 649 649 { 650 650 int i, nr, flush = 0; 651 - unsigned hole_low, hole_high; 651 + unsigned hole_low = 0, hole_high = 0; 652 652 653 653 /* The limit is the last byte to be touched */ 654 654 limit--; 655 655 BUG_ON(limit >= FIXADDR_TOP); 656 656 657 + #ifdef CONFIG_X86_64 657 658 /* 658 659 * 64-bit has a great big hole in the middle of the address 659 - * space, which contains the Xen mappings. On 32-bit these 660 - * will end up making a zero-sized hole and so is a no-op. 660 + * space, which contains the Xen mappings. 661 661 */ 662 - hole_low = pgd_index(USER_LIMIT); 663 - hole_high = pgd_index(PAGE_OFFSET); 662 + hole_low = pgd_index(GUARD_HOLE_BASE_ADDR); 663 + hole_high = pgd_index(GUARD_HOLE_END_ADDR); 664 + #endif 664 665 665 666 nr = pgd_index(limit) + 1; 666 667 for (i = 0; i < nr; i++) {
+4 -4
include/asm-generic/bug.h
··· 17 17 #ifndef __ASSEMBLY__ 18 18 #include <linux/kernel.h> 19 19 20 - struct bug_entry { 20 + #ifdef CONFIG_BUG 21 + 21 22 #ifdef CONFIG_GENERIC_BUG 23 + struct bug_entry { 22 24 #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 23 25 unsigned long bug_addr; 24 26 #else ··· 35 33 unsigned short line; 36 34 #endif 37 35 unsigned short flags; 38 - #endif /* CONFIG_GENERIC_BUG */ 39 36 }; 40 - 41 - #ifdef CONFIG_BUG 37 + #endif /* CONFIG_GENERIC_BUG */ 42 38 43 39 /* 44 40 * Don't use BUG() or BUG_ON() unless there's really no way out; one
+13 -43
include/linux/compiler.h
··· 99 99 * unique, to convince GCC not to merge duplicate inline asm statements. 100 100 */ 101 101 #define annotate_reachable() ({ \ 102 - asm volatile("ANNOTATE_REACHABLE counter=%c0" \ 103 - : : "i" (__COUNTER__)); \ 102 + asm volatile("%c0:\n\t" \ 103 + ".pushsection .discard.reachable\n\t" \ 104 + ".long %c0b - .\n\t" \ 105 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 104 106 }) 105 107 #define annotate_unreachable() ({ \ 106 - asm volatile("ANNOTATE_UNREACHABLE counter=%c0" \ 107 - : : "i" (__COUNTER__)); \ 108 + asm volatile("%c0:\n\t" \ 109 + ".pushsection .discard.unreachable\n\t" \ 110 + ".long %c0b - .\n\t" \ 111 + ".popsection\n\t" : : "i" (__COUNTER__)); \ 108 112 }) 113 + #define ASM_UNREACHABLE \ 114 + "999:\n\t" \ 115 + ".pushsection .discard.unreachable\n\t" \ 116 + ".long 999b - .\n\t" \ 117 + ".popsection\n\t" 109 118 #else 110 119 #define annotate_reachable() 111 120 #define annotate_unreachable() ··· 302 293 return (void *)((unsigned long)off + *off); 303 294 } 304 295 305 - #else /* __ASSEMBLY__ */ 306 - 307 - #ifdef __KERNEL__ 308 - #ifndef LINKER_SCRIPT 309 - 310 - #ifdef CONFIG_STACK_VALIDATION 311 - .macro ANNOTATE_UNREACHABLE counter:req 312 - \counter: 313 - .pushsection .discard.unreachable 314 - .long \counter\()b -. 315 - .popsection 316 - .endm 317 - 318 - .macro ANNOTATE_REACHABLE counter:req 319 - \counter: 320 - .pushsection .discard.reachable 321 - .long \counter\()b -. 322 - .popsection 323 - .endm 324 - 325 - .macro ASM_UNREACHABLE 326 - 999: 327 - .pushsection .discard.unreachable 328 - .long 999b - . 329 - .popsection 330 - .endm 331 - #else /* CONFIG_STACK_VALIDATION */ 332 - .macro ANNOTATE_UNREACHABLE counter:req 333 - .endm 334 - 335 - .macro ANNOTATE_REACHABLE counter:req 336 - .endm 337 - 338 - .macro ASM_UNREACHABLE 339 - .endm 340 - #endif /* CONFIG_STACK_VALIDATION */ 341 - 342 - #endif /* LINKER_SCRIPT */ 343 - #endif /* __KERNEL__ */ 344 296 #endif /* __ASSEMBLY__ */ 345 297 346 298 /* Compile time object size, -1 for unknown */
+1 -3
scripts/Kbuild.include
··· 115 115 116 116 # Do not attempt to build with gcc plugins during cc-option tests. 117 117 # (And this uses delayed resolution so the flags will be up to date.) 118 - # In addition, do not include the asm macros which are built later. 119 - CC_OPTION_FILTERED = $(GCC_PLUGINS_CFLAGS) $(ASM_MACRO_FLAGS) 120 - CC_OPTION_CFLAGS = $(filter-out $(CC_OPTION_FILTERED),$(KBUILD_CFLAGS)) 118 + CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) 121 119 122 120 # cc-option 123 121 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
-2
scripts/mod/Makefile
··· 4 4 hostprogs-y := modpost mk_elfconfig 5 5 always := $(hostprogs-y) empty.o 6 6 7 - CFLAGS_REMOVE_empty.o := $(ASM_MACRO_FLAGS) 8 - 9 7 modpost-objs := modpost.o file2alias.o sumversion.o 10 8 11 9 devicetable-offsets-file := devicetable-offsets.h