From patchwork Wed Jul 11 11:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519521 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 19516603D7 for ; Wed, 11 Jul 2018 11:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BE4D28592 for ; Wed, 11 Jul 2018 11:32:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E911285A5; Wed, 11 Jul 2018 11:32:22 +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 A8BCC28592 for ; Wed, 11 Jul 2018 11:32:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C45086B0291; Wed, 11 Jul 2018 07:30:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B7CDA6B0293; Wed, 11 Jul 2018 07:30:22 -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 A43326B0294; Wed, 11 Jul 2018 07:30:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 3F76F6B0291 for ; Wed, 11 Jul 2018 07:30:22 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id b12-v6so9468815edi.12 for ; Wed, 11 Jul 2018 04:30:22 -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=IqkJUgnphGy+T3udr2bKv/XvTq0CcuJirT+FoXC74G7IdGk56LtraSDcvQfOeI+xdI 3fhGmb/kbwQplBYfB40x6ancfzJHI40RUJzSlsS9fKvzgMKoq6mCL2qrHwPM+6sK6u9y 2UEz1UR9lFuAaq7nAcq6/Bji+Be2B7suI1KJ1+cVsG0xQZs6sMKV33uuwzOrfLbn3g+r +jydrm8/edTJGgqh6wwJGFaN0145ABlPW3oTkiId6rG4xrag8eMMKHZtgd2q0gomVCFw NKwkZYCkpaOWqJ8Z5d5Ueqx/pua4qSz06nCwKQbeerHud0XzCVyC70yBqR8R+H2Mu6lg QMyA== X-Gm-Message-State: APt69E0l1fmJH95m8bImSuxLpZYsb7JJK2krgcSSQymIVDYW0mcsBdXL yZFLnkIvWV8D5ikvBIssqacPjW5QOiUwY7YZm+8v9dlRBlNjAM/kZr4mdL7YGzysmefQaqNto19 UyAFY/Ip6a1aOOfzOsFsf9sr5GIhBbHHAYFrZC4VeESp9eqDWPwtXZor6B3b+IuXRjQ== X-Received: by 2002:a50:a666:: with SMTP id d93-v6mr22255671edc.244.1531308621826; Wed, 11 Jul 2018 04:30:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeS02/fsPsmCN9+Jk8aEF9yaag3pHO6mzrwADgWhg4Ds9zzXDh8oMG0Ta5Y1iO6kk/a2L0C X-Received: by 2002:a50:a666:: with SMTP id d93-v6mr22255640edc.244.1531308621220; Wed, 11 Jul 2018 04:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308621; cv=none; d=google.com; s=arc-20160816; b=fhC1sY6Xvg5vpIMOat7aXiKQFgvi53MEBYpC7uS2KuasnqlyWDz7T3hov5RcAWl0G8 Y4DbsTbt+Q0nSxaJ88g5dnh9Fl01cx/pkStq7JgCd8Kl/lEwm2laHRft/sM4oFzHt8nt nud4bPUqQ5SMceWw2uS3D3fwjnItnRQSIca/m/GqWdzA7Vre7wMpu+9pxWUdzGopOY+y 4KwagxjnO52gEqJIJV1p7wHbYFRJpjpLDzFIchhMrRzZXjLnWZaFhRKcSC9DRpxO/Mhf l5oXp6ea1B3CdKHs+4XZVVu3i2nwU8vLL3YP0hfsLP9j2HDGP1vphAptVCxExGd/Vy5k Dsgw== 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=vQYYdhLk6L7KFDdJWfA1UHHmCuAwToa40UIq3hEe2vk3KV+SoscCxAr1eMuljOzV6U fms6DPe762RyGfnoktzC4zU14bdMDuPVqGQ7eTGrjqZm3iZbnSA5bgR1ihicMbvEt7Xl K+pFjbkOTe6NnNgrvUdsLZt/hzjNdUPWDdIqX8HVOJpQmxaZTcpMBkAFFJpGmefodNln rEsrKQ+iufn6gGiR2fYe2m0jpl5lYC+xDNDWr8L8dkC30SXd51o2M4/6NaOXyoZhCdLf JVqb4YU1yii2hTHLlAidBxkRUzTnXG9oSGihudGkyom3Beta4XfRPfxBNJsUiu8ar5n8 bvCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=OKrtijFd; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 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. [81.169.241.247]) by mx.google.com with ESMTPS id w43-v6si2443728edc.207.2018.07.11.04.30.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:21 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=OKrtijFd; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 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 E8BFD2420; Wed, 11 Jul 2018 13:30:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308607; bh=mDYOiNc4qhumS/zaIILgLYcqAgOrdsgG0V0cjiaHnEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKrtijFdedXgVYTa8QnMSSSzWuqBwtNa0ylFh/Quvxwpy5Pstpqq+Efzcnx5VbuRn 5+KqPNQCzaoddKPoMfHGnODx13q6nMwCmqs9Kh2rbi8kBNDfLMinBkL5lhSuUJqy24 56QVdT3IFdV0kgJ8Add9pl9PdniS1wy9dVxD1Y0W9nzipf1ao6UecpD17Gz/rvryaJ 5t++x4X7HNIsJoIXfV9R1Hbu2uTS7DOn5uYnQ9ylo9Aznrxyyy02jKhEJl+xcPYG52 ZHhlzXFoIDw3bepC97t5HzKmOXW5LT6VDDudnmZUCQ42rHDQ5pGLMSBsRnVTAyriE8 VcaSZIiXzMzDA== 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, 11 Jul 2018 13:29:41 +0200 Message-Id: <1531308586-29340-35-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-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 Reviewed-by: Andy Lutomirski --- 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;