From patchwork Wed Jul 18 09:41:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C81D600F4 for ; Wed, 18 Jul 2018 09:43:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C68928FBC for ; Wed, 18 Jul 2018 09:43:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4055428FCD; Wed, 18 Jul 2018 09:43:13 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 DF5B228FC3 for ; Wed, 18 Jul 2018 09:43:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18CE86B02A9; Wed, 18 Jul 2018 05:41:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0C1ED6B02AC; Wed, 18 Jul 2018 05:41:41 -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 EF1F86B02AB; Wed, 18 Jul 2018 05:41:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 8188F6B02A4 for ; Wed, 18 Jul 2018 05:41:40 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id r9-v6so1701703edh.14 for ; Wed, 18 Jul 2018 02:41:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=la5VavRPsaC+bKEOgIE7pJRPYLu0q2aG/KDKNFLDuaQ=; b=X7IT4VFHQWxUmD8I2iSAOxEcuq4CVxQtB/CUhG87vevsAMLW0NkyVNsGhvpFy5IPJ2 wPc2ealrRVFlNimZEzTIIxOVNSYIEGq7p/Rai4Zv+JoXHnQZOr//y5McSuEBOkCdShDS LXwxab9vAx1ITls7B60fwO3CZCkuGtx4ao34GKsATEU4lxxiB2bZ/5gtIH27WNT1MY46 aBQagH+Z6JLPL2JLxJZC+1P7jv4/57Xm00iTUKJo8YMuJ5uw+pv+2GEA6Zn9xwtTbFS1 k+PS1DhlGMegeEUc9UxJF4t2CtF8cN78sk7da7wPT1ajCI/ieU0qmFUkvDN6DTtOpA+/ oNrQ== X-Gm-Message-State: AOUpUlGkpUsS+ef5SEWTEdZtUQWgYfTlgPGk+/ukc1SPoGvuZQC51EjJ 3RQlly6Ov3AufIAA/dyhbErOX4s06bKZOwINbVhjI4ZQUOzVvcJKCeY4lTQMRBtpYnchcvGUXwY kRiNO+JN/paWipy0Qz1Nn2hEbMPtW2rNc41Ttwp9HFKi/pwZb6O4MqVQdvYhPmZYmmg== X-Received: by 2002:a50:9493:: with SMTP id s19-v6mr6342608eda.285.1531906900082; Wed, 18 Jul 2018 02:41:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8qtNDHEgiH6Nzj0iP6dKQmYO+fJbxpuV4DGv0yU0aanQ57RfIbfEtCWCOqsP98qQ+/tZj X-Received: by 2002:a50:9493:: with SMTP id s19-v6mr6342567eda.285.1531906899382; Wed, 18 Jul 2018 02:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906899; cv=none; d=google.com; s=arc-20160816; b=M6+ZewIDvhN9yBFxCFrSEZ3DZJMji4v5V6q0xUJLVjDHvzAWsnFZjnykEO3dTyK4JB OWQ89433jx0OvJCjW4GYAeTpbW49FnlzOBssOvVFR6auyPJsAJg5KTGJpZ9GDUFEQsK5 O3+20gfiqOr4ZWZrCiA/+dnaXDZaA5gy+kxeRaP1CJW+5cXvsYpgfo+4F/tT0k5fbEI3 DhvJjtG8XPCuTlMyzuEDJo2yUTD2D+XttzpI8KDwGcXHyN+r7XLtZUWNo6rqHZVZekEQ VsV5AhaftFprWbkjPALsBLF2p0eF52m9HznSVZNg/V9cmks6BpWefQ2kGNdYhj+7Krxl R95Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=la5VavRPsaC+bKEOgIE7pJRPYLu0q2aG/KDKNFLDuaQ=; b=XUS4r9YE5E0wNZu502fEoAMZ29lZzthMsPpC9rsNr1DVSkNp2a37HbOQ+HrFAzk9f5 0sKqNb4sXW4D53a5fPYEDAy/MjTwDadI6awHU34cmxAExLy6O1PSb8DdANWHVsM8/hGw +ol2IDMk5fi0/dYcQFALhtj8mqkmjAncHiDS72J9Zj1iBI/YFAZIqW7PlY+4AXAcGkXQ X7zdzwOpLTNqlyDpWzwN9aMH9IkkZ5il+Onjjhf9OyKRrZAfVQHoZlLNgEgwJ52/W/FJ CsVC+8l80ozol6XNp+nI+nYOsXm159C+e9ptrBTGDGa+X5KLS76lcoSDcC+9t2DyVSY2 gmPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=gtRHiGt0; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id d7-v6si77849edp.133.2018.07.18.02.41.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:39 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=gtRHiGt0; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 0717BAA4; Wed, 18 Jul 2018 11:41:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906886; bh=mDYOiNc4qhumS/zaIILgLYcqAgOrdsgG0V0cjiaHnEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gtRHiGt0vX2hk4ury3lN6AxLYHHRGMHqomly2Ik+enYPJa7H3I63e3fxtTxKJ6QPh WaygQsLvJgkapDRjLe2UhDKeQx2BkKEChQc/NlNvbT1TiGELXtGlyZMFOUIcn9NYCU xiU5SX04LmEHFBIPc0XsBzi1AAGkRLMsddq+0jO5ebLG8yNSLDIgBlVnaL27GDZHb5 Oy12vTwNQXXETfPwg4fvptR8sn3Pe3a9D3gX3rpMtBk2PxdtubaZrAkJJJDa+Y9mH3 9TOe60nOw55qw6Zqi1Bvk74TbmQSZIoEkFyW8zviJrHaZlcwRC25i+WQjq5VMOu0x1 /EGTMXIDAOOCQ== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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 , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 34/39] x86/ldt: Define LDT_END_ADDR Date: Wed, 18 Jul 2018 11:41:11 +0200 Message-Id: <1531906876-13451-35-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-1-git-send-email-joro@8bytes.org> 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 From: Joerg Roedel It marks the end of the address-space range reserved for the LDT. The LDT-code will use it when unmapping the LDT for user-space. Signed-off-by: Joerg Roedel --- arch/x86/include/asm/pgtable_32_types.h | 2 ++ arch/x86/include/asm/pgtable_64_types.h | 1 + arch/x86/kernel/ldt.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h index 7297810..b0bc0ff 100644 --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -53,6 +53,8 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */ #define LDT_BASE_ADDR \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK) +#define LDT_END_ADDR (LDT_BASE_ADDR + PMD_SIZE) + #define PKMAP_BASE \ ((LDT_BASE_ADDR - PAGE_SIZE) & PMD_MASK) diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 066e0ab..04edd2d 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h @@ -115,6 +115,7 @@ extern unsigned int ptrs_per_p4d; #define LDT_PGD_ENTRY_L5 -112UL #define LDT_PGD_ENTRY (pgtable_l5_enabled() ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4) #define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) +#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) #define __VMALLOC_BASE_L4 0xffffc90000000000UL #define __VMALLOC_BASE_L5 0xffa0000000000000UL diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index c9b1402..e921b3d 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -206,7 +206,7 @@ static void free_ldt_pgtables(struct mm_struct *mm) #ifdef CONFIG_PAGE_TABLE_ISOLATION struct mmu_gather tlb; unsigned long start = LDT_BASE_ADDR; - unsigned long end = start + (1UL << PGDIR_SHIFT); + unsigned long end = LDT_END_ADDR; if (!static_cpu_has(X86_FEATURE_PTI)) return;