Message ID | 20181119214809.6086-19-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 69EBE6C5 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D4852A583 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512632A6EE; Mon, 19 Nov 2018 21:55:07 +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 E19642A583 for <patchwork-linux-mm@patchwork.kernel.org>; Mon, 19 Nov 2018 21:55:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80B4F6B1C9E; Mon, 19 Nov 2018 16:54:30 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 765786B1C9F; Mon, 19 Nov 2018 16:54:30 -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 51C8B6B1CA0; Mon, 19 Nov 2018 16:54:30 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id 02D096B1C9F for <linux-mm@kvack.org>; Mon, 19 Nov 2018 16:54:30 -0500 (EST) Received: by mail-pf1-f200.google.com with SMTP id g24-v6so27483208pfi.23 for <linux-mm@kvack.org>; Mon, 19 Nov 2018 13:54:29 -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=Wx+Td2bZIEI5qvhmOGUHF8l1VQAnWxqhL8toaU9RoMc=; b=ql4JDBq2CFNctshCqQ30tn2oJf2iy2WLG/kAuy6qrOwfGf1FimhawlIACjm8z8gXzD xSqToB1NwYSGSPuhSNFb+PC/pCFCXnuFBb466PyWZZ3WExPmlCUzJE5ieFGdzpeskhVp +MGYyKHS3nXojYoxn+FW7KsWMhYnDDiLIYaRsV4+rCyj/eDgT//nmJtrL4t5U6vytBON tL2yuQqqN3nrkvGl2hyZ//OHqQwnmA76wmT4ujYgGMHa5OnrgaWBHiSEDDBwpuC2qRFW QxsqGvG7AB9BG9lBJ3y99Zlsb0K8z5fhYsv1fgHRN3Hg0TuUHYdzv/YJVzANiOSS46Qa NWBQ== 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: AGRZ1gK2YPFtNJtdLiAc+dM1eDPtiNkzpMivt/uw7W0+wP2iBJpM7Jpd jvlT+z3mmNqC4JK/csax7dTVZUs8Ob4iFA558nPisLrCP4JEUGhQoHLF+u8GjObI8See6bMQ2A+ 04acmAejYqlKRiL4Y3dhBTVnS8J7W3NPK+/3EJpcd+d6SepNER6Og3DuUdXi8Nu/arQ== X-Received: by 2002:a17:902:780c:: with SMTP id p12mr23692812pll.197.1542664469702; Mon, 19 Nov 2018 13:54:29 -0800 (PST) X-Google-Smtp-Source: AJdET5eVaXpZnXQsctt21k9bZNseKGFDdoZr8xkZTdNrZbcnds7IJDnteITY9kKWz7oX/igWLXdF X-Received: by 2002:a17:902:780c:: with SMTP id p12mr23692789pll.197.1542664469059; Mon, 19 Nov 2018 13:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542664469; cv=none; d=google.com; s=arc-20160816; b=vPsLwN9tlw1AM6Oi7laB48YSq7X0w5HHSzuAmG84CKH2O6UNTnOeyJmlvfHhvqAfe7 AqTbvrjHL6MOgGbMpHqUq3mcvbz2RubX//HE653LPwqnWNSanfuWa3R63dVfLFspLFJI BccfDO1pyG1mUCkF/hbQsMPkWi/Qd6jbSl2og7xcfG2wS+8vKv/VSslpHSiLaEn6h8JA RP//myGnVMVhfqFohVCNx/sM5cdeNawkLeh6FZLbDZJIrNZULgIk8LWG+RONU0RnNBqr NUwjyZfVxTjZTBTEpwBJaC7kxQ+Hqll6r/1fSfsg2HjMZEjb5bPuyESKKt2rmME1YhdF YHSA== 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=Wx+Td2bZIEI5qvhmOGUHF8l1VQAnWxqhL8toaU9RoMc=; b=xRWuO7IRJJv+UtHNixICxfsxH3eAC668axcmXK5W9v6Xn3KNd/xhnZCy0AFzjyicMD cUWO45XsP7ZlOhNMLdJu/GwhBrODzwwh5sjndEZxFJqDhtnD/XRzWN6jOPC/0hQ9lmse 6b4q5S66ey36chw0heJvRMDa+xCR2RZ0UjkZnJky2cSgQyaX1IdFJZtGyn8mi0EPASVP 0ObqTnKKNsFaFv2Wv9l5J9huA234hc7iDjyplZUwEmV35QJdTEiUQOmH6wz2EHeN73uB MnYWwqCijhG2sfSDGI1mnf0Q+O5/P4IIxIGMvI4xMmLiFpSB+/XxKf+SVeUFP1BI5luI m7FA== 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 g12-v6si41569459pla.351.2018.11.19.13.54.28 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 13:54:29 -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:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,254,1539673200"; d="scan'208";a="93319895" Received: from yyu32-desk1.sc.intel.com ([143.183.136.147]) by orsmga008.jf.intel.com with ESMTP; 19 Nov 2018 13:54:27 -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 18/26] mm: Introduce do_mmap_locked() Date: Mon, 19 Nov 2018 13:48:01 -0800 Message-Id: <20181119214809.6086-19-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/include/linux/mm.h b/include/linux/mm.h index 7873ac3635a7..36f72c4441cc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2348,6 +2348,24 @@ static inline void mm_populate(unsigned long addr, unsigned long len) static inline void mm_populate(unsigned long addr, unsigned long len) {} #endif +static inline unsigned long do_mmap_locked(unsigned long addr, + unsigned long len, unsigned long prot, unsigned long flags, + vm_flags_t vm_flags) +{ + struct mm_struct *mm = current->mm; + unsigned long populate; + + down_write(&mm->mmap_sem); + addr = do_mmap(NULL, addr, len, prot, flags, vm_flags, 0, + &populate, NULL); + up_write(&mm->mmap_sem); + + if (populate) + mm_populate(addr, populate); + + return addr; +} + /* These take the mm semaphore themselves */ extern int __must_check vm_brk(unsigned long, unsigned long); extern int __must_check vm_brk_flags(unsigned long, unsigned long, unsigned long);
There are a few places that need do_mmap() with mm->mmap_sem held. Create an in-line function for that. Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> --- include/linux/mm.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)