x86 fixes
Subsystems (11)
Linus,
Please pull the latest x86-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus
# HEAD: 12a78d43de767eaf8fb272facb7a7b6f2dc6a9df x86/decoder: Add new TEST instruction pattern
Misc fixes:
- topology enumeration fixes
- KASAN fix
- two entry fixes (not yet the big series related to KASLR)
- remove obsolete code
- instruction decoder fix
- better /dev/mem sanity checks, hopefully working better this time
- pkeys fixes
- two ACPI fixes
- 5-level paging related fixes
- UMIP fixes that should make application visible faults more debuggable
- boot fix for weird virtualization environment
out-of-topic modifications in x86-urgent-for-linus:
-----------------------------------------------------
drivers/pci/Kconfig # fd2fa6c18b72: x86/PCI: Remove unused Hyper drivers/pci/Makefile # fd2fa6c18b72: x86/PCI: Remove unused Hyper drivers/pci/htirq.c # fd2fa6c18b72: x86/PCI: Remove unused Hyper include/linux/htirq.h # fd2fa6c18b72: x86/PCI: Remove unused Hyper include/linux/pci.h # fd2fa6c18b72: x86/PCI: Remove unused Hyper
tools/testing/selftests/x86/5lvl.c # 97f404ad3e53: x86/selftests: Add test for tools/testing/selftests/x86/Makefile# 97f404ad3e53: x86/selftests: Add test for tools/testing/selftests/x86/mpx-hw.h# a6400120d042: x86/mpx/selftests: Fix up we tools/testing/selftests/x86/pkey-helpers.h# 7b659ee3e1fe: x86/pkeys/selftests: Fix pro tools/testing/selftests/x86/protection_keys.c# 91c49c2deb96: x86/pkeys/selftests: Rename
Thanks,
Ingo
------------------>
Andi Kleen (2):
perf/x86/intel/uncore: Cache logical pkg id in uncore driver x86/topology: Avoid wasting 128k for package id array
Andrey Ryabinin (1):
x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
Andy Lutomirski (2):
x86/entry/64: Fix entry_SYSCALL_64_after_hwframe() IRQ tracing x86/entry/64: Add missing irqflags tracing to native_load_gs_index()
Bjorn Helgaas (1):
x86/PCI: Remove unused HyperTransport interrupt support
Borislav Petkov (1):
x86/umip: Fix insn_get_code_seg_params()'s return value
Chao Fan (1):
x86/boot/KASLR: Remove unused variable
Craig Bergstrom (1):
x86/mm: Limit mmap() of /dev/mem to valid physical addresses
Dave Hansen (4):
x86/pkeys: Update documentation about availability x86/mpx/selftests: Fix up weird arrays x86/pkeys/selftests: Rename 'si_pkey' to 'siginfo_pkey' x86/pkeys/selftests: Fix protection keys write() warning
Kirill A. Shutemov (2):
x86/mm: Prevent non-MAP_FIXED mapping across DEFAULT_MAP_WINDOW border x86/selftests: Add test for mapping placement for 5-level paging
Masami Hiramatsu (1):
x86/decoder: Add new TEST instruction pattern
Prarit Bhargava (1):
x86/smpboot: Fix __max_logical_packages estimate
Ricardo Neri (4):
x86/umip: Select X86_INTEL_UMIP by default
x86/umip: Print a line in the boot log that UMIP has been enabled x86/umip: Identify the STR and SLDT instructions
x86/umip: Print a warning into the syslog if UMIP-protected instructions are used
Tom Lendacky (1):
x86/boot: Fix boot failure when SMP MP-table is based at 0
Vikas C Sajjan (2):
x86/acpi: Handle SCI interrupts above legacy space gracefully x86/acpi: Reduce code duplication in mp_override_legacy_irq()
Documentation/x86/protection-keys.txt | 9 +- arch/x86/Kconfig | 14 +- arch/x86/boot/compressed/kaslr.c | 5 +- arch/x86/entry/entry_64.S | 14 +- arch/x86/events/intel/uncore.c | 4 +- arch/x86/events/intel/uncore.h | 2 +- arch/x86/events/intel/uncore_snbep.c | 2 +- arch/x86/include/asm/elf.h | 1 + arch/x86/include/asm/hw_irq.h | 8 -- arch/x86/include/asm/hypertransport.h | 46 ------ arch/x86/include/asm/insn-eval.h | 2 +- arch/x86/include/asm/io.h | 4 + arch/x86/include/asm/irqdomain.h | 6 - arch/x86/include/asm/processor.h | 1 + arch/x86/kernel/acpi/boot.c | 61 +++++--- arch/x86/kernel/apic/Makefile | 1 - arch/x86/kernel/apic/htirq.c | 198 -------------------------- arch/x86/kernel/apic/vector.c | 5 +- arch/x86/kernel/cpu/common.c | 2 + arch/x86/kernel/mpparse.c | 6 +- arch/x86/kernel/smpboot.c | 128 +++++------------ arch/x86/kernel/sys_x86_64.c | 10 +- arch/x86/kernel/umip.c | 88 ++++++++++-- arch/x86/lib/insn-eval.c | 4 +- arch/x86/lib/x86-opcode-map.txt | 2 +- arch/x86/mm/hugetlbpage.c | 11 +- arch/x86/mm/kasan_init_64.c | 143 ++++++++++++++++++- arch/x86/mm/mmap.c | 62 ++++++++ drivers/char/mem.c | 4 + drivers/pci/Kconfig | 9 -- drivers/pci/Makefile | 3 - drivers/pci/htirq.c | 135 ------------------ include/linux/htirq.h | 39 ----- include/linux/pci.h | 6 - tools/testing/selftests/x86/5lvl.c | 177 +++++++++++++++++++++++ tools/testing/selftests/x86/Makefile | 2 +- tools/testing/selftests/x86/mpx-hw.h | 4 +- tools/testing/selftests/x86/pkey-helpers.h | 5 +- tools/testing/selftests/x86/protection_keys.c | 10 +- 39 files changed, 609 insertions(+), 624 deletions(-) delete mode 100644 arch/x86/include/asm/hypertransport.h delete mode 100644 arch/x86/kernel/apic/htirq.c delete mode 100644 drivers/pci/htirq.c delete mode 100644 include/linux/htirq.h create mode 100644 tools/testing/selftests/x86/5lvl.c
Documentation/x86/protection-keys.txt +7 -2
@@ -1,5 +1,10 @@ -Memory Protection Keys for Userspace (PKU aka PKEYs) is a CPU feature -which will be found on future Intel CPUs. +Memory Protection Keys for Userspace (PKU aka PKEYs) is a feature +which is found on Intel's Skylake "Scalable Processor" Server CPUs. +It will be avalable in future non-server parts. + +For anyone wishing to test or use this feature, it is available in +Amazon's EC2 C5 instances and is known to work there using an Ubuntu +17.04 image. Memory Protection Keys provides a mechanism for enforcing page-based protections, but without requiring modification of the page tables
arch/x86/Kconfig +10 -4
@@ -110,7 +110,7 @@ config X86 select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HUGE_VMAP if X86_64 || X86_PAE select HAVE_ARCH_JUMP_LABEL - select HAVE_ARCH_KASAN if X86_64 && SPARSEMEM_VMEMMAP + select HAVE_ARCH_KASAN if X86_64 select HAVE_ARCH_KGDB select HAVE_ARCH_KMEMCHECK select HAVE_ARCH_MMAP_RND_BITS if MMU
@@ -1805,14 +1805,20 @@ config X86_SMAP If unsure, say Y. config X86_INTEL_UMIP - def_bool n + def_bool y depends on CPU_SUP_INTEL prompt "Intel User Mode Instruction Prevention" if EXPERT ---help--- The User Mode Instruction Prevention (UMIP) is a security feature in newer Intel processors. If enabled, a general - protection fault is issued if the instructions SGDT, SLDT, - SIDT, SMSW and STR are executed in user mode. + protection fault is issued if the SGDT, SLDT, SIDT, SMSW + or STR instructions are executed in user mode. These instructions + unnecessarily expose information about the hardware state. + + The vast majority of applications do not use these instructions. + For the very few that do, software emulation is provided in + specific cases in protected and virtual-8086 modes. Emulated + results are dummy. config X86_INTEL_MPX prompt "Intel MPX (Memory Protection Extensions)"
arch/x86/boot/compressed/kaslr.c +2 -3
@@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)static void mem_avoid_memmap (char *str) {static int i; -int rc;if (i >=MAX_MEMMAP_REGIONS )return ;
@@ -219,7 +218,7 @@ static int handle_mem_memmap(void)return 0 ; tmp_cmdline =malloc (len +1 ); -if (!tmp_cmdline ) +if (!tmp_cmdline)error ("Failed to allocate space for tmp_cmdline" );memcpy (tmp_cmdline, args, len);
@@ -363,7 +362,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, cmd_line |= boot_params->hdr.cmd_line_ptr;/* Calculate size of cmd_line. */ ptr = (char *)(unsigned long )cmd_line; -for (cmd_line_size =0 ; ptr[cmd_line_size++]; ) +for (cmd_line_size =0 ; ptr[cmd_line_size++];) ; mem_avoid[MEM_AVOID_CMDLINE ].start = cmd_line; mem_avoid[MEM_AVOID_CMDLINE ].size = cmd_line_size;
arch/x86/entry/entry_64.S +10 -4
@@ -51,15 +51,19 @@ ENTRY(native_usergs_sysret64) END(native_usergs_sysret64) #endif /* CONFIG_PARAVIRT */ -.macro TRACE_IRQS_IRETQ +.macro TRACE_IRQS_FLAGS flags:req #ifdef CONFIG_TRACE_IRQFLAGS - bt $9, EFLAGS(%rsp) /* interrupts off? */ + bt $9, \flags /* interrupts off? */ jnc 1f TRACE_IRQS_ON 1: #endif .endm +.macro TRACE_IRQS_IRETQ + TRACE_IRQS_FLAGS EFLAGS(%rsp) +.endm + /* * When dynamic function tracer is enabled it will add a breakpoint * to all locations that it is about to modify, sync CPUs, update
@@ -148,8 +152,6 @@ ENTRY(entry_SYSCALL_64) movq %rsp, PER_CPU_VAR(rsp_scratch) movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp - TRACE_IRQS_OFF - /* Construct struct pt_regs on stack */ pushq $__USER_DS /* pt_regs->ss */ pushq PER_CPU_VAR(rsp_scratch) /* pt_regs->sp */
@@ -170,6 +172,8 @@ GLOBAL(entry_SYSCALL_64_after_hwframe) sub $(6*8), %rsp /* pt_regs->bp, bx, r12-15 not saved */ UNWIND_HINT_REGS extra=0 + TRACE_IRQS_OFF + /* * If we need to do entry work or if we guess we'll need to do * exit work, go straight to the slow path.
@@ -943,11 +947,13 @@ ENTRY(native_load_gs_index) FRAME_BEGIN pushfq DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI) + TRACE_IRQS_OFF SWAPGS .Lgs_change: movl %edi, %gs 2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE SWAPGS + TRACE_IRQS_FLAGS (%rsp) popfq FRAME_END ret
arch/x86/events/intel/uncore.c +2 -2
@@ -975,10 +975,10 @@ static void uncore_pci_remove(struct pci_dev *pdev)int i, phys_id, pkg; phys_id =uncore_pcibus_to_physid (pdev->bus); - pkg =topology_phys_to_logical_pkg (phys_id); box =pci_get_drvdata (pdev);if (!box) { + pkg =topology_phys_to_logical_pkg (phys_id);for (i =0 ; i <UNCORE_EXTRA_PCI_DEV_MAX ; i++) {if (uncore_extra_pci_dev[pkg].dev[i] == pdev) { uncore_extra_pci_dev[pkg].dev[i] =NULL ;
@@ -994,7 +994,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)return ;pci_set_drvdata (pdev,NULL ); - pmu->boxes[pkg] =NULL ; + pmu->boxes[box->pkgid] =NULL ;if (atomic_dec_return (&pmu->activeboxes) ==0 )uncore_pmu_unregister (pmu);uncore_box_exit (box);
arch/x86/events/intel/uncore.h +1 -1
@@ -100,7 +100,7 @@ struct intel_uncore_extra_reg {struct intel_uncore_box {int pci_phys_id; -int pkgid; +int pkgid;/* Logical package ID */ int n_active;/* number of active events */ int n_events;int cpu;/* cpu to collect events */
arch/x86/events/intel/uncore_snbep.c +1 -1
@@ -1057,7 +1057,7 @@ static void snbep_qpi_enable_event(struct intel_uncore_box *box, struct perf_eveif (reg1->idx !=EXTRA_REG_NONE ) {int idx = box->pmu->pmu_idx +SNBEP_PCI_QPI_PORT0_FILTER ; -int pkg =topology_phys_to_logical_pkg (box->pci_phys_id); +int pkg = box->pkgid;struct pci_dev *filter_pdev = uncore_extra_pci_dev[pkg].dev[idx];if (filter_pdev) {
arch/x86/include/asm/elf.h +1 -0
@@ -309,6 +309,7 @@ static inline int mmap_is_ia32(void)extern unsigned long task_size_32bit (void );extern unsigned long task_size_64bit (int full_addr_space);extern unsigned long get_mmap_base (int is_legacy); +extern bool mmap_address_hint_valid (unsigned long addr,unsigned long len);#ifdef CONFIG_X86_32
arch/x86/include/asm/hw_irq.h +0 -8
@@ -99,14 +99,6 @@ struct irq_alloc_info {void *dmar_data; };#endif -#ifdef CONFIG_HT_IRQ -struct { -int ht_pos; -int ht_idx; -struct pci_dev *ht_dev; -void *ht_update; - }; -#endif #ifdef CONFIG_X86_UV struct { int uv_limit;
arch/x86/include/asm/hypertransport.h deleted +0 -46
46 lines not on this page · raw message
arch/x86/include/asm/insn-eval.h +1 -1
@@ -18,6 +18,6 @@void __user *insn_get_addr_ref (struct insn *insn,struct pt_regs *regs);int insn_get_modrm_rm_off (struct insn *insn,struct pt_regs *regs);unsigned long insn_get_seg_base (struct pt_regs *regs,int seg_reg_idx); -char insn_get_code_seg_params (struct pt_regs *regs); +int insn_get_code_seg_params (struct pt_regs *regs);#endif /* _ASM_X86_INSN_EVAL_H */
arch/x86/include/asm/io.h +4 -0
@@ -111,6 +111,10 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )#endif +#define ARCH_HAS_VALID_PHYS_ADDR_RANGE +extern int valid_phys_addr_range (phys_addr_t addr,size_t size); +extern int valid_mmap_phys_addr_range (unsigned long pfn,size_t size); +/** * virt_to_phys - map virtual addresses to physical * @address: address to remap
arch/x86/include/asm/irqdomain.h +0 -6
@@ -56,10 +56,4 @@ extern void arch_init_msi_domain(struct irq_domain *domain);static inline void arch_init_msi_domain (struct irq_domain *domain) { }#endif -#ifdef CONFIG_HT_IRQ -extern void arch_init_htirq_domain (struct irq_domain *domain); -#else -static inline void arch_init_htirq_domain (struct irq_domain *domain) { } -#endif -#endif
arch/x86/include/asm/processor.h +1 -0
@@ -132,6 +132,7 @@ struct cpuinfo_x86 {/* Index into per_cpu list: */ u16 cpu_index;u32 microcode; + unsigned initialized : 1; } __randomize_layout;struct cpuid_regs {
arch/x86/kernel/acpi/boot.c +38 -23
94 lines not on this page · raw message
arch/x86/kernel/apic/Makefile +0 -1
@@ -12,7 +12,6 @@ obj-y += hw_nmi.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o obj-$(CONFIG_PCI_MSI) += msi.o -obj-$(CONFIG_HT_IRQ) += htirq.o obj-$(CONFIG_SMP) += ipi.o ifeq ($(CONFIG_X86_64),y)
arch/x86/kernel/apic/htirq.c deleted +0 -198
198 lines not on this page · raw message
arch/x86/kernel/apic/vector.c +2 -3
@@ -1,5 +1,5 @@/* -* Local APIC related interfaces to support IOAPIC, MSI, HT_IRQ etc. +* Local APIC related interfaces to support IOAPIC, MSI, etc. * * Copyright (C) 1997, 1998, 1999, 2000, 2009 Ingo Molnar, Hajnalka Szabo * Moved from arch/x86/kernel/apic/io_apic.c.
@@ -601,7 +601,7 @@ int __init arch_probe_nr_irqs(void) nr_irqs =NR_VECTORS * nr_cpu_ids; nr = (gsi_top +nr_legacy_irqs ()) +8 * nr_cpu_ids; -#if defined(CONFIG_PCI_MSI ) || defined(CONFIG_HT_IRQ ) +#if defined(CONFIG_PCI_MSI )/* * for MSI and HT dyn irq */
@@ -663,7 +663,6 @@ int __init arch_early_irq_init(void)irq_set_default_host (x86_vector_domain);arch_init_msi_domain (x86_vector_domain); -arch_init_htirq_domain (x86_vector_domain);BUG_ON (!alloc_cpumask_var (&vector_searchmask,GFP_KERNEL ));
arch/x86/kernel/cpu/common.c +2 -0
@@ -341,6 +341,8 @@ static __always_inline void setup_umip(struct cpuinfo_x86 *c)cr4_set_bits (X86_CR4_UMIP ); +pr_info ("x86/cpu: Activated the Intel User Mode Instruction Prevention (UMIP) CPU feature\n" ); +return ; out:
arch/x86/kernel/mpparse.c +4 -2
@@ -431,6 +431,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) }static unsigned long mpf_base; +static bool mpf_found;static unsigned long __init get_mpc_size (unsigned long physptr) {
@@ -504,7 +505,7 @@ void __init default_get_smp_config(unsigned int early)if (!smp_found_config)return ; -if (!mpf_base) +if (!mpf_found)return ;if (acpi_lapic && early)
@@ -593,6 +594,7 @@ static int __init smp_scan_config(unsigned long base, unsigned long length) smp_found_config =1 ;#endif mpf_base = base; + mpf_found = true;pr_info ("found SMP MP-table at [mem %#010lx-%#010lx] mapped at [%p]\n" , base, base +sizeof (*mpf) -1 , mpf);
@@ -858,7 +860,7 @@ static int __init update_mp_table(void)if (!enable_update_mptable)return 0 ; -if (!mpf_base) +if (!mpf_found)return 0 ; mpf =early_memremap (mpf_base,sizeof (*mpf));
arch/x86/kernel/smpboot.c +39 -89
183 lines not on this page · raw message
arch/x86/kernel/sys_x86_64.c +7 -3
@@ -188,6 +188,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,if (len >TASK_SIZE )return -ENOMEM ; +/* No address checking. See comment at mmap_address_hint_valid() */ if (flags &MAP_FIXED )return addr;
@@ -197,12 +198,15 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,/* requesting a specific address */ if (addr) { - addr =PAGE_ALIGN (addr); + addr &=PAGE_MASK ; +if (!mmap_address_hint_valid (addr, len)) + goto get_unmapped_area; + vma =find_vma (mm, addr); -if (TASK_SIZE - len >= addr && - (!vma || addr + len <=vm_start_gap (vma))) +if (!vma || addr + len <=vm_start_gap (vma))return addr; } +get_unmapped_area: info.flags =VM_UNMAPPED_AREA_TOPDOWN ; info.length = len;
arch/x86/kernel/umip.c +75 -13
123 lines not on this page · raw message
arch/x86/lib/insn-eval.c +2 -2
@@ -733,11 +733,11 @@ static unsigned long get_seg_limit(struct pt_regs *regs, int seg_reg_idx)* * Returns: * -* A signed 8-bit value containing the default parameters on success. +* An int containing ORed-in default parameters on success. * * -EINVAL on error. */ -char insn_get_code_seg_params (struct pt_regs *regs) +int insn_get_code_seg_params (struct pt_regs *regs) {struct desc_struct *desc;short sel;
arch/x86/lib/x86-opcode-map.txt +1 -1
@@ -896,7 +896,7 @@ EndTable GrpTable: Grp3_1 0: TEST Eb,Ib -1: +1: TEST Eb,Ib 2: NOT Eb 3: NEG Eb 4: MUL AL,Eb
arch/x86/mm/hugetlbpage.c +8 -3
@@ -158,6 +158,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,if (len >TASK_SIZE )return -ENOMEM ; +/* No address checking. See comment at mmap_address_hint_valid() */ if (flags &MAP_FIXED ) {if (prepare_hugepage_range (file, addr, len))return -EINVAL ;
@@ -165,12 +166,16 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, }if (addr) { - addr =ALIGN (addr,huge_page_size (h)); + addr &=huge_page_mask (h); +if (!mmap_address_hint_valid (addr, len)) + goto get_unmapped_area; + vma =find_vma (mm, addr); -if (TASK_SIZE - len >= addr && - (!vma || addr + len <=vm_start_gap (vma))) +if (!vma || addr + len <=vm_start_gap (vma))return addr; } + +get_unmapped_area:if (mm->get_unmapped_area == arch_get_unmapped_area)return hugetlb_get_unmapped_area_bottomup (file, addr, len, pgoff, flags);
arch/x86/mm/kasan_init_64.c +136 -7
178 lines not on this page · raw message
arch/x86/mm/mmap.c +62 -0
71 lines not on this page · raw message
drivers/char/mem.c +4 -0
@@ -343,6 +343,10 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)size_t size = vma->vm_end - vma->vm_start;phys_addr_t offset = (phys_addr_t )vma->vm_pgoff <<PAGE_SHIFT ; +/* Does it even fit in phys_addr_t? */ +if (offset >>PAGE_SHIFT != vma->vm_pgoff) +return -EINVAL ; +/* It's illegal to wrap around the end of the physical address space. */ if (offset + (phys_addr_t )size -1 < offset)return -EINVAL ;
drivers/pci/Kconfig +0 -9
@@ -71,15 +71,6 @@ config XEN_PCIDEV_FRONTEND The PCI device frontend driver allows the kernel to import arbitrary PCI devices from a PCI backend to support PCI driver domains. -config HT_IRQ - bool "Interrupts on hypertransport devices" - default y - depends on PCI && X86_LOCAL_APIC - help - This allows native hypertransport devices to use interrupts. - - If unsure say Y. - config PCI_ATS bool
drivers/pci/Makefile +0 -3
@@ -24,9 +24,6 @@ endif # Build the PCI MSI interrupt support obj-$(CONFIG_PCI_MSI) += msi.o -# Build the Hypertransport interrupt support -obj-$(CONFIG_HT_IRQ) += htirq.o - obj-$(CONFIG_PCI_ATS) += ats.o obj-$(CONFIG_PCI_IOV) += iov.o
drivers/pci/htirq.c deleted +0 -135
135 lines not on this page · raw message
include/linux/htirq.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef LINUX_HTIRQ_H -#define LINUX_HTIRQ_H - -struct pci_dev ; -struct irq_data ; - -struct ht_irq_msg { -u32 address_lo;/* low 32 bits of the ht irq message */ -u32 address_hi;/* high 32 bits of the it irq message */ -}; - -typedef void (ht_irq_update_t )(struct pci_dev *dev,int irq, -struct ht_irq_msg *msg); - -struct ht_irq_cfg { -struct pci_dev *dev; -/* Update callback used to cope with buggy hardware */ -ht_irq_update_t *update; -unsigned pos; -unsigned idx; -struct ht_irq_msg msg; -}; - -/* Helper functions.. */ -void fetch_ht_irq_msg (unsigned int irq,struct ht_irq_msg *msg); -void write_ht_irq_msg (unsigned int irq,struct ht_irq_msg *msg); -void mask_ht_irq (struct irq_data *data); -void unmask_ht_irq (struct irq_data *data); - -/* The arch hook for getting things started */ -int arch_setup_ht_irq (int idx,int pos,struct pci_dev *dev, -ht_irq_update_t *update); -void arch_teardown_ht_irq (unsigned int irq); - -/* For drivers of buggy hardware */ -int __ht_create_irq (struct pci_dev *dev,int idx,ht_irq_update_t *update); - -#endif /* LINUX_HTIRQ_H */
include/linux/pci.h +0 -6
@@ -1484,12 +1484,6 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }static inline void pcie_ecrc_get_policy (char *str) { }#endif -#ifdef CONFIG_HT_IRQ -/* The functions a driver should call */ -int ht_create_irq (struct pci_dev *dev,int idx); -void ht_destroy_irq (unsigned int irq); -#endif /* CONFIG_HT_IRQ */ -#ifdef CONFIG_PCI_ATS /* Address Translation Service */ void pci_ats_init (struct pci_dev *dev);
tools/testing/selftests/x86/5lvl.c new file +177 -0
177 lines not on this page · raw message
tools/testing/selftests/x86/Makefile +1 -1
@@ -11,7 +11,7 @@ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_sysc TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \ test_FCMOV test_FCOMI test_FISTTP \ vdso_restorer -TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip +TARGETS_C_64BIT_ONLY := fsgsbase sysret_rip 5lvl TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY) TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
tools/testing/selftests/x86/mpx-hw.h +2 -2
@@ -52,14 +52,14 @@struct mpx_bd_entry {union {char x[MPX_BOUNDS_DIR_ENTRY_SIZE_BYTES ]; -void *contents[1 ]; +void *contents[0 ]; }; } __attribute__((packed));struct mpx_bt_entry {union {char x[MPX_BOUNDS_TABLE_ENTRY_SIZE_BYTES ]; -unsigned long contents[1 ]; +unsigned long contents[0 ]; }; } __attribute__((packed));
tools/testing/selftests/x86/pkey-helpers.h +4 -1
@@ -30,6 +30,7 @@ static inline void sigsafe_printf(const char *format, ...)if (!dprint_in_signal) {vprintf (format, ap); }else { +int ret;int len =vsnprintf (dprint_in_signal_buffer,DPRINT_IN_SIGNAL_BUF_SIZE , format, ap);
@@ -39,7 +40,9 @@ static inline void sigsafe_printf(const char *format, ...)*/ if (len >DPRINT_IN_SIGNAL_BUF_SIZE ) len =DPRINT_IN_SIGNAL_BUF_SIZE ; -write (1 , dprint_in_signal_buffer, len); + ret =write (1 , dprint_in_signal_buffer, len); +if (ret <0 ) +abort (); }va_end (ap); }
tools/testing/selftests/x86/protection_keys.c +5 -5
@@ -250,7 +250,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)unsigned long ip;char *fpregs;u32 *pkru_ptr; -u64 si_pkey; +u64 siginfo_pkey;u32 *si_pkey_ptr;int pkru_offset;fpregset_t fpregset;
@@ -292,9 +292,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext) si_pkey_ptr = (u32 *)(((u8 *)si) + si_pkey_offset);dprintf1 ("si_pkey_ptr: %p\n" , si_pkey_ptr);dump_mem (si_pkey_ptr -8 ,24 ); - si_pkey = *si_pkey_ptr; -pkey_assert (si_pkey <NR_PKEYS ); - last_si_pkey = si_pkey; + siginfo_pkey = *si_pkey_ptr; +pkey_assert (siginfo_pkey <NR_PKEYS ); + last_si_pkey = siginfo_pkey; if ((si->si_code == SEGV_MAPERR) || (si->si_code == SEGV_ACCERR) ||
@@ -306,7 +306,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)dprintf1 ("signal pkru from xsave: %08x\n" , *pkru_ptr);/* need __rdpkru() version so we do not do shadow_pkru checking */ dprintf1 ("signal pkru from pkru: %08x\n" ,__rdpkru ()); -dprintf1 ("si_pkey from siginfo: %jx\n" , si_pkey); +dprintf1 ("pkey from siginfo: %jx\n" , siginfo_pkey); *(u64 *)pkru_ptr =0x00000000 ;dprintf1 ("WARNING: set PRKU=0 to allow faulting instruction to continue\n" ); pkru_faults++;