Received: by 10.223.185.116 with SMTP id b49csp3210922wrg; Mon, 5 Mar 2018 16:38:00 -0800 (PST) X-Google-Smtp-Source: AG47ELv+Nj48wrwNyaSy5qQLG9KRx3QUw6JGt3SqOWZn1hiBc48GvQOLH0XaX+ufZj7CEiFIMO3f X-Received: by 10.101.65.71 with SMTP id x7mr13674779pgp.203.1520296679911; Mon, 05 Mar 2018 16:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296679; cv=none; d=google.com; s=arc-20160816; b=yZvQKU35aQFV4Mzzpq7AJEXR+MoABsnd3XmDKZlA6bV0XLXFqFXOsNgDNhPGe6VqTn J6kohTwZUp1ohXfF5T/0tiDsKRKLQ/0WtGAkQdTMsiwz6RkXQ9CU9NameiPjyzWJ7JQk vrWf2BT7h6vvPpN4UeU3SelR3t8vLhXMTBIMZLc0jIPlZTeQ8Yoc4JUwJPu4BtD4Gw49 GiRTNfB4MlfWMrnhVOtj5nfkrRcjz/51axUC+3CSz3H9mjE599bnXkjOymk+svuMXsYV CxIEt4huAsBuBSOPnHERCPjW0c98e2pNJRvQ8Ac93OTl4TsY/r2lpE0vSgfJ4BM6xopd h/mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=cBju0fcsWALdnxT2xkObz5EpSe54+uNW7LwMsIinAj4=; b=GhPm8ITOQ0RuLgIWk07W6nTdvUvyPqL+TsJH3BUNBIiuWe2K0VgoUfFf98WnVZBOgY M0rDo9U8/tJXzCbffe5EGuVwyVw/vEJxV0zL5ATkyfz+Zq09zQajYKZ9giMhGvTttkm2 eLY4/+oGgFO1fP/o2KH3292hxtZWpj4qzmMgJJz89fEX8GlTJbb3b8LFcol+KGljQ7Ng rD6S7hw3XI6yDo+vncKC/ulvrqhlhv6seGabFrlmh4R7V5nYni1PNSEmBtPAxK7B/HHS /zpWW5y0o2ERIMQKxpVx493/q29gRJo+V2Id4SEnou2cdq/K3HAywx312bLZwsaXsL2k p84g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=iV4bPvYh; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z96-v6si10152249plh.35.2018.03.05.16.37.46; Mon, 05 Mar 2018 16:37:59 -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=@oracle.com header.s=corp-2017-10-26 header.b=iV4bPvYh; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933453AbeCFAez (ORCPT + 99 others); Mon, 5 Mar 2018 19:34:55 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42866 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933265AbeCFA0g (ORCPT ); Mon, 5 Mar 2018 19:26:36 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260LT6V073663; Tue, 6 Mar 2018 00:26:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=cBju0fcsWALdnxT2xkObz5EpSe54+uNW7LwMsIinAj4=; b=iV4bPvYhTXFNYNNYB4PjuFc0FBnkTcmhnSFhHUgMeMCggH6nUMZg+JUm1aaa8S8+2Bce HdKyJI6Skru5p/Fhtu/sUyjgaTW84tDLou28mKJ9CTMPDJgUeZ1qcJe2CEsFEqiYCllV QjDQxKk4JPUvYz65PhbK2EPhhYAVN86Z4VpbGo3eS0qwhzZT0m2B/ltMGp1LeoxXplrm 0NOJcBKGlNPbeBjc1WXj6ktRiKEJO8tl7TaYVINbzc9rGS+ri/StBVC/rCKX7SDyLlOP mHRD91B2igzgt+aElT0sun2Qfdp3kTyQiLJq/uRDJGhtF3WZTDI3L6NlbCwvfx6S5P3J HA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2ghe5xgf0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:30 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260QURW025757 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:30 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QTso025114; Tue, 6 Mar 2018 00:26:30 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:29 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 35/65] kaiser: tidied up asm/kaiser.h somewhat Date: Mon, 5 Mar 2018 19:25:08 -0500 Message-Id: <20180306002538.1761-36-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=795 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hugh Dickins Mainly deleting a surfeit of blank lines, and reflowing header comment. Signed-off-by: Hugh Dickins Acked-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 5fbd46c4be78174656b52e1b04d3057a5dd7af66) Signed-off-by: Pavel Tatashin --- arch/x86/include/asm/kaiser.h | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/arch/x86/include/asm/kaiser.h b/arch/x86/include/asm/kaiser.h index 0703f48777f3..7394ba9f9951 100644 --- a/arch/x86/include/asm/kaiser.h +++ b/arch/x86/include/asm/kaiser.h @@ -1,15 +1,17 @@ #ifndef _ASM_X86_KAISER_H #define _ASM_X86_KAISER_H - -/* This file includes the definitions for the KAISER feature. - * KAISER is a counter measure against x86_64 side channel attacks on the kernel virtual memory. - * It has a shodow-pgd for every process. the shadow-pgd has a minimalistic kernel-set mapped, - * but includes the whole user memory. Within a kernel context switch, or when an interrupt is handled, - * the pgd is switched to the normal one. When the system switches to user mode, the shadow pgd is enabled. - * By this, the virtual memory chaches are freed, and the user may not attack the whole kernel memory. +/* + * This file includes the definitions for the KAISER feature. + * KAISER is a counter measure against x86_64 side channel attacks on + * the kernel virtual memory. It has a shadow pgd for every process: the + * shadow pgd has a minimalistic kernel-set mapped, but includes the whole + * user memory. Within a kernel context switch, or when an interrupt is handled, + * the pgd is switched to the normal one. When the system switches to user mode, + * the shadow pgd is enabled. By this, the virtual memory caches are freed, + * and the user may not attack the whole kernel memory. * - * A minimalistic kernel mapping holds the parts needed to be mapped in user mode, as the entry/exit functions - * of the user space, or the stacks. + * A minimalistic kernel mapping holds the parts needed to be mapped in user + * mode, such as the entry/exit functions of the user space, or the stacks. */ #ifdef __ASSEMBLY__ #ifdef CONFIG_KAISER @@ -48,13 +50,10 @@ _SWITCH_TO_KERNEL_CR3 %rax movq PER_CPU_VAR(unsafe_stack_register_backup), %rax .endm - .macro SWITCH_USER_CR3_NO_STACK - movq %rax, PER_CPU_VAR(unsafe_stack_register_backup) _SWITCH_TO_USER_CR3 %rax movq PER_CPU_VAR(unsafe_stack_register_backup), %rax - .endm #else /* CONFIG_KAISER */ @@ -72,7 +71,6 @@ movq PER_CPU_VAR(unsafe_stack_register_backup), %rax #else /* __ASSEMBLY__ */ - #ifdef CONFIG_KAISER /* * Upon kernel/user mode switch, it may happen that the address @@ -80,7 +78,6 @@ movq PER_CPU_VAR(unsafe_stack_register_backup), %rax * stored. To change the address space, another register is * needed. A register therefore has to be stored/restored. */ - DECLARE_PER_CPU_USER_MAPPED(unsigned long, unsafe_stack_register_backup); /** @@ -95,7 +92,6 @@ DECLARE_PER_CPU_USER_MAPPED(unsigned long, unsafe_stack_register_backup); */ extern int kaiser_add_mapping(unsigned long addr, unsigned long size, unsigned long flags); - /** * kaiser_remove_mapping - unmap a virtual memory part of the shadow mapping * @addr: the start address of the range @@ -104,12 +100,12 @@ extern int kaiser_add_mapping(unsigned long addr, unsigned long size, unsigned l extern void kaiser_remove_mapping(unsigned long start, unsigned long size); /** - * kaiser_initialize_mapping - Initalize the shadow mapping + * kaiser_init - Initialize the shadow mapping * * Most parts of the shadow mapping can be mapped upon boot * time. Only per-process things like the thread stacks * or a new LDT have to be mapped at runtime. These boot- - * time mappings are permanent and nevertunmapped. + * time mappings are permanent and never unmapped. */ extern void kaiser_init(void); @@ -117,6 +113,4 @@ extern void kaiser_init(void); #endif /* __ASSEMBLY */ - - #endif /* _ASM_X86_KAISER_H */ -- 2.16.2