Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1516308ybl; Tue, 13 Aug 2019 14:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8mf0S1lmUR/9cTvUQBMDrAAfVmDpSaIxjOLf35mB0PKteyHiTU4Yy+N5JJoIzYzDUEPYD X-Received: by 2002:a17:902:b698:: with SMTP id c24mr39666385pls.28.1565730439845; Tue, 13 Aug 2019 14:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565730439; cv=none; d=google.com; s=arc-20160816; b=twUAJsnwetDmXuzwZLyvoAm8OdUm/BDUMqeXeMpYC7PFTpF2aEXExXjpzselNsZl1q zS2LBLHF7eGTb2Xe1dn7Vqvm+lUxAChzXGnfBhvAh6B1SWLvqd2CQ35/1ZibL915uXxJ KG18bvJ3HgA6g+WjsNaLevgqiMoqKtw7VgwDBIdCanv5oE5QtlxyPHuDOeeLvakzy47m 06z8iIF2/iQULf3dcQ6VxhrmYh81ZSmKK9WolBrd7D6UqIYgRhemTLqU0IoKXDiVdXjp wRGOAkxHnX2Vxg7TNKzWF/mmr/qGfHSqQQX8FaMd0TIV/idYUKxRlQXOlgG3AkhIyCJW 5qVA== 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=KV5ITfIozABvu+65YnXr7MWXS9GpsEw4GavAfN3QIvA=; b=0p2khydIGYv+5igb0dSMUzoPEMvCC4uFJXpesew8OjLu9WfdrFiigl/+qgMOfnm285 kKaKB4SEFs5KmrQqBp30wlyqDfXlvvcXMwtU9HuqrweV6suAVBXHnE2LGr1tu5LsytCa r/xAZsDm4Dy44ld5aTzbQ0IBNVKaLonFQDnwkcw4VIig6cIyCaVcaNohvw/ttvpVyab/ NSc5Wc4d+VWBegRKh0kkO7YZHeh4bQ4SZgAU1T2ymKQBITIcV30Shr5N0loliYWsi9Qx uIzQ/405tIPwiirGGZCCtt9SoI9ZmkWL97OWZ14dKfEgMtJDpwqoc1GibVqNZCsvLNTd BkPA== 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 bg11si1581447pjb.72.2019.08.13.14.07.04; Tue, 13 Aug 2019 14:07:19 -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 S1726802AbfHMVCt (ORCPT + 99 others); Tue, 13 Aug 2019 17:02:49 -0400 Received: from mga06.intel.com ([134.134.136.31]:16071 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726734AbfHMVCo (ORCPT ); Tue, 13 Aug 2019 17:02:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 14:02:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,382,1559545200"; d="scan'208";a="187901366" Received: from yyu32-desk1.sc.intel.com ([10.144.153.205]) by orsmga002.jf.intel.com with ESMTP; 13 Aug 2019 14:02:41 -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 , Borislav Petkov , 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 , Dave Martin Cc: Yu-cheng Yu Subject: [PATCH v8 08/27] mm: Introduce VM_SHSTK for shadow stack memory Date: Tue, 13 Aug 2019 13:52:06 -0700 Message-Id: <20190813205225.12032-9-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813205225.12032-1-yu-cheng.yu@intel.com> References: <20190813205225.12032-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 731642e0f5a0..09521579cc8e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -684,6 +684,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 0334ca97c584..bc58585014c9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -298,11 +298,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 @@ -340,6 +342,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