x86 fixes
Subsystems (6)
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: 215eada73e77ede7e15531d99f712481ddd429be objtool: Resync objtool's instruction decoder source code copy with the kernel's latest version
Misc fixes:
- Fix the s2ram regression related to confusion around segment register restoration, plus related cleanups that make the code more robust
- a guess-unwinder Kconfig dependency fix
- an isoimage build target fix for certain tool chain combinations
- instruction decoder opcode map fixes+updates, and the syncing of the kernel decoder headers to the objtool headers
- a kmmio tracing fix
- two 5-level paging related fixes
- a topology enumeration fix on certain SMP systems
Thanks,
Ingo
------------------>
Andrey Ryabinin (1):
x86/unwinder/guess: Prevent using CONFIG_UNWINDER_GUESS=y with CONFIG_STACKDEPOT=y
Andy Lutomirski (3):
x86/power/64: Use struct desc_ptr for the IDT in struct saved_context x86/power/32: Move SYSENTER MSR restoration to fix_processor_context() x86/power: Make restore_processor_context() sane
Changbin Du (1):
x86/build: Don't verify mtools configuration file for isoimage
Ingo Molnar (1):
objtool: Resync objtool's instruction decoder source code copy with the kernel's latest version
Karol Herbst (1):
x86/mm/kmmio: Fix mmiotrace for page unaligned addresses
Kirill A. Shutemov (2):
x86/boot/compressed/64: Detect and handle 5-level paging at boot-time x86/boot/compressed/64: Print error if 5-level paging is not supported
Prarit Bhargava (1):
x86/smpboot: Do not use smp_num_siblings in __max_logical_packages calculation
Randy Dunlap (1):
x86/decoder: Fix and update the opcodes map
arch/x86/Kconfig.debug | 1 + arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/head_64.S | 16 +++- arch/x86/boot/compressed/misc.c | 16 ++++ arch/x86/boot/compressed/pgtable_64.c | 28 ++++++ arch/x86/boot/genimage.sh | 4 +- arch/x86/include/asm/suspend_32.h | 8 +- arch/x86/include/asm/suspend_64.h | 19 ++++- arch/x86/kernel/smpboot.c | 4 +- arch/x86/lib/x86-opcode-map.txt | 13 ++- arch/x86/mm/ioremap.c | 4 +- arch/x86/mm/kmmio.c | 12 +-- arch/x86/power/cpu.c | 99 ++++++++++------------ tools/objtool/arch/x86/insn/inat.h | 10 +++ tools/objtool/arch/x86/insn/x86-opcode-map.txt | 15 +++- .../perf/util/intel-pt-decoder/x86-opcode-map.txt | 15 +++- 16 files changed, 184 insertions(+), 81 deletions(-) create mode 100644 arch/x86/boot/compressed/pgtable_64.c
arch/x86/Kconfig.debug +1 -0
@@ -400,6 +400,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_GUESS bool "Guess unwinder" depends on EXPERT + depends on !STACKDEPOT ---help--- This option enables the "guess" unwinder for unwinding kernel stack traces. It scans the stack and reports every kernel text address it
arch/x86/boot/compressed/Makefile +1 -0
@@ -80,6 +80,7 @@ vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/kaslr.o ifdef CONFIG_X86_64 vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/pagetable.o vmlinux-objs-y += $(obj)/mem_encrypt.o + vmlinux-objs-y += $(obj)/pgtable_64.o endif $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
arch/x86/boot/compressed/head_64.S +12 -4
@@ -305,10 +305,18 @@ ENTRY(startup_64) leaq boot_stack_end(%rbx), %rsp #ifdef CONFIG_X86_5LEVEL - /* Check if 5-level paging has already enabled */ - movq %cr4, %rax - testl $X86_CR4_LA57, %eax - jnz lvl5 + /* + * Check if we need to enable 5-level paging. + * RSI holds real mode data and need to be preserved across + * a function call. + */ + pushq %rsi + call l5_paging_required + popq %rsi + + /* If l5_paging_required() returned zero, we're done here. */ + cmpq $0, %rax + je lvl5 /* * At this point we are in long mode with 4-level paging enabled,
arch/x86/boot/compressed/misc.c +16 -0
@@ -169,6 +169,16 @@ void __puthex(unsigned long value) } } +static bool l5_supported (void ) +{ +/* Check if leaf 7 is supported. */ +if (native_cpuid_eax (0 ) <7 ) +return 0 ; + +/* Check if la57 is supported. */ +return native_cpuid_ecx (7 ) & (1 << (X86_FEATURE_LA57 &31 )); +} +#if CONFIG_X86_NEED_RELOCS static void handle_relocations (void *output,unsigned long output_len,unsigned long virt_addr)
@@ -362,6 +372,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,console_init ();debug_putstr ("early console in extract_kernel\n" ); +if (IS_ENABLED (CONFIG_X86_5LEVEL ) && !l5_supported ()) { +error ("This linux kernel as configured requires 5-level paging\n" +"This CPU does not support the required 'cr4.la57' feature\n" +"Unable to boot - please use a kernel appropriate for your CPU\n" ); + } + free_mem_ptr = heap;/* Heap */ free_mem_end_ptr = heap +BOOT_HEAP_SIZE ;
arch/x86/boot/compressed/pgtable_64.c new file +28 -0
@@ -0,0 +1,28 @@ +#include <asm/processor.h> + +/* +* __force_order is used by special_insns.h asm code to force instruction +* serialization. +* +* It is not referenced from the code, but GCC < 5 with -fPIE would fail +* due to an undefined symbol. Define it to make these ancient GCCs work. +*/ +unsigned long __force_order; + +int l5_paging_required (void ) +{ +/* Check if leaf 7 is supported. */ + +if (native_cpuid_eax (0 ) <7 ) +return 0 ; + +/* Check if la57 is supported. */ +if (!(native_cpuid_ecx (7 ) & (1 << (X86_FEATURE_LA57 &31 )))) +return 0 ; + +/* Check if 5-level paging has already been enabled. */ +if (native_read_cr4 () &X86_CR4_LA57 ) +return 0 ; + +return 1 ; +}
arch/x86/boot/genimage.sh +3 -1
@@ -44,9 +44,9 @@ FDINITRD=$6 # Make sure the files actually exist verify "$FBZIMAGE" -verify "$MTOOLSRC" genbzdisk() { + verify "$MTOOLSRC" mformat a: syslinux $FIMAGE echo "$KCMDLINE" | mcopy - a:syslinux.cfg
@@ -57,6 +57,7 @@ genbzdisk() { } genfdimage144() { + verify "$MTOOLSRC" dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null mformat v: syslinux $FIMAGE
@@ -68,6 +69,7 @@ genfdimage144() { } genfdimage288() { + verify "$MTOOLSRC" dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null mformat w: syslinux $FIMAGE
arch/x86/include/asm/suspend_32.h +7 -1
@@ -12,7 +12,13 @@/* image of the saved processor state */ struct saved_context { -u16 es, fs, gs, ss; +/* +* On x86_32, all segment registers, with the possible exception of +* gs, are saved at kernel entry in pt_regs. +*/ +#ifdef CONFIG_X86_32_LAZY_GS +u16 gs; +#endif unsigned long cr0, cr2, cr3, cr4;u64 misc_enable;bool misc_enable_saved;
arch/x86/include/asm/suspend_64.h +15 -4
@@ -20,8 +20,20 @@*/ struct saved_context {struct pt_regs regs; -u16 ds, es, fs, gs, ss; -unsigned long gs_base, gs_kernel_base, fs_base; + +/* +* User CS and SS are saved in current_pt_regs(). The rest of the +* segment selectors need to be saved and restored here. +*/ +u16 ds, es, fs, gs; + +/* +* Usermode FSBASE and GSBASE may not match the fs and gs selectors, +* so we save them separately. We save the kernelmode GSBASE to +* restore percpu access after resume. +*/ +unsigned long kernelmode_gs_base, usermode_gs_base, fs_base; +unsigned long cr0, cr2, cr3, cr4, cr8;u64 misc_enable;bool misc_enable_saved;
@@ -30,8 +42,7 @@ struct saved_context {u16 gdt_pad;/* Unused */ struct desc_ptr gdt_desc;u16 idt_pad; -u16 idt_limit; -unsigned long idt_base; +struct desc_ptr idt;u16 ldt;u16 tss;unsigned long tr;
arch/x86/kernel/smpboot.c +2 -2
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(__max_logical_packages);static unsigned int logical_packages__read_mostly ;/* Maximum number of SMT threads on any online core */ -int __max_smt_threads__read_mostly ; +int __read_mostly __max_smt_threads =1 ;/* Flag to indicate if a complete sched domain rebuild is required */ bool x86_topology_update;
@@ -1304,7 +1304,7 @@ void __init native_smp_cpus_done(unsigned int max_cpus)* Today neither Intel nor AMD support heterogenous systems so * extrapolate the boot cpu's data to all packages. */ - ncpus =cpu_data (0 ).booted_cores * smp_num_siblings; + ncpus =cpu_data (0 ).booted_cores *topology_max_smt_threads (); __max_logical_packages =DIV_ROUND_UP (nr_cpu_ids, ncpus);pr_info ("Max logical packages: %u\n" , __max_logical_packages);
arch/x86/lib/x86-opcode-map.txt +11 -2
@@ -607,7 +607,7 @@ fb: psubq Pq,Qq | vpsubq Vx,Hx,Wx (66),(v1) fc: paddb Pq,Qq | vpaddb Vx,Hx,Wx (66),(v1) fd: paddw Pq,Qq | vpaddw Vx,Hx,Wx (66),(v1) fe: paddd Pq,Qq | vpaddd Vx,Hx,Wx (66),(v1) -ff: +ff: UD0 EndTable Table: 3-byte opcode 1 (0x0f 0x38)
@@ -717,7 +717,7 @@ AVXcode: 2 7e: vpermt2d/q Vx,Hx,Wx (66),(ev) 7f: vpermt2ps/d Vx,Hx,Wx (66),(ev) 80: INVEPT Gy,Mdq (66) -81: INVPID Gy,Mdq (66) +81: INVVPID Gy,Mdq (66) 82: INVPCID Gy,Mdq (66) 83: vpmultishiftqb Vx,Hx,Wx (66),(ev) 88: vexpandps/d Vpd,Wpd (66),(ev)
@@ -970,6 +970,15 @@ GrpTable: Grp9 EndTable GrpTable: Grp10 +# all are UD1 +0: UD1 +1: UD1 +2: UD1 +3: UD1 +4: UD1 +5: UD1 +6: UD1 +7: UD1 EndTable # Grp11A and Grp11B are expressed as Grp11 in Intel SDM
arch/x86/mm/ioremap.c +2 -2
@@ -404,11 +404,11 @@ void iounmap(volatile void __iomem *addr)return ; } +mmiotrace_iounmap (addr); + addr = (volatile void __iomem *) (PAGE_MASK & (unsigned long __force )addr); -mmiotrace_iounmap (addr); -/* Use the vm area unlocked, assuming the caller ensures there isn't another iounmap for the same address in parallel. Reuse of the virtual address is prevented by
arch/x86/mm/kmmio.c +7 -5
@@ -435,17 +435,18 @@ int register_kmmio_probe(struct kmmio_probe *p)unsigned long flags;int ret =0 ;unsigned long size =0 ; +unsigned long addr = p->addr &PAGE_MASK ;const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK );unsigned int l;pte_t *pte;spin_lock_irqsave (&kmmio_lock, flags); -if (get_kmmio_probe (p->addr)) { +if (get_kmmio_probe (addr)) { ret = -EEXIST ; goto out; } - pte =lookup_address (p->addr, &l); + pte =lookup_address (addr, &l);if (!pte) { ret = -EINVAL ; goto out;
@@ -454,7 +455,7 @@ int register_kmmio_probe(struct kmmio_probe *p) kmmio_count++;list_add_rcu (&p->list, &kmmio_probes);while (size < size_lim) { -if (add_kmmio_fault_page (p->addr + size)) +if (add_kmmio_fault_page (addr + size))pr_err ("Unable to set page fault.\n" ); size +=page_level_size (l); }
@@ -528,19 +529,20 @@ void unregister_kmmio_probe(struct kmmio_probe *p) {unsigned long flags;unsigned long size =0 ; +unsigned long addr = p->addr &PAGE_MASK ;const unsigned long size_lim = p->len + (p->addr & ~PAGE_MASK );struct kmmio_fault_page *release_list =NULL ;struct kmmio_delayed_release *drelease;unsigned int l;pte_t *pte; - pte =lookup_address (p->addr, &l); + pte =lookup_address (addr, &l);if (!pte)return ;spin_lock_irqsave (&kmmio_lock, flags);while (size < size_lim) { -release_kmmio_fault_page (p->addr + size, &release_list); +release_kmmio_fault_page (addr + size, &release_list); size +=page_level_size (l); }list_del_rcu (&p->list);
arch/x86/power/cpu.c +45 -54
151 lines not on this page · raw message
tools/objtool/arch/x86/insn/inat.h +10 -0
@@ -97,6 +97,16 @@#define INAT_MAKE_GROUP (grp) ((grp << INAT_GRP_OFFS) | INAT_MODRM)#define INAT_MAKE_IMM (imm) (imm << INAT_IMM_OFFS) +/* Identifiers for segment registers */ +#define INAT_SEG_REG_IGNORE 0 +#define INAT_SEG_REG_DEFAULT 1 +#define INAT_SEG_REG_CS 2 +#define INAT_SEG_REG_SS 3 +#define INAT_SEG_REG_DS 4 +#define INAT_SEG_REG_ES 5 +#define INAT_SEG_REG_FS 6 +#define INAT_SEG_REG_GS 7 +/* Attribute search APIs */ extern insn_attr_t inat_get_opcode_attribute (insn_byte_t opcode);extern int inat_get_last_prefix_id (insn_byte_t last_pfx);
tools/objtool/arch/x86/insn/x86-opcode-map.txt +12 -3
@@ -607,7 +607,7 @@ fb: psubq Pq,Qq | vpsubq Vx,Hx,Wx (66),(v1) fc: paddb Pq,Qq | vpaddb Vx,Hx,Wx (66),(v1) fd: paddw Pq,Qq | vpaddw Vx,Hx,Wx (66),(v1) fe: paddd Pq,Qq | vpaddd Vx,Hx,Wx (66),(v1) -ff: +ff: UD0 EndTable Table: 3-byte opcode 1 (0x0f 0x38)
@@ -717,7 +717,7 @@ AVXcode: 2 7e: vpermt2d/q Vx,Hx,Wx (66),(ev) 7f: vpermt2ps/d Vx,Hx,Wx (66),(ev) 80: INVEPT Gy,Mdq (66) -81: INVPID Gy,Mdq (66) +81: INVVPID Gy,Mdq (66) 82: INVPCID Gy,Mdq (66) 83: vpmultishiftqb Vx,Hx,Wx (66),(ev) 88: vexpandps/d Vpd,Wpd (66),(ev)
@@ -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
@@ -970,6 +970,15 @@ GrpTable: Grp9 EndTable GrpTable: Grp10 +# all are UD1 +0: UD1 +1: UD1 +2: UD1 +3: UD1 +4: UD1 +5: UD1 +6: UD1 +7: UD1 EndTable # Grp11A and Grp11B are expressed as Grp11 in Intel SDM
tools/perf/util/intel-pt-decoder/x86-opcode-map.txt +12 -3
@@ -607,7 +607,7 @@ fb: psubq Pq,Qq | vpsubq Vx,Hx,Wx (66),(v1) fc: paddb Pq,Qq | vpaddb Vx,Hx,Wx (66),(v1) fd: paddw Pq,Qq | vpaddw Vx,Hx,Wx (66),(v1) fe: paddd Pq,Qq | vpaddd Vx,Hx,Wx (66),(v1) -ff: +ff: UD0 EndTable Table: 3-byte opcode 1 (0x0f 0x38)
@@ -717,7 +717,7 @@ AVXcode: 2 7e: vpermt2d/q Vx,Hx,Wx (66),(ev) 7f: vpermt2ps/d Vx,Hx,Wx (66),(ev) 80: INVEPT Gy,Mdq (66) -81: INVPID Gy,Mdq (66) +81: INVVPID Gy,Mdq (66) 82: INVPCID Gy,Mdq (66) 83: vpmultishiftqb Vx,Hx,Wx (66),(ev) 88: vexpandps/d Vpd,Wpd (66),(ev)
@@ -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
@@ -970,6 +970,15 @@ GrpTable: Grp9 EndTable GrpTable: Grp10 +# all are UD1 +0: UD1 +1: UD1 +2: UD1 +3: UD1 +4: UD1 +5: UD1 +6: UD1 +7: UD1 EndTable # Grp11A and Grp11B are expressed as Grp11 in Intel SDM
Andy Lutomirski
maintainerQuoted 4 lines · Ingo Molnar
Linus,
- two 5-level paging related fixes
Which reminds me: can you grab this one, too?
https://lkml.kernel.org/r/24c898b4f44fdf8c22d93703850fb384ef87cfdc.1513035461.git.luto@kernel.org
Quoted 9 lines · Andy Lutomirski
Quoted 4 lines · Ingo Molnar
Linus,
- two 5-level paging related fixes
Which reminds me: can you grab this one, too?
https://lkml.kernel.org/r/24c898b4f44fdf8c22d93703850fb384ef87cfdc.1513035461.git.luto@kernel.org
Yeah, done - it's now in x86/urgent as:
c739f930be1d: x86/espfix/64: Fix espfix double-fault handling on 5-level systems
Will push it out soon. Linus will get it with the next x86/urgent batch, as there's no production 5-level paging CPUs out there yet, right?
I'm also picking up your pending PTI fixes/updates over the weekend, but I spent today mostly to make sure that the system call trampoline bits and its dependencies were robust in practice.
Could you please have a good look at that tree:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tmp
This includes the preparatory merges and cherry-picks, and some other low risk preparatory bits related to PTI.
Is this tree looking good to you standalone?
Note that the lack of runtime patching on non-Intel systems by default is intentionally not included at this stage, so that it's all simpler, and that we get more test coverage...
This tree is what I've been testing all day, including suspend/resume testing, and which I wanted to send to Linus later today as an RFC pull request, assuming there's no last minute showstoppers. (Right after I've seen the new Star Wars movie with my son - because priorities! ;-)
Thanks,
Ingo
Andy Lutomirski
maintainerQuoted 24 lines · Ingo Molnar
Quoted 9 lines · Andy Lutomirski
Quoted 4 lines · Ingo Molnar
Linus,
- two 5-level paging related fixes
Which reminds me: can you grab this one, too?
https://lkml.kernel.org/r/24c898b4f44fdf8c22d93703850fb384ef87cfdc.1513035461.git.luto@kernel.org
Yeah, done - it's now in x86/urgent as:
c739f930be1d: x86/espfix/64: Fix espfix double-fault handling on 5-level systemsWill push it out soon. Linus will get it with the next x86/urgent batch, as there's no production 5-level paging CPUs out there yet, right?
I'm also picking up your pending PTI fixes/updates over the weekend, but I spent today mostly to make sure that the system call trampoline bits and its dependencies were robust in practice.
Quoted 8 lines
Could you please have a good look at that tree:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gittmp.tmpThis includes the preparatory merges and cherry-picks, and some other low risk preparatory bits related to PTI.
Is this tree looking good to you standalone?
I think this stuff is looking okay, although I'm a bit mystified by the whole merge base thing. But if the backporters and Linus like it, then whatever.
I few things I noticed in the PTI tree:
"x86/mm/pti: Map ESPFIX into user space" has a leftover pr_err(). Sorry, my bad, I've spent *way* too long looking at this crap to retain my sanity. Also, if you're feeling like being super tidy, the init/main.c change in their could be folded in to whatever patch adds pti_init() in the first place, but it doesn't really matter.
"x86/pti: Map the vsyscall page if needed" has a change to pgtable_64.h that could be folded into an earlier patch. This is probably my fault for applying Dave Hansen's cleanup request to the wrong patch.
"x86/mm/64: Make a full PGD-entry size hole in the memory map" would benefit from a mention of "5-level" somewhere in the subject or changelog.
In "x86/fixmap: Add debugstore entries to cpu_entry_area", I think the function "set_percpu_fixmap_ptes" is misnamed. It should be something like "allocate_percpu_fixmap_ptes", perhaps, and it should either warn or do nothing if the PTE is already present, I think. As it stands, it's a wee bit dangerous.
X86_BUG_CPU_SECURE_MODE_PTI should be added to DISABLED_FEATURES or DISABLED_BUGS or whatever if it's not configured in, which will reduce bloat. Borislav, that's kind of up your alley, since I don't think the appropriate mask even exists right now.
Anyway, I stuck a few minor fixups here:
https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/log/?h=x86/pti
Quoted 5 lines · Andy Lutomirski
Quoted 1 line
Is this tree looking good to you standalone?
I think this stuff is looking okay, although I'm a bit mystified by the whole merge base thing. But if the backporters and Linus like it, then whatever.
To explain the merge base thing: considering that v4.14 is an LTS kernel the PTI merge base thing is really mostly about keeping this commit count low:
triton:~/tip> git log --no-merges --oneline v4.14..tip/WIP.x86/pti.base | wc -l 63
Versus the closest upstream work-alike equivalent base tree, which is, roughly:
triton:~/tip> git log --no-merges --oneline v4.14..99306dfc067e | wc -l 1088
1088 is a lot of commits to backport, all sourced from early in the merge window - which would also require the identification of ~dozens of random followup fixes later in the merge window and the -rc process - which fixes might not even cherry-pick cleanly due to other interactions...
So the upstream price of the 'PTI merge base' is 9 cherry-picks, to avoid backporting either 1000+ commits to -stable (not workable to -stable folks, especially as such wide backports also tend to explode exponentially by pulling in random dependencies as you try to backport them further back) or the non-Git backporting of 100+ iffy low level x86 entry code commits to the LTS kernel (still a nightmare to both the -stable and us x86 maintainers).
Note that doing this also allows tip:x86/pti to remain on this almost-v4.14 base for a few more weeks after an upstream merge, so it can collect any eventual fixes and minor enhancements into a linear series of commits. This, considering the complexity of PTI, is good both for bisectability and for backporting.
So as long as the ~9 cherry-picks are cleanly structured and are explicitly marked, this is the best all around solution we could think of.
( The somewhat weird git-merge gynastics in the tree I sent to Linus are really
about merging specific versions of upstream that are content-equivalent with the cherry-picks, to avoid massive conflicts. v4.15 had various other changes to the files affected by the cherry-picking. If done naively the cherry-picked tree merge can generate over a dozen nasty conflicts. Doing it this way also creates more confidence in the cherry-picked base tree itself: -stable folks can trust it more because it will be 'obviously' equivalent to upstream as expressed by the conflict-free merge. )
I believe the fact that the PTI patches have already been successfully backported to v4.9, with only minor additional cherry-picking, demonstrates that this is the right approach.
Quoted 30 lines
I few things I noticed in the PTI tree:
"x86/mm/pti: Map ESPFIX into user space" has a leftover
pr_err(). Sorry, my bad, I've spent *way* too long looking at this crap to retain my sanity. Also, if you're feeling like being super tidy, theinit/main.cchange in their could be folded in to whatever patch addspti_init()in the first place, but it doesn't really matter."x86/pti: Map the vsyscall page if needed" has a change to
pgtable_64.hthat could be folded into an earlier patch. This is probably my fault for applying Dave Hansen's cleanup request to the wrong patch."x86/mm/64: Make a full PGD-entry size hole in the memory map" would benefit from a mention of "5-level" somewhere in the subject or changelog.
In "x86/fixmap: Add debugstore entries to
cpu_entry_area", I think the function "set_percpu_fixmap_ptes" is misnamed. It should be something like "allocate_percpu_fixmap_ptes", perhaps, and it should either warn or do nothing if the PTE is already present, I think. As it stands, it's a wee bit dangerous.
X86_BUG_CPU_SECURE_MODE_PTIshould be added toDISABLED_FEATURESorDISABLED_BUGSor whatever if it's not configured in, which will reduce bloat. Borislav, that's kind of up your alley, since I don't think the appropriate mask even exists right now.
Quoted 3 lines
Anyway, I stuck a few minor fixups here:
https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/log/?h=x86/pti
Thanks, we'll integrate all of this!
Also note that regarding PTI LDT handling, our plan is to stick to the review feedback consensus: i.e. we'll apply your PTI LDT fixes as the initial approach, plus an optional series later on once PTI is upstream, with the VMA based bits by Thomas and PeterZ subject to a fresh round of thinking & evaluation. Even if we decide to do the VMA approach, I don't think that aspect of PTI will be backported.
This should further simplify logistics and offloads risks as well.
Ingo
Quoted 8 lines · Andy Lutomirski
On Fri, Dec 15, 2017 at 8:07 AM, Ingo Molnar <[email protected]> wrote:
I few things I noticed in the PTI tree:"x86/mm/pti: Map ESPFIX into user space" has a leftover
pr_err(). Sorry, my bad, I've spent *way* too long looking at this crap to retain my sanity. Also, if you're feeling like being super tidy, theinit/main.cchange in their could be folded in to whatever patch addspti_init()in the first place, but it doesn't really matter.
I split it out into a separate patch and got rid of all the ifdef mess while at it.
Quoted 4 lines
"x86/pti: Map the vsyscall page if needed" has a change to
pgtable_64.hthat could be folded into an earlier patch. This is probably my fault for applying Dave Hansen's cleanup request to the wrong patch.
Done
Quoted 3 lines
"x86/mm/64: Make a full PGD-entry size hole in the memory map" would benefit from a mention of "5-level" somewhere in the subject or changelog.
Will do
Quoted 3 lines
In "x86/fixmap: Add debugstore entries to
cpu_entry_area", I think the function "set_percpu_fixmap_ptes" is misnamed. It should be something like "allocate_percpu_fixmap_ptes", perhaps,
Ok.
Quoted 3 lines
and it should either warn
or do nothing if the PTE is already present, I think. As it stands, it's a wee bit dangerous.
Well, it's not more dangerous than all the other fixmap stuff we are doing. The only difference is that it does not install a mapping, it just makes sure that the PTE page is populated.
Quoted 4 lines
X86_BUG_CPU_SECURE_MODE_PTIshould be added toDISABLED_FEATURESorDISABLED_BUGSor whatever if it's not configured in, which will reduce bloat. Borislav, that's kind of up your alley, since I don't think the appropriate mask even exists right now.
Will have a look.
Thanks,
tglx
Borislav Petkov
maintainerQuoted 6 lines · Thomas Gleixner
Quoted 4 lines
X86_BUG_CPU_SECURE_MODE_PTIshould be added toDISABLED_FEATURESorDISABLED_BUGSor whatever if it's not configured in, which will reduce bloat. Borislav, that's kind of up your alley, since I don't think the appropriate mask even exists right now.Will have a look.
Right, I converted X86_BUG_CPU_SECURE_MODE_PTI bug bit to an X86_FEATURE bit and then the DISABLED_FEATURES thing should just work.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.