From patchwork Fri Oct 26 12:28:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 10657335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD95814E2 for ; Fri, 26 Oct 2018 12:29:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1DFE2BF1D for ; Fri, 26 Oct 2018 12:29:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 963C42BF3A; Fri, 26 Oct 2018 12:29:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FC662BF1D for ; Fri, 26 Oct 2018 12:29:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 261C66B030A; Fri, 26 Oct 2018 08:29:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 04B876B030D; Fri, 26 Oct 2018 08:29:04 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC0C06B030C; Fri, 26 Oct 2018 08:29:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 8C0E26B030D for ; Fri, 26 Oct 2018 08:29:04 -0400 (EDT) Received: by mail-pl1-f198.google.com with SMTP id bb3-v6so484180plb.20 for ; Fri, 26 Oct 2018 05:29:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=uL2p6BHKYbhT2ZXdDUcAj+nCmVYiR9QIFmWTe85MHxU=; b=ZlI/kG6yufwuVC17qTV7+wpa+fKKUOq8y+PGkTUj3mrHvT7TfQ/y47fYWRCLNUnL/1 kbFh0puRhWMIy+lyl2O7fnkSSoiY5vcUltr51INetf3uqCpYZsO0SZ4GFSfhQ5e7qJdc CVfMusRlehADSQ48Tay6D0ebEbc8wj2A1cOEvQKMgJL+YkKgczenX3utq+9C+I5P7e/z X9O4p0CUggmJDWPos+TlkEJ4b69LwtFqxSn6VuVGR3gO1pOyGTG53IzOMQL2OX4JiGUV T8CsdfzuES6k0m2geaZKteF0YSnq8lv1Auxlea8MoYBAviGPIkvfvpYdlAujzJX9SVdF 5IPw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AGRZ1gKsdV4qeaR+T4juR1I5FoLohgG+400DA9A4h71U8mfxuMMyiqjL JKUPZhILyMhBZzAlc/fRewTVWC9nrswiuG2ghs9NnY4Wtc9RxHe+w3RHhfCaJb2aGcjHsTXdX/E L9Y7RGeFaor1gHeuy5cPM91W4yjoTmbgljO0Az3oSkcKCNr1cmPJxgu04GmxlJc8tzQ== X-Received: by 2002:a17:902:7408:: with SMTP id g8-v6mr3258669pll.168.1540556944233; Fri, 26 Oct 2018 05:29:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5c6Wo3KFevitn7dYqih3Uv5AH+id1ijVbrAQ+Wq1ndSyAl+4x1dNe8B6aU8zoHTsVmeL6mg X-Received: by 2002:a17:902:7408:: with SMTP id g8-v6mr3258617pll.168.1540556943308; Fri, 26 Oct 2018 05:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540556943; cv=none; d=google.com; s=arc-20160816; b=P5YNRPeqP6orbVJddcY8qE97uK+3q/akZcvWmNVvYMp/I3Ddz4/TfvM4xx3HZi8De4 6MdkEKjoKxZtfgOWHi+SPI16zLRgNIjMO44/smACnIVk6G6H3Baz3s84GRZsFJDD6AWM gSnQ+vzF44mEfO9gDiLBEzwCa35cdF2rbuVWFn4Pu12n0tKOvfwwmk+tvttNRlwcoMa/ l/ftcl2uU4H8KDUxNm+gwEAAQ3TCBD+Ls/4IbTyLXm/1aYb9rVEFIuC2uWK7n3kVaBsg 0KakL84+47+7rdnei2PgU0TBZogZSx9ShUSnd48//w8ZUsIPwBze3nrUqcVhhWPmzkL/ kBqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=uL2p6BHKYbhT2ZXdDUcAj+nCmVYiR9QIFmWTe85MHxU=; b=0QT+qeyy/bYCjGMq84H2OoPO9mHlSkQHjTgRLQf6IhFxcvG4aSthjfz/fnOeGQXl0K gXSWnFQb3L87hj5Oro8cMBAgssBLRNbeOhF66+EMWLkVIb05+htKImY5y3QY8Z1U4xHV msrp3FBt33DtOviHrzOrDLbIdKn+7fHksgkknobyELslDHVt+SFoRwStqOHkG4J3u/1H JLMNX0oYbIg1zN2pjQTRgC1jPQ2Ay4dQnf0lI3BOBQ7Co/gXGTJEbGCK0O42R+gh02Yv dBOj49IIargsG5N+eEiDmJ/zIMhP1zkp65rQcd1BnR3o3aR31+E94vIQPgbAXKTOddoC YkMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id c23-v6si10537010pls.348.2018.10.26.05.29.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 05:29:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of kirill.shutemov@linux.intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 05:29:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,427,1534834800"; d="scan'208";a="103504873" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 26 Oct 2018 05:28:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id B82EF33A; Fri, 26 Oct 2018 15:28:57 +0300 (EEST) From: "Kirill A. Shutemov" To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org Cc: boris.ostrovsky@oracle.com, jgross@suse.com, bhe@redhat.com, willy@infradead.org, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv3 0/3] Fix couple of issues with LDT remap for PTI Date: Fri, 26 Oct 2018 15:28:53 +0300 Message-Id: <20181026122856.66224-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP The patchset fixes issues with LDT remap for PTI: - Layout collision due to KASLR with 5-level paging; - Information leak via Meltdown-like attack; Please review and consider applying. v3: - Split out cleanup in map_ldt_struct() into a separate patch v2: - Rebase to the Linus' tree + fix conflict with new documentation of kernel memory layout + fix few mistakes in layout documentation - Fix typo in commit message Kirill A. Shutemov (3): x86/mm: Move LDT remap out of KASLR region on 5-level paging x86/ldt: Unmap PTEs for the slot before freeing LDT pages x86/ldt: Remove unused variable in map_ldt_struct() Documentation/x86/x86_64/mm.txt | 34 +++++++------- arch/x86/include/asm/page_64_types.h | 12 ++--- arch/x86/include/asm/pgtable_64_types.h | 4 +- arch/x86/kernel/ldt.c | 59 ++++++++++++++++--------- arch/x86/xen/mmu_pv.c | 6 +-- 5 files changed, 67 insertions(+), 48 deletions(-)