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:
- misc fixes all around the map
- block non-root vm86(old) if mmap_min_addr != 0
- two small debuggability improvements
- removal of obsolete paravirt op

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/platform: Fix Geode LX timekeeping in the generic x86 build
x86/apic: Serialize LVTT and TSC_DEADLINE writes
x86/ioapic: Force affinity setting in setup_ioapic_dest()
x86/paravirt: Remove the unused pv_time_ops::get_tsc_khz method
x86/ldt: Fix small LDT allocation for Xen
x86/vm86: Fix the misleading CONFIG_VM86 Kconfig help text
x86/cpu: Print family/model/stepping in hex
x86/vm86: Block non-root vm86(old) if mmap_min_addr != 0
x86/alternatives: Make optimize_nops() interrupt safe and synced
x86/mm/srat: Print non-volatile flag in SRAT
x86/cpufeatures: Enable cpuid for Intel SHA extensions

+75 -29
+12 -11
arch/x86/Kconfig
··· 1006 1006 depends on X86_MCE_INTEL 1007 1007 1008 1008 config X86_LEGACY_VM86 1009 - bool "Legacy VM86 support (obsolete)" 1009 + bool "Legacy VM86 support" 1010 1010 default n 1011 1011 depends on X86_32 1012 1012 ---help--- ··· 1018 1018 available to accelerate real mode DOS programs. However, any 1019 1019 recent version of DOSEMU, X, or vbetool should be fully 1020 1020 functional even without kernel VM86 support, as they will all 1021 - fall back to (pretty well performing) software emulation. 1021 + fall back to software emulation. Nevertheless, if you are using 1022 + a 16-bit DOS program where 16-bit performance matters, vm86 1023 + mode might be faster than emulation and you might want to 1024 + enable this option. 1022 1025 1023 - Anything that works on a 64-bit kernel is unlikely to need 1024 - this option, as 64-bit kernels don't, and can't, support V8086 1025 - mode. This option is also unrelated to 16-bit protected mode 1026 - and is not needed to run most 16-bit programs under Wine. 1026 + Note that any app that works on a 64-bit kernel is unlikely to 1027 + need this option, as 64-bit kernels don't, and can't, support 1028 + V8086 mode. This option is also unrelated to 16-bit protected 1029 + mode and is not needed to run most 16-bit programs under Wine. 1027 1030 1028 - Enabling this option adds considerable attack surface to the 1029 - kernel and slows down system calls and exception handling. 1031 + Enabling this option increases the complexity of the kernel 1032 + and slows down exception handling a tiny bit. 1030 1033 1031 - Unless you use very old userspace or need the last drop of 1032 - performance in your real mode DOS games and can't use KVM, 1033 - say N here. 1034 + If unsure, say N here. 1034 1035 1035 1036 config VM86 1036 1037 bool
+1
arch/x86/include/asm/cpufeature.h
··· 241 241 #define X86_FEATURE_AVX512PF ( 9*32+26) /* AVX-512 Prefetch */ 242 242 #define X86_FEATURE_AVX512ER ( 9*32+27) /* AVX-512 Exponential and Reciprocal */ 243 243 #define X86_FEATURE_AVX512CD ( 9*32+28) /* AVX-512 Conflict Detection */ 244 + #define X86_FEATURE_SHA_NI ( 9*32+29) /* SHA1/SHA256 Instruction Extensions */ 244 245 245 246 /* Extended state features, CPUID level 0x0000000d:1 (eax), word 10 */ 246 247 #define X86_FEATURE_XSAVEOPT (10*32+ 0) /* XSAVEOPT */
-1
arch/x86/include/asm/paravirt_types.h
··· 97 97 struct pv_time_ops { 98 98 unsigned long long (*sched_clock)(void); 99 99 unsigned long long (*steal_clock)(int cpu); 100 - unsigned long (*get_tsc_khz)(void); 101 100 }; 102 101 103 102 struct pv_cpu_ops {
+5
arch/x86/kernel/alternative.c
··· 338 338 339 339 static void __init_or_module optimize_nops(struct alt_instr *a, u8 *instr) 340 340 { 341 + unsigned long flags; 342 + 341 343 if (instr[0] != 0x90) 342 344 return; 343 345 346 + local_irq_save(flags); 344 347 add_nops(instr + (a->instrlen - a->padlen), a->padlen); 348 + sync_core(); 349 + local_irq_restore(flags); 345 350 346 351 DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ", 347 352 instr, a->instrlen - a->padlen, a->padlen);
+7
arch/x86/kernel/apic/apic.c
··· 336 336 apic_write(APIC_LVTT, lvtt_value); 337 337 338 338 if (lvtt_value & APIC_LVT_TIMER_TSCDEADLINE) { 339 + /* 340 + * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, 341 + * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized. 342 + * According to Intel, MFENCE can do the serialization here. 343 + */ 344 + asm volatile("mfence" : : : "memory"); 345 + 339 346 printk_once(KERN_DEBUG "TSC deadline timer enabled\n"); 340 347 return; 341 348 }
+3 -2
arch/x86/kernel/apic/io_apic.c
··· 2522 2522 int pin, ioapic, irq, irq_entry; 2523 2523 const struct cpumask *mask; 2524 2524 struct irq_data *idata; 2525 + struct irq_chip *chip; 2525 2526 2526 2527 if (skip_ioapic_setup == 1) 2527 2528 return; ··· 2546 2545 else 2547 2546 mask = apic->target_cpus(); 2548 2547 2549 - irq_set_affinity(irq, mask); 2548 + chip = irq_data_get_irq_chip(idata); 2549 + chip->irq_set_affinity(idata, mask, false); 2550 2550 } 2551 - 2552 2551 } 2553 2552 #endif 2554 2553
+2 -2
arch/x86/kernel/cpu/common.c
··· 1110 1110 else 1111 1111 printk(KERN_CONT "%d86", c->x86); 1112 1112 1113 - printk(KERN_CONT " (fam: %02x, model: %02x", c->x86, c->x86_model); 1113 + printk(KERN_CONT " (family: 0x%x, model: 0x%x", c->x86, c->x86_model); 1114 1114 1115 1115 if (c->x86_mask || c->cpuid_level >= 0) 1116 - printk(KERN_CONT ", stepping: %02x)\n", c->x86_mask); 1116 + printk(KERN_CONT ", stepping: 0x%x)\n", c->x86_mask); 1117 1117 else 1118 1118 printk(KERN_CONT ")\n"); 1119 1119
+2 -2
arch/x86/kernel/ldt.c
··· 58 58 if (alloc_size > PAGE_SIZE) 59 59 new_ldt->entries = vzalloc(alloc_size); 60 60 else 61 - new_ldt->entries = kzalloc(PAGE_SIZE, GFP_KERNEL); 61 + new_ldt->entries = (void *)get_zeroed_page(GFP_KERNEL); 62 62 63 63 if (!new_ldt->entries) { 64 64 kfree(new_ldt); ··· 95 95 if (ldt->size * LDT_ENTRY_SIZE > PAGE_SIZE) 96 96 vfree(ldt->entries); 97 97 else 98 - kfree(ldt->entries); 98 + free_page((unsigned long)ldt->entries); 99 99 kfree(ldt); 100 100 } 101 101
+10 -7
arch/x86/kernel/tsc.c
··· 21 21 #include <asm/hypervisor.h> 22 22 #include <asm/nmi.h> 23 23 #include <asm/x86_init.h> 24 + #include <asm/geode.h> 24 25 25 26 unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ 26 27 EXPORT_SYMBOL(cpu_khz); ··· 1014 1013 1015 1014 static void __init check_system_tsc_reliable(void) 1016 1015 { 1017 - #ifdef CONFIG_MGEODE_LX 1018 - /* RTSC counts during suspend */ 1016 + #if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || defined(CONFIG_X86_GENERIC) 1017 + if (is_geode_lx()) { 1018 + /* RTSC counts during suspend */ 1019 1019 #define RTSC_SUSP 0x100 1020 - unsigned long res_low, res_high; 1020 + unsigned long res_low, res_high; 1021 1021 1022 - rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); 1023 - /* Geode_LX - the OLPC CPU has a very reliable TSC */ 1024 - if (res_low & RTSC_SUSP) 1025 - tsc_clocksource_reliable = 1; 1022 + rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); 1023 + /* Geode_LX - the OLPC CPU has a very reliable TSC */ 1024 + if (res_low & RTSC_SUSP) 1025 + tsc_clocksource_reliable = 1; 1026 + } 1026 1027 #endif 1027 1028 if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) 1028 1029 tsc_clocksource_reliable = 1;
+27
arch/x86/kernel/vm86_32.c
··· 45 45 #include <linux/audit.h> 46 46 #include <linux/stddef.h> 47 47 #include <linux/slab.h> 48 + #include <linux/security.h> 48 49 49 50 #include <asm/uaccess.h> 50 51 #include <asm/io.h> ··· 232 231 struct kernel_vm86_regs vm86regs; 233 232 struct pt_regs *regs = current_pt_regs(); 234 233 unsigned long err = 0; 234 + 235 + err = security_mmap_addr(0); 236 + if (err) { 237 + /* 238 + * vm86 cannot virtualize the address space, so vm86 users 239 + * need to manage the low 1MB themselves using mmap. Given 240 + * that BIOS places important data in the first page, vm86 241 + * is essentially useless if mmap_min_addr != 0. DOSEMU, 242 + * for example, won't even bother trying to use vm86 if it 243 + * can't map a page at virtual address 0. 244 + * 245 + * To reduce the available kernel attack surface, simply 246 + * disallow vm86(old) for users who cannot mmap at va 0. 247 + * 248 + * The implementation of security_mmap_addr will allow 249 + * suitably privileged users to map va 0 even if 250 + * vm.mmap_min_addr is set above 0, and we want this 251 + * behavior for vm86 as well, as it ensures that legacy 252 + * tools like vbetool will not fail just because of 253 + * vm.mmap_min_addr. 254 + */ 255 + pr_info_once("Denied a call to vm86(old) from %s[%d] (uid: %d). Set the vm.mmap_min_addr sysctl to 0 and/or adjust LSM mmap_min_addr policy to enable vm86 if you are using a vm86-based DOS emulator.\n", 256 + current->comm, task_pid_nr(current), 257 + from_kuid_munged(&init_user_ns, current_uid())); 258 + return -EPERM; 259 + } 235 260 236 261 if (!vm86) { 237 262 if (!(vm86 = kzalloc(sizeof(*vm86), GFP_KERNEL)))
+3 -2
arch/x86/mm/srat.c
··· 192 192 193 193 node_set(node, numa_nodes_parsed); 194 194 195 - pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s\n", 195 + pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", 196 196 node, pxm, 197 197 (unsigned long long) start, (unsigned long long) end - 1, 198 - hotpluggable ? " hotplug" : ""); 198 + hotpluggable ? " hotplug" : "", 199 + ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : ""); 199 200 200 201 /* Mark hotplug range in memblock. */ 201 202 if (hotpluggable && memblock_mark_hotplug(start, ma->length))
+3 -2
tools/testing/selftests/x86/entry_from_vm86.c
··· 116 116 v86->regs.eip = eip; 117 117 ret = vm86(VM86_ENTER, v86); 118 118 119 - if (ret == -1 && errno == ENOSYS) { 120 - printf("[SKIP]\tvm86 not supported\n"); 119 + if (ret == -1 && (errno == ENOSYS || errno == EPERM)) { 120 + printf("[SKIP]\tvm86 %s\n", 121 + errno == ENOSYS ? "not supported" : "not allowed"); 121 122 return false; 122 123 } 123 124