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 tag 'xsa465+xsa466-6.13-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
"Fix xen netfront crash (XSA-465) and avoid using the hypercall page
that doesn't do speculation mitigations (XSA-466)"

* tag 'xsa465+xsa466-6.13-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
x86/xen: remove hypercall page
x86/xen: use new hypercall functions instead of hypercall page
x86/xen: add central hypercall functions
x86/xen: don't do PV iret hypercall through hypercall page
x86/static-call: provide a way to do very early static-call updates
objtool/x86: allow syscall instruction
x86: make get_cpu_vendor() accessible from Xen code
xen/netfront: fix crash when removing device

+317 -109
+2
arch/x86/include/asm/processor.h
··· 230 230 return BIT_ULL(boot_cpu_data.x86_cache_bits - 1 - PAGE_SHIFT); 231 231 } 232 232 233 + void init_cpu_devs(void); 234 + void get_cpu_vendor(struct cpuinfo_x86 *c); 233 235 extern void early_cpu_init(void); 234 236 extern void identify_secondary_cpu(struct cpuinfo_x86 *); 235 237 extern void print_cpu_info(struct cpuinfo_x86 *);
+15
arch/x86/include/asm/static_call.h
··· 65 65 66 66 extern bool __static_call_fixup(void *tramp, u8 op, void *dest); 67 67 68 + extern void __static_call_update_early(void *tramp, void *func); 69 + 70 + #define static_call_update_early(name, _func) \ 71 + ({ \ 72 + typeof(&STATIC_CALL_TRAMP(name)) __F = (_func); \ 73 + if (static_call_initialized) { \ 74 + __static_call_update(&STATIC_CALL_KEY(name), \ 75 + STATIC_CALL_TRAMP_ADDR(name), __F);\ 76 + } else { \ 77 + WRITE_ONCE(STATIC_CALL_KEY(name).func, _func); \ 78 + __static_call_update_early(STATIC_CALL_TRAMP_ADDR(name),\ 79 + __F); \ 80 + } \ 81 + }) 82 + 68 83 #endif /* _ASM_STATIC_CALL_H */
+3 -3
arch/x86/include/asm/sync_core.h
··· 8 8 #include <asm/special_insns.h> 9 9 10 10 #ifdef CONFIG_X86_32 11 - static inline void iret_to_self(void) 11 + static __always_inline void iret_to_self(void) 12 12 { 13 13 asm volatile ( 14 14 "pushfl\n\t" ··· 19 19 : ASM_CALL_CONSTRAINT : : "memory"); 20 20 } 21 21 #else 22 - static inline void iret_to_self(void) 22 + static __always_inline void iret_to_self(void) 23 23 { 24 24 unsigned int tmp; 25 25 ··· 55 55 * Like all of Linux's memory ordering operations, this is a 56 56 * compiler barrier as well. 57 57 */ 58 - static inline void sync_core(void) 58 + static __always_inline void sync_core(void) 59 59 { 60 60 /* 61 61 * The SERIALIZE instruction is the most straightforward way to
+22 -14
arch/x86/include/asm/xen/hypercall.h
··· 39 39 #include <linux/string.h> 40 40 #include <linux/types.h> 41 41 #include <linux/pgtable.h> 42 + #include <linux/instrumentation.h> 42 43 43 44 #include <trace/events/xen.h> 44 45 46 + #include <asm/alternative.h> 45 47 #include <asm/page.h> 46 48 #include <asm/smap.h> 47 49 #include <asm/nospec-branch.h> ··· 88 86 * there aren't more than 5 arguments...) 89 87 */ 90 88 91 - extern struct { char _entry[32]; } hypercall_page[]; 89 + void xen_hypercall_func(void); 90 + DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func); 92 91 93 - #define __HYPERCALL "call hypercall_page+%c[offset]" 94 - #define __HYPERCALL_ENTRY(x) \ 95 - [offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0])) 92 + #ifdef MODULE 93 + #define __ADDRESSABLE_xen_hypercall 94 + #else 95 + #define __ADDRESSABLE_xen_hypercall __ADDRESSABLE_ASM_STR(__SCK__xen_hypercall) 96 + #endif 97 + 98 + #define __HYPERCALL \ 99 + __ADDRESSABLE_xen_hypercall \ 100 + "call __SCT__xen_hypercall" 101 + 102 + #define __HYPERCALL_ENTRY(x) "a" (x) 96 103 97 104 #ifdef CONFIG_X86_32 98 105 #define __HYPERCALL_RETREG "eax" ··· 159 148 __HYPERCALL_0ARG(); \ 160 149 asm volatile (__HYPERCALL \ 161 150 : __HYPERCALL_0PARAM \ 162 - : __HYPERCALL_ENTRY(name) \ 151 + : __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \ 163 152 : __HYPERCALL_CLOBBER0); \ 164 153 (type)__res; \ 165 154 }) ··· 170 159 __HYPERCALL_1ARG(a1); \ 171 160 asm volatile (__HYPERCALL \ 172 161 : __HYPERCALL_1PARAM \ 173 - : __HYPERCALL_ENTRY(name) \ 162 + : __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \ 174 163 : __HYPERCALL_CLOBBER1); \ 175 164 (type)__res; \ 176 165 }) ··· 181 170 __HYPERCALL_2ARG(a1, a2); \ 182 171 asm volatile (__HYPERCALL \ 183 172 : __HYPERCALL_2PARAM \ 184 - : __HYPERCALL_ENTRY(name) \ 173 + : __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \ 185 174 : __HYPERCALL_CLOBBER2); \ 186 175 (type)__res; \ 187 176 }) ··· 192 181 __HYPERCALL_3ARG(a1, a2, a3); \ 193 182 asm volatile (__HYPERCALL \ 194 183 : __HYPERCALL_3PARAM \ 195 - : __HYPERCALL_ENTRY(name) \ 184 + : __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \ 196 185 : __HYPERCALL_CLOBBER3); \ 197 186 (type)__res; \ 198 187 }) ··· 203 192 __HYPERCALL_4ARG(a1, a2, a3, a4); \ 204 193 asm volatile (__HYPERCALL \ 205 194 : __HYPERCALL_4PARAM \ 206 - : __HYPERCALL_ENTRY(name) \ 195 + : __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \ 207 196 : __HYPERCALL_CLOBBER4); \ 208 197 (type)__res; \ 209 198 }) ··· 217 206 __HYPERCALL_DECLS; 218 207 __HYPERCALL_5ARG(a1, a2, a3, a4, a5); 219 208 220 - if (call >= PAGE_SIZE / sizeof(hypercall_page[0])) 221 - return -EINVAL; 222 - 223 - asm volatile(CALL_NOSPEC 209 + asm volatile(__HYPERCALL 224 210 : __HYPERCALL_5PARAM 225 - : [thunk_target] "a" (&hypercall_page[call]) 211 + : __HYPERCALL_ENTRY(call) 226 212 : __HYPERCALL_CLOBBER5); 227 213 228 214 return (long)__res;
-5
arch/x86/kernel/callthunks.c
··· 143 143 dest < (void*)relocate_kernel + KEXEC_CONTROL_CODE_MAX_SIZE) 144 144 return true; 145 145 #endif 146 - #ifdef CONFIG_XEN 147 - if (dest >= (void *)hypercall_page && 148 - dest < (void*)hypercall_page + PAGE_SIZE) 149 - return true; 150 - #endif 151 146 return false; 152 147 } 153 148
+22 -16
arch/x86/kernel/cpu/common.c
··· 867 867 tlb_lld_4m[ENTRIES], tlb_lld_1g[ENTRIES]); 868 868 } 869 869 870 - static void get_cpu_vendor(struct cpuinfo_x86 *c) 870 + void get_cpu_vendor(struct cpuinfo_x86 *c) 871 871 { 872 872 char *v = c->x86_vendor_id; 873 873 int i; ··· 1649 1649 detect_nopl(); 1650 1650 } 1651 1651 1652 - void __init early_cpu_init(void) 1652 + void __init init_cpu_devs(void) 1653 1653 { 1654 1654 const struct cpu_dev *const *cdev; 1655 1655 int count = 0; 1656 - 1657 - #ifdef CONFIG_PROCESSOR_SELECT 1658 - pr_info("KERNEL supported cpus:\n"); 1659 - #endif 1660 1656 1661 1657 for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) { 1662 1658 const struct cpu_dev *cpudev = *cdev; ··· 1661 1665 break; 1662 1666 cpu_devs[count] = cpudev; 1663 1667 count++; 1668 + } 1669 + } 1670 + 1671 + void __init early_cpu_init(void) 1672 + { 1673 + #ifdef CONFIG_PROCESSOR_SELECT 1674 + unsigned int i, j; 1675 + 1676 + pr_info("KERNEL supported cpus:\n"); 1677 + #endif 1678 + 1679 + init_cpu_devs(); 1664 1680 1665 1681 #ifdef CONFIG_PROCESSOR_SELECT 1666 - { 1667 - unsigned int j; 1668 - 1669 - for (j = 0; j < 2; j++) { 1670 - if (!cpudev->c_ident[j]) 1671 - continue; 1672 - pr_info(" %s %s\n", cpudev->c_vendor, 1673 - cpudev->c_ident[j]); 1674 - } 1682 + for (i = 0; i < X86_VENDOR_NUM && cpu_devs[i]; i++) { 1683 + for (j = 0; j < 2; j++) { 1684 + if (!cpu_devs[i]->c_ident[j]) 1685 + continue; 1686 + pr_info(" %s %s\n", cpu_devs[i]->c_vendor, 1687 + cpu_devs[i]->c_ident[j]); 1675 1688 } 1676 - #endif 1677 1689 } 1690 + #endif 1691 + 1678 1692 early_identify_cpu(&boot_cpu_data); 1679 1693 } 1680 1694
+9
arch/x86/kernel/static_call.c
··· 172 172 } 173 173 EXPORT_SYMBOL_GPL(arch_static_call_transform); 174 174 175 + noinstr void __static_call_update_early(void *tramp, void *func) 176 + { 177 + BUG_ON(system_state != SYSTEM_BOOTING); 178 + BUG_ON(!early_boot_irqs_disabled); 179 + BUG_ON(static_call_initialized); 180 + __text_gen_insn(tramp, JMP32_INSN_OPCODE, tramp, func, JMP32_INSN_SIZE); 181 + sync_core(); 182 + } 183 + 175 184 #ifdef CONFIG_MITIGATION_RETHUNK 176 185 /* 177 186 * This is called by apply_returns() to fix up static call trampolines,
-4
arch/x86/kernel/vmlinux.lds.S
··· 519 519 * linker will never mark as relocatable. (Using just ABSOLUTE() is not 520 520 * sufficient for that). 521 521 */ 522 - #ifdef CONFIG_XEN 523 522 #ifdef CONFIG_XEN_PV 524 523 xen_elfnote_entry_value = 525 524 ABSOLUTE(xen_elfnote_entry) + ABSOLUTE(startup_xen); 526 - #endif 527 - xen_elfnote_hypercall_page_value = 528 - ABSOLUTE(xen_elfnote_hypercall_page) + ABSOLUTE(hypercall_page); 529 525 #endif 530 526 #ifdef CONFIG_PVH 531 527 xen_elfnote_phys32_entry_value =
+64 -1
arch/x86/xen/enlighten.c
··· 2 2 3 3 #include <linux/console.h> 4 4 #include <linux/cpu.h> 5 + #include <linux/instrumentation.h> 5 6 #include <linux/kexec.h> 6 7 #include <linux/memblock.h> 7 8 #include <linux/slab.h> ··· 22 21 23 22 #include "xen-ops.h" 24 23 25 - EXPORT_SYMBOL_GPL(hypercall_page); 24 + DEFINE_STATIC_CALL(xen_hypercall, xen_hypercall_hvm); 25 + EXPORT_STATIC_CALL_TRAMP(xen_hypercall); 26 26 27 27 /* 28 28 * Pointer to the xen_vcpu_info structure or ··· 69 67 * page as soon as fixmap is up and running. 70 68 */ 71 69 struct shared_info *HYPERVISOR_shared_info = &xen_dummy_shared_info; 70 + 71 + static __ref void xen_get_vendor(void) 72 + { 73 + init_cpu_devs(); 74 + cpu_detect(&boot_cpu_data); 75 + get_cpu_vendor(&boot_cpu_data); 76 + } 77 + 78 + void xen_hypercall_setfunc(void) 79 + { 80 + if (static_call_query(xen_hypercall) != xen_hypercall_hvm) 81 + return; 82 + 83 + if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD || 84 + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) 85 + static_call_update(xen_hypercall, xen_hypercall_amd); 86 + else 87 + static_call_update(xen_hypercall, xen_hypercall_intel); 88 + } 89 + 90 + /* 91 + * Evaluate processor vendor in order to select the correct hypercall 92 + * function for HVM/PVH guests. 93 + * Might be called very early in boot before vendor has been set by 94 + * early_cpu_init(). 95 + */ 96 + noinstr void *__xen_hypercall_setfunc(void) 97 + { 98 + void (*func)(void); 99 + 100 + /* 101 + * Xen is supported only on CPUs with CPUID, so testing for 102 + * X86_FEATURE_CPUID is a test for early_cpu_init() having been 103 + * run. 104 + * 105 + * Note that __xen_hypercall_setfunc() is noinstr only due to a nasty 106 + * dependency chain: it is being called via the xen_hypercall static 107 + * call when running as a PVH or HVM guest. Hypercalls need to be 108 + * noinstr due to PV guests using hypercalls in noinstr code. So we 109 + * can safely tag the function body as "instrumentation ok", since 110 + * the PV guest requirement is not of interest here (xen_get_vendor() 111 + * calls noinstr functions, and static_call_update_early() might do 112 + * so, too). 113 + */ 114 + instrumentation_begin(); 115 + 116 + if (!boot_cpu_has(X86_FEATURE_CPUID)) 117 + xen_get_vendor(); 118 + 119 + if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD || 120 + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)) 121 + func = xen_hypercall_amd; 122 + else 123 + func = xen_hypercall_intel; 124 + 125 + static_call_update_early(xen_hypercall, func); 126 + 127 + instrumentation_end(); 128 + 129 + return func; 130 + } 72 131 73 132 static int xen_cpu_up_online(unsigned int cpu) 74 133 {
+5 -8
arch/x86/xen/enlighten_hvm.c
··· 106 106 /* PVH set up hypercall page in xen_prepare_pvh(). */ 107 107 if (xen_pvh_domain()) 108 108 pv_info.name = "Xen PVH"; 109 - else { 110 - u64 pfn; 111 - uint32_t msr; 112 - 109 + else 113 110 pv_info.name = "Xen HVM"; 114 - msr = cpuid_ebx(base + 2); 115 - pfn = __pa(hypercall_page); 116 - wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); 117 - } 118 111 119 112 xen_setup_features(); 120 113 ··· 292 299 293 300 if (xen_pv_domain()) 294 301 return 0; 302 + 303 + /* Set correct hypercall function. */ 304 + if (xen_domain) 305 + xen_hypercall_setfunc(); 295 306 296 307 if (xen_pvh_domain() && nopv) { 297 308 /* Guest booting via the Xen-PVH boot entry goes here */
+3 -1
arch/x86/xen/enlighten_pv.c
··· 1341 1341 1342 1342 xen_domain_type = XEN_PV_DOMAIN; 1343 1343 xen_start_flags = xen_start_info->flags; 1344 + /* Interrupts are guaranteed to be off initially. */ 1345 + early_boot_irqs_disabled = true; 1346 + static_call_update_early(xen_hypercall, xen_hypercall_pv); 1344 1347 1345 1348 xen_setup_features(); 1346 1349 ··· 1434 1431 WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_pv, xen_cpu_dead_pv)); 1435 1432 1436 1433 local_irq_disable(); 1437 - early_boot_irqs_disabled = true; 1438 1434 1439 1435 xen_raw_console_write("mapping kernel into physical memory\n"); 1440 1436 xen_setup_kernel_pagetable((pgd_t *)xen_start_info->pt_base,
-7
arch/x86/xen/enlighten_pvh.c
··· 129 129 130 130 void __init xen_pvh_init(struct boot_params *boot_params) 131 131 { 132 - u32 msr; 133 - u64 pfn; 134 - 135 132 xen_pvh = 1; 136 133 xen_domain_type = XEN_HVM_DOMAIN; 137 134 xen_start_flags = pvh_start_info.flags; 138 - 139 - msr = cpuid_ebx(xen_cpuid_base() + 2); 140 - pfn = __pa(hypercall_page); 141 - wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); 142 135 143 136 x86_init.oem.arch_setup = pvh_arch_setup; 144 137 x86_init.oem.banner = xen_banner;
+41 -9
arch/x86/xen/xen-asm.S
··· 20 20 21 21 #include <linux/init.h> 22 22 #include <linux/linkage.h> 23 + #include <linux/objtool.h> 23 24 #include <../entry/calling.h> 24 25 25 26 .pushsection .noinstr.text, "ax" 27 + /* 28 + * PV hypercall interface to the hypervisor. 29 + * 30 + * Called via inline asm(), so better preserve %rcx and %r11. 31 + * 32 + * Input: 33 + * %eax: hypercall number 34 + * %rdi, %rsi, %rdx, %r10, %r8: args 1..5 for the hypercall 35 + * Output: %rax 36 + */ 37 + SYM_FUNC_START(xen_hypercall_pv) 38 + ANNOTATE_NOENDBR 39 + push %rcx 40 + push %r11 41 + UNWIND_HINT_SAVE 42 + syscall 43 + UNWIND_HINT_RESTORE 44 + pop %r11 45 + pop %rcx 46 + RET 47 + SYM_FUNC_END(xen_hypercall_pv) 48 + 26 49 /* 27 50 * Disabling events is simply a matter of making the event mask 28 51 * non-zero. ··· 199 176 SYM_CODE_END(xen_early_idt_handler_array) 200 177 __FINIT 201 178 202 - hypercall_iret = hypercall_page + __HYPERVISOR_iret * 32 203 179 /* 204 180 * Xen64 iret frame: 205 181 * ··· 208 186 * cs 209 187 * rip <-- standard iret frame 210 188 * 211 - * flags 189 + * flags <-- xen_iret must push from here on 212 190 * 213 - * rcx } 214 - * r11 }<-- pushed by hypercall page 215 - * rsp->rax } 191 + * rcx 192 + * r11 193 + * rsp->rax 216 194 */ 195 + .macro xen_hypercall_iret 196 + pushq $0 /* Flags */ 197 + push %rcx 198 + push %r11 199 + push %rax 200 + mov $__HYPERVISOR_iret, %eax 201 + syscall /* Do the IRET. */ 202 + #ifdef CONFIG_MITIGATION_SLS 203 + int3 204 + #endif 205 + .endm 206 + 217 207 SYM_CODE_START(xen_iret) 218 208 UNWIND_HINT_UNDEFINED 219 209 ANNOTATE_NOENDBR 220 - pushq $0 221 - jmp hypercall_iret 210 + xen_hypercall_iret 222 211 SYM_CODE_END(xen_iret) 223 212 224 213 /* ··· 334 301 ENDBR 335 302 lea 16(%rsp), %rsp /* strip %rcx, %r11 */ 336 303 mov $-ENOSYS, %rax 337 - pushq $0 338 - jmp hypercall_iret 304 + xen_hypercall_iret 339 305 SYM_CODE_END(xen_entry_SYSENTER_compat) 340 306 SYM_CODE_END(xen_entry_SYSCALL_compat) 341 307
+83 -24
arch/x86/xen/xen-head.S
··· 6 6 7 7 #include <linux/elfnote.h> 8 8 #include <linux/init.h> 9 + #include <linux/instrumentation.h> 9 10 10 11 #include <asm/boot.h> 11 12 #include <asm/asm.h> 13 + #include <asm/frame.h> 12 14 #include <asm/msr.h> 13 15 #include <asm/page_types.h> 14 16 #include <asm/percpu.h> ··· 21 19 #include <xen/interface/xen.h> 22 20 #include <xen/interface/xen-mca.h> 23 21 #include <asm/xen/interface.h> 24 - 25 - .pushsection .noinstr.text, "ax" 26 - .balign PAGE_SIZE 27 - SYM_CODE_START(hypercall_page) 28 - .rept (PAGE_SIZE / 32) 29 - UNWIND_HINT_FUNC 30 - ANNOTATE_NOENDBR 31 - ANNOTATE_UNRET_SAFE 32 - ret 33 - /* 34 - * Xen will write the hypercall page, and sort out ENDBR. 35 - */ 36 - .skip 31, 0xcc 37 - .endr 38 - 39 - #define HYPERCALL(n) \ 40 - .equ xen_hypercall_##n, hypercall_page + __HYPERVISOR_##n * 32; \ 41 - .type xen_hypercall_##n, @function; .size xen_hypercall_##n, 32 42 - #include <asm/xen-hypercalls.h> 43 - #undef HYPERCALL 44 - SYM_CODE_END(hypercall_page) 45 - .popsection 46 22 47 23 #ifdef CONFIG_XEN_PV 48 24 __INIT ··· 67 87 #endif 68 88 #endif 69 89 90 + .pushsection .noinstr.text, "ax" 91 + /* 92 + * Xen hypercall interface to the hypervisor. 93 + * 94 + * Input: 95 + * %eax: hypercall number 96 + * 32-bit: 97 + * %ebx, %ecx, %edx, %esi, %edi: args 1..5 for the hypercall 98 + * 64-bit: 99 + * %rdi, %rsi, %rdx, %r10, %r8: args 1..5 for the hypercall 100 + * Output: %[er]ax 101 + */ 102 + SYM_FUNC_START(xen_hypercall_hvm) 103 + ENDBR 104 + FRAME_BEGIN 105 + /* Save all relevant registers (caller save and arguments). */ 106 + #ifdef CONFIG_X86_32 107 + push %eax 108 + push %ebx 109 + push %ecx 110 + push %edx 111 + push %esi 112 + push %edi 113 + #else 114 + push %rax 115 + push %rcx 116 + push %rdx 117 + push %rdi 118 + push %rsi 119 + push %r11 120 + push %r10 121 + push %r9 122 + push %r8 123 + #ifdef CONFIG_FRAME_POINTER 124 + pushq $0 /* Dummy push for stack alignment. */ 125 + #endif 126 + #endif 127 + /* Set the vendor specific function. */ 128 + call __xen_hypercall_setfunc 129 + /* Set ZF = 1 if AMD, Restore saved registers. */ 130 + #ifdef CONFIG_X86_32 131 + lea xen_hypercall_amd, %ebx 132 + cmp %eax, %ebx 133 + pop %edi 134 + pop %esi 135 + pop %edx 136 + pop %ecx 137 + pop %ebx 138 + pop %eax 139 + #else 140 + lea xen_hypercall_amd(%rip), %rbx 141 + cmp %rax, %rbx 142 + #ifdef CONFIG_FRAME_POINTER 143 + pop %rax /* Dummy pop. */ 144 + #endif 145 + pop %r8 146 + pop %r9 147 + pop %r10 148 + pop %r11 149 + pop %rsi 150 + pop %rdi 151 + pop %rdx 152 + pop %rcx 153 + pop %rax 154 + #endif 155 + /* Use correct hypercall function. */ 156 + jz xen_hypercall_amd 157 + jmp xen_hypercall_intel 158 + SYM_FUNC_END(xen_hypercall_hvm) 159 + 160 + SYM_FUNC_START(xen_hypercall_amd) 161 + vmmcall 162 + RET 163 + SYM_FUNC_END(xen_hypercall_amd) 164 + 165 + SYM_FUNC_START(xen_hypercall_intel) 166 + vmcall 167 + RET 168 + SYM_FUNC_END(xen_hypercall_intel) 169 + .popsection 170 + 70 171 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") 71 172 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") 72 173 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") ··· 177 116 #else 178 117 # define FEATURES_DOM0 0 179 118 #endif 180 - ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .globl xen_elfnote_hypercall_page; 181 - xen_elfnote_hypercall_page: _ASM_PTR xen_elfnote_hypercall_page_value - .) 182 119 ELFNOTE(Xen, XEN_ELFNOTE_SUPPORTED_FEATURES, 183 120 .long FEATURES_PV | FEATURES_PVH | FEATURES_DOM0) 184 121 ELFNOTE(Xen, XEN_ELFNOTE_LOADER, .asciz "generic")
+9
arch/x86/xen/xen-ops.h
··· 326 326 static inline void xen_smp_count_cpus(void) { } 327 327 #endif /* CONFIG_SMP */ 328 328 329 + #ifdef CONFIG_XEN_PV 330 + void xen_hypercall_pv(void); 331 + #endif 332 + void xen_hypercall_hvm(void); 333 + void xen_hypercall_amd(void); 334 + void xen_hypercall_intel(void); 335 + void xen_hypercall_setfunc(void); 336 + void *__xen_hypercall_setfunc(void); 337 + 329 338 #endif /* XEN_OPS_H */
+4 -1
drivers/net/xen-netfront.c
··· 867 867 static int xennet_close(struct net_device *dev) 868 868 { 869 869 struct netfront_info *np = netdev_priv(dev); 870 - unsigned int num_queues = dev->real_num_tx_queues; 870 + unsigned int num_queues = np->queues ? dev->real_num_tx_queues : 0; 871 871 unsigned int i; 872 872 struct netfront_queue *queue; 873 873 netif_tx_stop_all_queues(np->netdev); ··· 881 881 static void xennet_destroy_queues(struct netfront_info *info) 882 882 { 883 883 unsigned int i; 884 + 885 + if (!info->queues) 886 + return; 884 887 885 888 for (i = 0; i < info->netdev->real_num_tx_queues; i++) { 886 889 struct netfront_queue *queue = &info->queues[i];
+27 -12
include/linux/compiler.h
··· 216 216 217 217 #endif /* __KERNEL__ */ 218 218 219 - /* 220 - * Force the compiler to emit 'sym' as a symbol, so that we can reference 221 - * it from inline assembler. Necessary in case 'sym' could be inlined 222 - * otherwise, or eliminated entirely due to lack of references that are 223 - * visible to the compiler. 224 - */ 225 - #define ___ADDRESSABLE(sym, __attrs) \ 226 - static void * __used __attrs \ 227 - __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym; 228 - #define __ADDRESSABLE(sym) \ 229 - ___ADDRESSABLE(sym, __section(".discard.addressable")) 230 - 231 219 /** 232 220 * offset_to_ptr - convert a relative memory offset to an absolute pointer 233 221 * @off: the address of the 32-bit offset value ··· 226 238 } 227 239 228 240 #endif /* __ASSEMBLY__ */ 241 + 242 + #ifdef CONFIG_64BIT 243 + #define ARCH_SEL(a,b) a 244 + #else 245 + #define ARCH_SEL(a,b) b 246 + #endif 247 + 248 + /* 249 + * Force the compiler to emit 'sym' as a symbol, so that we can reference 250 + * it from inline assembler. Necessary in case 'sym' could be inlined 251 + * otherwise, or eliminated entirely due to lack of references that are 252 + * visible to the compiler. 253 + */ 254 + #define ___ADDRESSABLE(sym, __attrs) \ 255 + static void * __used __attrs \ 256 + __UNIQUE_ID(__PASTE(__addressable_,sym)) = (void *)(uintptr_t)&sym; 257 + 258 + #define __ADDRESSABLE(sym) \ 259 + ___ADDRESSABLE(sym, __section(".discard.addressable")) 260 + 261 + #define __ADDRESSABLE_ASM(sym) \ 262 + .pushsection .discard.addressable,"aw"; \ 263 + .align ARCH_SEL(8,4); \ 264 + ARCH_SEL(.quad, .long) __stringify(sym); \ 265 + .popsection; 266 + 267 + #define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym)) 229 268 230 269 #ifdef __CHECKER__ 231 270 #define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
+1
include/linux/static_call.h
··· 138 138 #ifdef CONFIG_HAVE_STATIC_CALL 139 139 #include <asm/static_call.h> 140 140 141 + extern int static_call_initialized; 141 142 /* 142 143 * Either @site or @tramp can be NULL. 143 144 */
+1 -1
kernel/static_call_inline.c
··· 15 15 extern struct static_call_tramp_key __start_static_call_tramp_key[], 16 16 __stop_static_call_tramp_key[]; 17 17 18 - static int static_call_initialized; 18 + int static_call_initialized; 19 19 20 20 /* 21 21 * Must be called before early_initcall() to be effective.
+6 -3
tools/objtool/check.c
··· 3820 3820 break; 3821 3821 3822 3822 case INSN_CONTEXT_SWITCH: 3823 - if (func && (!next_insn || !next_insn->hint)) { 3824 - WARN_INSN(insn, "unsupported instruction in callable function"); 3825 - return 1; 3823 + if (func) { 3824 + if (!next_insn || !next_insn->hint) { 3825 + WARN_INSN(insn, "unsupported instruction in callable function"); 3826 + return 1; 3827 + } 3828 + break; 3826 3829 } 3827 3830 return 0; 3828 3831