Skip to content

Commit 02fc87b

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 fixes from Ingo Molnar: - 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 * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) x86/decoder: Add new TEST instruction pattern x86/PCI: Remove unused HyperTransport interrupt support x86/umip: Fix insn_get_code_seg_params()'s return value x86/boot/KASLR: Remove unused variable x86/entry/64: Add missing irqflags tracing to native_load_gs_index() x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow x86/entry/64: Fix entry_SYSCALL_64_after_hwframe() IRQ tracing x86/pkeys/selftests: Fix protection keys write() warning x86/pkeys/selftests: Rename 'si_pkey' to 'siginfo_pkey' x86/mpx/selftests: Fix up weird arrays x86/pkeys: Update documentation about availability x86/umip: Print a warning into the syslog if UMIP-protected instructions are used x86/smpboot: Fix __max_logical_packages estimate x86/topology: Avoid wasting 128k for package id array perf/x86/intel/uncore: Cache logical pkg id in uncore driver x86/acpi: Reduce code duplication in mp_override_legacy_irq() x86/acpi: Handle SCI interrupts above legacy space gracefully x86/boot: Fix boot failure when SMP MP-table is based at 0 x86/mm: Limit mmap() of /dev/mem to valid physical addresses x86/selftests: Add test for mapping placement for 5-level paging ...
2 parents 6830c8d + 12a78d4 commit 02fc87b

File tree

38 files changed

+472
-616
lines changed

38 files changed

+472
-616
lines changed

Documentation/x86/protection-keys.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
Memory Protection Keys for Userspace (PKU aka PKEYs) is a CPU feature
2-
which will be found on future Intel CPUs.
1+
Memory Protection Keys for Userspace (PKU aka PKEYs) is a feature
2+
which is found on Intel's Skylake "Scalable Processor" Server CPUs.
3+
It will be avalable in future non-server parts.
4+
5+
For anyone wishing to test or use this feature, it is available in
6+
Amazon's EC2 C5 instances and is known to work there using an Ubuntu
7+
17.04 image.
38

49
Memory Protection Keys provides a mechanism for enforcing page-based
510
protections, but without requiring modification of the page tables

arch/x86/Kconfig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,14 +1804,20 @@ config X86_SMAP
18041804
If unsure, say Y.
18051805

18061806
config X86_INTEL_UMIP
1807-
def_bool n
1807+
def_bool y
18081808
depends on CPU_SUP_INTEL
18091809
prompt "Intel User Mode Instruction Prevention" if EXPERT
18101810
---help---
18111811
The User Mode Instruction Prevention (UMIP) is a security
18121812
feature in newer Intel processors. If enabled, a general
1813-
protection fault is issued if the instructions SGDT, SLDT,
1814-
SIDT, SMSW and STR are executed in user mode.
1813+
protection fault is issued if the SGDT, SLDT, SIDT, SMSW
1814+
or STR instructions are executed in user mode. These instructions
1815+
unnecessarily expose information about the hardware state.
1816+
1817+
The vast majority of applications do not use these instructions.
1818+
For the very few that do, software emulation is provided in
1819+
specific cases in protected and virtual-8086 modes. Emulated
1820+
results are dummy.
18151821

18161822
config X86_INTEL_MPX
18171823
prompt "Intel MPX (Memory Protection Extensions)"

