Received: by 10.223.176.46 with SMTP id f43csp2139481wra; Sun, 21 Jan 2018 12:13:56 -0800 (PST) X-Google-Smtp-Source: AH8x224B1ewIGOLQzi2XXz5pyqs6vHLqDkB25+YQX5aElS2hvFFBqb1E2DdPLgayl57a3zM72UH9 X-Received: by 10.99.123.8 with SMTP id w8mr5220213pgc.201.1516565635982; Sun, 21 Jan 2018 12:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516565635; cv=none; d=google.com; s=arc-20160816; b=XSulGnfk9YjzvATpXo1X9DMFl9XpKlc43oR6Lp1W0F54HFSwkhES96oalVJ2PW4NOR 2WUBelhj+/i41/d18fen6sqPtg9yOhFllTKbsAZ+JyB7If6zHNrh2BN+7VHyfIu3aASu 7FD2/M9zlVM5Ulru1W9Til7MrzwGLriAAtiP06tACBFhNKfK/HJqUZQYlLkLKHVglH// iv/TVz8qmlRz04LKPJV/QLxRwo38glxnVIIQiu6EvgjT3u48PqlObIFeeZ6zGawYqrgA lQ/KRfeq+zKRhuzr1004luyuEEGR5xR2c7fVISXy4dg5lXFDpduW6trT5EznEc99Ivt6 neYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=qmL0ysBZnLwvWAEE68EnDmrJrYR3HNqNE9trALNzntI=; b=ZsO11rEoKe2Zm7nNRXEDbN433AACJF+2QHdmcchAN2J64RJ+fi0eCd7DTj8gMnmcy5 RqJsGbR81brmcmE8ejwkJKSPfXkDOZ3vl3+SEhjVnTowAkaANKje5jVtLj2fS4VfZR1E P3GKxn+PEAIjMZ1qOlxOf3W9ufrfcIwQB1P981eB5yvG5rtknShILCl/Elg8Whm80b+t vQj58zdeyj68NodxpT/FzvFU2Q+JgVlTBBWcm1JNqYZpocmFs+ytkh5tuyvXsdKPqzWj J8CEtC1i8HrQzum1Sw8m+ptSS66Kd4MH/9XaKAHH392YS/tBYi+F7JFuFO4iexlM8mFT 3U/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zzx+55SS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e89si14073336pfm.109.2018.01.21.12.13.41; Sun, 21 Jan 2018 12:13:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zzx+55SS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750993AbeAUUNS (ORCPT + 99 others); Sun, 21 Jan 2018 15:13:18 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:40548 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbeAUUNR (ORCPT ); Sun, 21 Jan 2018 15:13:17 -0500 Received: by mail-pg0-f68.google.com with SMTP id g16so5452429pgn.7 for ; Sun, 21 Jan 2018 12:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qmL0ysBZnLwvWAEE68EnDmrJrYR3HNqNE9trALNzntI=; b=Zzx+55SSR3NtJFyEFOh7pnoRKeayURrrH1vZIsy8k8bRNWd8byOWXaY62ULMxDe0sT DQGWYmhJ/9RLWkIX+uLqukzbj9oOH2tPtuOoVXGF3tvnCjjY3ppvUY1LZz1OhGEgEOoO xtPQLZJM6Oq4LTmk8Z34C4c9ez4/kNMJ3FWUBo7vD8h3CNvx4nmmML/jCn54ihkLj+8i PhlHm6OccSwclZ1bOe+ebpnQ0v6qp4f1aVlUIa6HMPWtHKPESWLh4TZTzlMvh/DaIMeG kpimsmRZ2xuFJKTR+IRHN2Lk2RXVWbavFSo/WxXHv+Tx7Z97Djbv/9QcGrrCZYMdNEFS n4hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qmL0ysBZnLwvWAEE68EnDmrJrYR3HNqNE9trALNzntI=; b=h7jTZpHcZaW5IzfAr6huFbsEIR6dEr9BinhcdAazydinJPHPoDx0a5AuZYD4q//Pj/ ZaECVzeshSQZELX54wuXdEav4OxdZqY7ah8PVae9ID8KdJyMJLW5hx8pJtsQLusx18Ol a/8jtlNFbeOqzNr1fTpIQ+xyIYvoasvpNFW+Dgvz5qlUDmxsz6yj0BefjA6DD1psGVYV lK+rGLngghdyWtq6gZEWqT9Mp2wTsNQdbr9g1+0+vAaf2svfLtmjeHVt9mMV6v1CpiAy PCZEPW53TBSt+Sc/xTSM44WMaZoJzmkWuklHTxNDhJuEFjDwdNri+nzCRES1svk4omnt yArA== X-Gm-Message-State: AKwxytcrSLgyvmw3TvJIvWI22g+E5gYfHd3j+yspvD1nG+Md91KMwZ2n xM2J5F+jw8NwlCB17WrKjYU= X-Received: by 10.99.124.4 with SMTP id x4mr5439256pgc.316.1516565596339; Sun, 21 Jan 2018 12:13:16 -0800 (PST) Received: from [10.2.101.129] ([208.91.2.2]) by smtp.gmail.com with ESMTPSA id r88sm23898781pfb.17.2018.01.21.12.13.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Jan 2018 12:13:15 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [RFC PATCH 00/16] PTI support for x86-32 From: Nadav Amit In-Reply-To: <1516120619-1159-1-git-send-email-joro@8bytes.org> Date: Sun, 21 Jan 2018 12:13:13 -0800 Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , the arch/x86 maintainers , LKML , "open list:MEMORY MANAGEMENT" , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , jroedel@suse.de Content-Transfer-Encoding: quoted-printable Message-Id: <5D89F55C-902A-4464-A64E-7157FF55FAD0@gmail.com> References: <1516120619-1159-1-git-send-email-joro@8bytes.org> To: Joerg Roedel X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am looking on PTI on x86-32, but I did not mange to get the PoC to = work on this setup (kaslr disabled, similar setup works on 64-bit). Did you use any PoC to =E2=80=9Ctest=E2=80=9D the protection? Thanks, Nadav Joerg Roedel wrote: > From: Joerg Roedel >=20 > Hi, >=20 > here is my current WIP code to enable PTI on x86-32. It is > still in a pretty early state, but it successfully boots my > KVM guest with PAE and with legacy paging. The existing PTI > code for x86-64 already prepares a lot of the stuff needed > for 32 bit too, thanks for that to all the people involved > in its development :) >=20 > The patches are split as follows: >=20 > - 1-3 contain the entry-code changes to enter and > exit the kernel via the sysenter trampoline stack. >=20 > - 4-7 are fixes to get the code compile on 32 bit > with CONFIG_PAGE_TABLE_ISOLATION=3Dy. >=20 > - 8-14 adapt the existing PTI code to work properly > on 32 bit and add the needed parts to 32 bit > page-table code. >=20 > - 15 switches PTI on by adding the CR3 switches to > kernel entry/exit. >=20 > - 16 enables the Kconfig for all of X86 >=20 > The code has not run on bare-metal yet, I'll test that in > the next days once I setup a 32 bit box again. I also havn't > tested Wine and DosEMU yet, so this might also be broken. >=20 > With that post I'd like to ask for all kinds of constructive > feedback on the approaches I have taken and of course the > many things I broke with it :) >=20 > One of the things that are surely broken is XEN_PV support. > I'd appreciate any help with testing and bugfixing on that > front. >=20 > So please review and let me know your thoughts. >=20 > Thanks, >=20 > Joerg >=20 > Joerg Roedel (16): > x86/entry/32: Rename TSS_sysenter_sp0 to TSS_sysenter_stack > x86/entry/32: Enter the kernel via trampoline stack > x86/entry/32: Leave the kernel via the trampoline stack > x86/pti: Define X86_CR3_PTI_PCID_USER_BIT on x86_32 > x86/pgtable: Move pgdp kernel/user conversion functions to pgtable.h > x86/mm/ldt: Reserve high address-space range for the LDT > x86/mm: Move two more functions from pgtable_64.h to pgtable.h > x86/pgtable/32: Allocate 8k page-tables when PTI is enabled > x86/mm/pti: Clone CPU_ENTRY_AREA on PMD level on x86_32 > x86/mm/pti: Populate valid user pud entries > x86/mm/pgtable: Move pti_set_user_pgd() to pgtable.h > x86/mm/pae: Populate the user page-table with user pgd's > x86/mm/pti: Add an overflow check to pti_clone_pmds() > x86/mm/legacy: Populate the user page-table with user pgd's > x86/entry/32: Switch between kernel and user cr3 on entry/exit > x86/pti: Allow CONFIG_PAGE_TABLE_ISOLATION for x86_32 >=20 > arch/x86/entry/entry_32.S | 170 = +++++++++++++++++++++++++++++--- > arch/x86/include/asm/pgtable-2level.h | 3 + > arch/x86/include/asm/pgtable-3level.h | 3 + > arch/x86/include/asm/pgtable.h | 88 +++++++++++++++++ > arch/x86/include/asm/pgtable_32_types.h | 5 +- > arch/x86/include/asm/pgtable_64.h | 85 ---------------- > arch/x86/include/asm/processor-flags.h | 8 +- > arch/x86/include/asm/switch_to.h | 6 +- > arch/x86/kernel/asm-offsets_32.c | 5 +- > arch/x86/kernel/cpu/common.c | 5 +- > arch/x86/kernel/head_32.S | 23 ++++- > arch/x86/kernel/process.c | 2 - > arch/x86/kernel/process_32.c | 6 ++ > arch/x86/mm/pgtable.c | 11 ++- > arch/x86/mm/pti.c | 34 ++++++- > security/Kconfig | 2 +- > 16 files changed, 333 insertions(+), 123 deletions(-) >=20 > --=20 > 2.13.6 >=20 > -- > To unsubscribe, send a message with 'unsubscribe linux-mm' in > the body to majordomo@kvack.org. For more info on Linux MM, > see: http://www.linux-mm.org/ . > Don't email: email@kvack.org