Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2315453imm; Thu, 11 Oct 2018 08:23:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ow8pZvQtnN2ObMwTQVAceY6d498UliHO8R69IyVkZsSHWZWtvLATxtAkx/h3RxuZTQC70 X-Received: by 2002:a63:6111:: with SMTP id v17-v6mr1825415pgb.226.1539271424280; Thu, 11 Oct 2018 08:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539271424; cv=none; d=google.com; s=arc-20160816; b=EotWRCom0Au3vMckIbmkSyXPVv0AuhcMYNZhtDrwDeQbdLxUITDcHZWFJU/6EcMu51 SwACOdeOL6ARHiUrkGpEp9C5jUY4nIT64bR/jmmDEVRTyBSKA8rq/14tyTqM2U0uyLd1 AHsR8jIuSMzqEjWvyw4Jp23JTVgoNIqRadpuIZIj+txV7WNrL9jvO7hL/tzHRUajCjQq XD15DBuGbB1qEEvI2LBIpJG2L9H+nJhDxSOIBzpWErqnBxQ4g1481Y1l19ansdR1yxme rp9oKPVzg2fpyMTn8c5RUJn0QR3GDYMgrjhhVVQNBgPE+xYBrlLXj7jq0WrwO1P4Yvvi VVoA== 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=V56ObHxpVBzvq9rlMW5IthWJ0mE9AdzBQaFBjAUSUvE=; b=h05j61ylollQm0aWmxyU4Vi7V2r44wIEYGCnzezZqhe017K06mn9khwVANGU6MvCuf llxKeukdcJ+sFSylo6WV1TfyaOD84wUfsjFAGSH8wxexyt90EbBcCsBeiwylbjyGJ/9s BBknSekceEwQx9Csd7PfLIkcRLp09Ihu1gLKXChTpm+z8Edz2ocQUHmiFoecmDdTdsLK 6H2UnjH6+lvR6n/1SS4NWH2fkA8Wx8pnzG61bWhAERb1YRjXeV35FVvXH8U5QboUX0l2 yS5ksBInLAqBfsBYO3i0HNF08S+D5fB7O7BL9thctxUdxqbkyoVvCsbjF2vLkuAC9XtF 24dw== 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 69-v6si7427291pgg.95.2018.10.11.08.23.29; Thu, 11 Oct 2018 08:23:44 -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 S1728760AbeJKWs7 (ORCPT + 99 others); Thu, 11 Oct 2018 18:48:59 -0400 Received: from mga11.intel.com ([192.55.52.93]:21816 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728603AbeJKWs1 (ORCPT ); Thu, 11 Oct 2018 18:48:27 -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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 08:20:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,368,1534834800"; d="scan'208";a="78019172" Received: from 2b52.sc.intel.com ([143.183.136.147]) by fmsmga008.fm.intel.com with ESMTP; 11 Oct 2018 08:20:47 -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 25/27] mm/mmap: Add Shadow stack pages to memory accounting Date: Thu, 11 Oct 2018 08:15:21 -0700 Message-Id: <20181011151523.27101-26-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 Add shadow stack pages to memory accounting. Signed-off-by: Yu-cheng Yu --- mm/mmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/mmap.c b/mm/mmap.c index b85292014ec9..fa581ced3f56 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1677,6 +1677,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; } @@ -3267,6 +3270,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); -- 2.17.1