Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2316191imm; Thu, 11 Oct 2018 08:24:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV627QZgVL/OsZ8aCzq5eKpSg9NiAbNkuZQGcjRF4cqTWlqQrxE/nPR9rgI6zx/gRhJa9UqQe X-Received: by 2002:a62:8708:: with SMTP id i8-v6mr2032064pfe.150.1539271463477; Thu, 11 Oct 2018 08:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539271463; cv=none; d=google.com; s=arc-20160816; b=HRLY89cihIs8K4yZxtu7q+duQAm6ZDl8Mb9vzzG8uGBjySZ3XJsmeNCKlSQY8vGTFF Vw1yIo2M9V5ZC/pOO66JObwRogO2v0E3iQNJhVrNk5H2gndrq71OUbT1TGxZKW2KGrG0 qUPWYj5MvxJ6WOZt5zbL/JpjWRRO6ShZ+Y+VEWiyZY8ph+ykC46Yy8jZJinrxaSn65JN gMrRqw7KGzkYfeXDZpOUXPlb5pUGhwnoORAhy+1Hre5pNP4QoES7hTJSJby+BviPTQS7 9wY9/VFtMHFVymtBgb6Eu4UvNXA3pQxJIC3imoVcKf1h+6t5fj6UTShr7BG7jPCMaaWD SvMQ== 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:cc:to:from; bh=D27RwH8NeKlKuxHKwLxQrrM0B4XZoNvu8mXVfNenXUU=; b=b/ZrIUyjCU8Z7tg21NNDUsH0gx453kC/dQrTxMK4IrshMMXJvKkpqZJhMwWthAjbcj cmMA17/u20cMFZ8czOr2flCISS/4ezhit0tRqfMrT3FvOZE8ahEIq0EG6W/Qg86ruUey HFabMTvIYjYI95gx3pEwXRoUwiYjXU9iyDgWDpVSWpzyVsNzElbkumwxq3+fRGiZWL3/ hvRoGRVWWg71gdSzy3gO8sM7l3pQFxP7cfWZFdGySDs0n+PYp/eGhaUxgTwV+/6tzzyr AEc0PcgolF1zAGhZj5jIjtu/eBNVQiqZaTGNl6k3hVTHn+hBK8KAMlDl4s1j8XYiq6ap nakQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4-v6si2456873plk.24.2018.10.11.08.24.09; Thu, 11 Oct 2018 08:24:23 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbeJKWs0 (ORCPT + 99 others); Thu, 11 Oct 2018 18:48:26 -0400 Received: from mga05.intel.com ([192.55.52.43]:3990 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbeJKWsY (ORCPT ); Thu, 11 Oct 2018 18:48:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 08:20:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="78019105" Received: from 2b52.sc.intel.com ([143.183.136.147]) by fmsmga008.fm.intel.com with ESMTP; 11 Oct 2018 08:20:44 -0700 From: Yu-cheng Yu To: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue Cc: Yu-cheng Yu Subject: [PATCH v5 09/27] mm: Introduce VM_SHSTK for shadow stack memory Date: Thu, 11 Oct 2018 08:15:05 -0700 Message-Id: <20181011151523.27101-10-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011151523.27101-1-yu-cheng.yu@intel.com> References: <20181011151523.27101-1-yu-cheng.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VM_SHSTK indicates a shadow stack memory area. The shadow stack is implemented only for the 64-bit kernel. Signed-off-by: Yu-cheng Yu --- fs/proc/task_mmu.c | 3 +++ include/linux/mm.h | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5ea1d64cb0b4..b20450dde5b7 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -652,6 +652,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) [ilog2(VM_PKEY_BIT4)] = "", #endif #endif /* CONFIG_ARCH_HAS_PKEYS */ +#ifdef CONFIG_X86_INTEL_SHADOW_STACK_USER + [ilog2(VM_SHSTK)] = "ss" +#endif }; size_t i; diff --git a/include/linux/mm.h b/include/linux/mm.h index 53cfc104c0fb..f658923e76ad 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -224,11 +224,13 @@ extern unsigned int kobjsize(const void *objp); #define VM_HIGH_ARCH_BIT_2 34 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_BIT_3 35 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_BIT_4 36 /* bit only usable on 64-bit architectures */ +#define VM_HIGH_ARCH_BIT_5 37 /* bit only usable on 64-bit architectures */ #define VM_HIGH_ARCH_0 BIT(VM_HIGH_ARCH_BIT_0) #define VM_HIGH_ARCH_1 BIT(VM_HIGH_ARCH_BIT_1) #define VM_HIGH_ARCH_2 BIT(VM_HIGH_ARCH_BIT_2) #define VM_HIGH_ARCH_3 BIT(VM_HIGH_ARCH_BIT_3) #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) +#define VM_HIGH_ARCH_5 BIT(VM_HIGH_ARCH_BIT_5) #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ #ifdef CONFIG_ARCH_HAS_PKEYS @@ -266,6 +268,12 @@ extern unsigned int kobjsize(const void *objp); # define VM_MPX VM_NONE #endif +#ifdef CONFIG_X86_INTEL_SHADOW_STACK_USER +# define VM_SHSTK VM_HIGH_ARCH_5 +#else +# define VM_SHSTK VM_NONE +#endif + #ifndef VM_GROWSUP # define VM_GROWSUP VM_NONE #endif -- 2.17.1