Message ID | 20181119214809.6086-25-yu-cheng.yu@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D6206C5 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 310F02A583 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24E862A6EE; Mon, 19 Nov 2018 21:55:24 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham 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 BC0062A583 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0870E6B1CA6; Mon, 19 Nov 2018 16:54:36 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0151B6B1CA7; Mon, 19 Nov 2018 16:54:35 -0500 (EST) 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 D2F4F6B1CA8; Mon, 19 Nov 2018 16:54:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by kanga.kvack.org (Postfix) with ESMTP id 8F9B66B1CA7 for <linux-mm@kvack.org>; Mon, 19 Nov 2018 16:54:35 -0500 (EST) Received: by mail-pl1-f198.google.com with SMTP id w7-v6so24593239plp.9 for <linux-mm@kvack.org>; Mon, 19 Nov 2018 13:54:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=u4R5q5qMWOYQdLv8bWwZPIQsE0aBT0lrX51J+drB2sQ=; b=PZ7+Krh1Fkhw6ANUT+aecy+RpEsCkLb09ESw7kAePC60ojCVtns4xpdC63raugF31T 7p7/87xMMP5SIXb4jgOpBd92lnP6iVk8EPWkeWVqzvs2f89/Sa4xpDUO3uERAxcpte22 Pq4g6dxwnaH3QOq3fhh3h928CZj3NusPVQhebjb27usMeNCJaUu1F8YTL/QbPj5FTmU5 jlHgrdK3PeYU/AKaVqHsuyC75jNi3D5m1enJYVekWXZA/7elwM+AZTsIgpwFraCDEuQE DZGORiThR2GuWKD4k7nCnn2NzVd1HDS/o4EZhVpMwD2STiNBbjo6cQaDndpf7QuJbYqT NNXQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AGRZ1gKlapnNRfS9ADfgyiITPwZQ7ISyjW7ARcgLRTdvRHvUgLqkR4b9 bbPW2qr1t/soZ2ZBcIHXGo+qAnMTsGpCwKxMm3LdD57JyEkTKI5c6C65kQiuGhp0Qj/ZKjUqlfS IYnpbVSZWcsf9KrjgAGDS4fRDQL6jnNB+y38oz/OAXt+nMAb0cyAgi1+SzOLbcg+i9A== X-Received: by 2002:a63:36c4:: with SMTP id d187mr21256341pga.404.1542664475278; Mon, 19 Nov 2018 13:54:35 -0800 (PST) X-Google-Smtp-Source: AJdET5eGnuDoN0dX+f9CAQlbOZNpipMZyBxSYDSfXV8bc/WOf2FWapX37zO0afCPk6P/Y6iSguXU X-Received: by 2002:a63:36c4:: with SMTP id d187mr21256301pga.404.1542664474409; Mon, 19 Nov 2018 13:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542664474; cv=none; d=google.com; s=arc-20160816; b=o4+EUQS4kNqdhTfmvzKMtms55aGImzUrYXvlPze/IfQMnIEjI/MDJmUoJQI8aWHpXU PsA9spcG+LcWwRMpxuqL5r8YWkZxDEvHl0g2mQJZlVfNxe2NAWDMwWoCB58C1BEZv1xD FFCJl4K1coMez1hbJfTN/sgYxLquD39NNkBTiIv84Rxx1XKAsnltq+qSMNnQqQj/Oc8l bHnkiYOmWjt7eBpbNd2Ek+Ow9v2htTIVrrejLQ2++zdx+huyLbcpVPbnn/Y8niKlJt6u NZ4LG3d1qqqreamrL0tx8/h4kfHV0GJ5pCIPx/Fvi+hgGjOZbwZJoer0oLQ4CfywtoTP taZw== 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; bh=u4R5q5qMWOYQdLv8bWwZPIQsE0aBT0lrX51J+drB2sQ=; b=q50z3nsMvejcdWMSZBjzh18ivwLnFqzpo5kEee5vlogd8HK7g4RkGuYFQa1jcPxw9q sFEpmPexg5a5eybJHSV7LkQMqmd7hIu71Rr58uIIraNvOegpa5XnKttuFNGltJHQr/8M FPvaABWbrJ99fF/Zi4sMC6poWUCMv+vG8p5eHgDGHYS4zp0MxoUNEuq8/IXvX68sNvgA f+ydiE8nplawOXuXqcEYw0TDsMFlLTvRq4R4Ofps6BON9DzHMa3tBZLd3P0FjEY0bgFw 1DKUZRCE8p5dP1Yg+PLf+fBq+ZilH84t/2mCNgA1J9KAbn1CeuwFdJhdlRJ1B6GbRtpb ADRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTPS id o11si40652866pgd.234.2018.11.19.13.54.34 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 13:54:34 -0800 (PST) Received-SPF: pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.93 as permitted sender) client-ip=192.55.52.93; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Nov 2018 13:54:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,254,1539673200"; d="scan'208";a="93319916" Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga008.jf.intel.com with ESMTP; 19 Nov 2018 13:54:33 -0800 From: Yu-cheng Yu <yu-cheng.yu@intel.com> To: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, 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 <arnd@arndb.de>, Andy Lutomirski <luto@amacapital.net>, Balbir Singh <bsingharora@gmail.com>, Cyrill Gorcunov <gorcunov@gmail.com>, Dave Hansen <dave.hansen@linux.intel.com>, Eugene Syromiatnikov <esyr@redhat.com>, Florian Weimer <fweimer@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>, Jann Horn <jannh@google.com>, Jonathan Corbet <corbet@lwn.net>, Kees Cook <keescook@chromium.org>, Mike Kravetz <mike.kravetz@oracle.com>, Nadav Amit <nadav.amit@gmail.com>, Oleg Nesterov <oleg@redhat.com>, Pavel Machek <pavel@ucw.cz>, Peter Zijlstra <peterz@infradead.org>, Randy Dunlap <rdunlap@infradead.org>, "Ravi V. Shankar" <ravi.v.shankar@intel.com>, Vedvyas Shanbhogue <vedvyas.shanbhogue@intel.com> Cc: Yu-cheng Yu <yu-cheng.yu@intel.com> Subject: [RFC PATCH v6 24/26] mm/mmap: Add Shadow stack pages to memory accounting Date: Mon, 19 Nov 2018 13:48:07 -0800 Message-Id: <20181119214809.6086-25-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181119214809.6086-1-yu-cheng.yu@intel.com> References: <20181119214809.6086-1-yu-cheng.yu@intel.com> 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: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
Control-flow Enforcement: Shadow Stack
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index 30836512ca79..9560d69fa08c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1701,6 +1701,9 @@ static inline int accountable_mapping(struct file *file, vm_flags_t vm_flags) if (file && is_file_hugepages(file)) return 0; + if (arch_copy_pte_mapping(vm_flags)) + return 1; + return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE; } @@ -3319,6 +3322,8 @@ void vm_stat_account(struct mm_struct *mm, vm_flags_t flags, long npages) mm->stack_vm += npages; else if (is_data_mapping(flags)) mm->data_vm += npages; + else if (arch_copy_pte_mapping(flags)) + mm->data_vm += npages; } static vm_fault_t special_mapping_fault(struct vm_fault *vmf);
Add shadow stack pages to memory accounting. Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> --- mm/mmap.c | 5 +++++ 1 file changed, 5 insertions(+)