arch/x86/boot/compressed/kaslr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
171171
static void mem_avoid_memmap(char *str)
172172
{
173173
static int i;
174-
int rc;
175174

176175
if (i >= MAX_MEMMAP_REGIONS)
177176
return;
@@ -219,7 +218,7 @@ static int handle_mem_memmap(void)
219218
return 0;
220219

221220
tmp_cmdline = malloc(len + 1);
222-
if (!tmp_cmdline )
221+
if (!tmp_cmdline)
223222
error("Failed to allocate space for tmp_cmdline");
224223

225224
memcpy(tmp_cmdline, args, len);
@@ -363,7 +362,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
363362
cmd_line |= boot_params->hdr.cmd_line_ptr;
364363
/* Calculate size of cmd_line. */
365364
ptr = (char *)(unsigned long)cmd_line;
366-
for (cmd_line_size = 0; ptr[cmd_line_size++]; )
365+
for (cmd_line_size = 0; ptr[cmd_line_size++];)
367366
;
368367
mem_avoid[MEM_AVOID_CMDLINE].start = cmd_line;
369368
mem_avoid[MEM_AVOID_CMDLINE].size = cmd_line_size;

arch/x86/entry/entry_64.S

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,19 @@ ENTRY(native_usergs_sysret64)
5151
END(native_usergs_sysret64)
5252
#endif /* CONFIG_PARAVIRT */
5353

54-
.macro TRACE_IRQS_IRETQ
54+
.macro TRACE_IRQS_FLAGS flags:req
5555
#ifdef CONFIG_TRACE_IRQFLAGS
56-
bt $9, EFLAGS(%rsp) /* interrupts off? */
56+
bt $9, \flags /* interrupts off? */
5757
jnc 1f
5858
TRACE_IRQS_ON
5959
1:
6060
#endif
6161
.endm
6262

63+
.macro TRACE_IRQS_IRETQ
64+
TRACE_IRQS_FLAGS EFLAGS(%rsp)
65+
.endm
66+
6367
/*
6468
* When dynamic function tracer is enabled it will add a breakpoint
6569
* to all locations that it is about to modify, sync CPUs, update
@@ -148,8 +152,6 @@ ENTRY(entry_SYSCALL_64)
148152
movq %rsp, PER_CPU_VAR(rsp_scratch)
149153
movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
150154

151-
TRACE_IRQS_OFF
152-
153155
/* Construct struct pt_regs on stack */
154156
pushq $__USER_DS /* pt_regs->ss */
155157
pushq PER_CPU_VAR(rsp_scratch) /* pt_regs->sp */
@@ -170,6 +172,8 @@ GLOBAL(entry_SYSCALL_64_after_hwframe)
170172
sub $(6*8), %rsp /* pt_regs->bp, bx, r12-15 not saved */
171173
UNWIND_HINT_REGS extra=0
172174

175+
TRACE_IRQS_OFF
176+
173177
/*
174178
* If we need to do entry work or if we guess we'll need to do
175179
* exit work, go straight to the slow path.
@@ -943,11 +947,13 @@ ENTRY(native_load_gs_index)
943947
FRAME_BEGIN
944948
pushfq
945949
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
950+
TRACE_IRQS_OFF
946951
SWAPGS
947952
.Lgs_change:
948953
movl %edi, %gs
949954
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
950955
SWAPGS
956+
TRACE_IRQS_FLAGS (%rsp)
951957
popfq
952958
FRAME_END
953959
ret

arch/x86/events/intel/uncore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,10 +975,10 @@ static void uncore_pci_remove(struct pci_dev *pdev)
975975
int i, phys_id, pkg;
976976

977977
phys_id = uncore_pcibus_to_physid(pdev->bus);
978-
pkg = topology_phys_to_logical_pkg(phys_id);
979978

980979
box = pci_get_drvdata(pdev);
981980
if (!box) {
981+
pkg = topology_phys_to_logical_pkg(phys_id);
982982
for (i = 0; i < UNCORE_EXTRA_PCI_DEV_MAX; i++) {
983983
if (uncore_extra_pci_dev[pkg].dev[i] == pdev) {
984984
uncore_extra_pci_dev[pkg].dev[i] = NULL;
@@ -994,7 +994,7 @@ static void uncore_pci_remove(struct pci_dev *pdev)
994994
return;
995995

996996
pci_set_drvdata(pdev, NULL);
997-
pmu->boxes[pkg] = NULL;
997+
pmu->boxes[box->pkgid] = NULL;
998998
if (atomic_dec_return(&pmu->activeboxes) == 0)
999999
uncore_pmu_unregister(pmu);
10001000
uncore_box_exit(box);

arch/x86/events/intel/uncore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ struct intel_uncore_extra_reg {
100100

101101
struct intel_uncore_box {
102102
int pci_phys_id;
103-
int pkgid;
103+
int pkgid; /* Logical package ID */
104104
int n_active; /* number of active events */
105105
int n_events;
106106
int cpu; /* cpu to collect events */

arch/x86/events/intel/uncore_snbep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ static void snbep_qpi_enable_event(struct intel_uncore_box *box, struct perf_eve
10571057

10581058
if (reg1->idx != EXTRA_REG_NONE) {
10591059
int idx = box->pmu->pmu_idx + SNBEP_PCI_QPI_PORT0_FILTER;
1060-
int pkg = topology_phys_to_logical_pkg(box->pci_phys_id);
1060+
int pkg = box->pkgid;
10611061
struct pci_dev *filter_pdev = uncore_extra_pci_dev[pkg].dev[idx];
10621062

10631063
if (filter_pdev) {

arch/x86/include/asm/elf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static inline int mmap_is_ia32(void)
309309
extern unsigned long task_size_32bit(void);
310310
extern unsigned long task_size_64bit(int full_addr_space);
311311
extern unsigned long get_mmap_base(int is_legacy);
312+
extern bool mmap_address_hint_valid(unsigned long addr, unsigned long len);
312313

313314
#ifdef CONFIG_X86_32
314315

arch/x86/include/asm/hw_irq.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,6 @@ struct irq_alloc_info {
9999
void *dmar_data;
100100
};
101101
#endif
102-
#ifdef CONFIG_HT_IRQ
103-
struct {
104-
int ht_pos;
105-
int ht_idx;
106-
struct pci_dev *ht_dev;
107-
void *ht_update;
108-
};
109-
#endif
110102
#ifdef CONFIG_X86_UV
111103
struct {
112104
int uv_limit;

arch/x86/include/asm/hypertransport.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)