Message ID | 20180921150351.20898-18-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 E0B9F15A6 for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 21 Sep 2018 15:09:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF8A42E42A for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 21 Sep 2018 15:09:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C29712E42F; Fri, 21 Sep 2018 15:09:54 +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 5E6112E42A for <patchwork-linux-mm@patchwork.kernel.org>; Fri, 21 Sep 2018 15:09:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EFA08E0018; Fri, 21 Sep 2018 11:08:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0B5AC8E0010; Fri, 21 Sep 2018 11:08:53 -0400 (EDT) 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 9AE938E000C; Fri, 21 Sep 2018 11:08:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 1330A8E0012 for <linux-mm@kvack.org>; Fri, 21 Sep 2018 11:08:53 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id q21-v6so6698647pff.21 for <linux-mm@kvack.org>; Fri, 21 Sep 2018 08:08:53 -0700 (PDT) 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=nuX3QM8HX4YtIzApwaJeEjWpSb/A/OxmLnTA/JbU0aQ=; b=pUp4eM5zJ2Pa85NdSgd+TJ8+Il2h4GE5owNrzkccwqvYEzlZQlC1wNfU277HTjHRpD xgFuUSyc9Qh38wvF4UrZH0KgxZMfGWJD/V2jKw+D9n1XRFRxBtOMlyZlCbxtFEdmua4A SvHcQcuDn4h5YT4f+Aw8xqCK01O/N182Yyq/72BlaMNyXxuWfNdoPFNJRYdzfAZzOXWz AA4iASDjstbHjHpRWznAkWkjiqBCJ8HzTV3xLWmiQltPG+ohNf15sGhdqP8yFXk5ZP4R I84EErCCcsgjQ3xQI/QBS2qUJfAqBwoCToV4zSDayMtK/AZow5NgZaQRYbZ0dSsVbL31 Dspw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.136 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: APzg51BQMUbt7adItZV6qkvSmsvGDgERoT1hKhP7B6cehHJMmIfkyUM/ bNYrkwc5iQ41u+CPS8f2V7Jkmi2VC1vZonoVKIYEYn4q1fkL1M2NlZ0ddfpI1V5pD/oZC8zxAsZ TjNk6z4HcD2etuhonwA0F1rjAs8Z/E979s7y7SQfIJDJtt7vCrOug5EZs7yuS7vHCkA== X-Received: by 2002:a17:902:464:: with SMTP id 91-v6mr45432690ple.125.1537542532704; Fri, 21 Sep 2018 08:08:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZXlMph8WLtb5C9ijwUQTyITsD4LLDxfCeF3mqyXNFZL0wW7GBk0l+H7s7F4EYB3RjLelzc X-Received: by 2002:a17:902:464:: with SMTP id 91-v6mr45432637ple.125.1537542531834; Fri, 21 Sep 2018 08:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537542531; cv=none; d=google.com; s=arc-20160816; b=aNNAGa2Xsc+JPnej+92wRqCszb3ZRMlILFjvo0oVRQ6vl3D6azCZGNqYeAp7qNyBfD erEcqgXgOpmBsI0ztDtWsbN4cSCqPlm3WUN9+Kzhc1SYbC144A3pmeA3f/cak2koSuEy SMcvbVxH5iPDoCWBmEcw/+bSIGPb+T4rDRg3APl5SbUlRv1YrKSYb5oPydTt8ZKUll3w WkZTjTTHT5faCKC8tL1XHKd1qeVSRUN/ejubLonBnTp01Xk0/VyNZqDSg/pdcpzGeJRC e30ttKzq/lv2uzXUSBkDjodAH2V3j6011SSc57pQ2OnvvXjY1eStIl/cXb688xD8kyN5 +huQ== 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=nuX3QM8HX4YtIzApwaJeEjWpSb/A/OxmLnTA/JbU0aQ=; b=FHww5G1jjwG+cSUOU0enT+bS/o/b+VeiaOrSYjhMS9f6uHt7Qy2xsjnikDVHjSNTn0 dGe1ynh2LKMHVhqBAgsvofk4V2YaO49j9UJtVvIvoHPmaM/zvlFQQLzpS1AomJoVw8ep 8dTbHmKWzGis8z1cNVtFGZNdvV0dQpc9iWS44AcPADDF24tYJO/y3P6MNG9lplSPc+08 YzBP/8KM4B7EF6UGhuBGq8n9QxvWDnMOftWqIbocRb/rrtZF2YMwRTkwx5gwkOsF9AlG BSkFNECFkG61kpkbFyEwRX2JqlnuRc35hnyaH+clrehhPu5CYt7v9S5PGukTYX9C1XXR rI8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=yu-cheng.yu@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga12.intel.com (mga12.intel.com. [192.55.52.136]) by mx.google.com with ESMTPS id d11-v6si26378966pgh.564.2018.09.21.08.08.51 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 08:08:51 -0700 (PDT) Received-SPF: pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.136 as permitted sender) client-ip=192.55.52.136; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yu-cheng.yu@intel.com designates 192.55.52.136 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 fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2018 08:08:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="71856580" Received: from 2b52.sc.intel.com ([143.183.136.51]) by fmsmga007.fm.intel.com with ESMTP; 21 Sep 2018 08:08:50 -0700 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>, 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 v4 17/27] mm: Introduce do_mmap_locked() Date: Fri, 21 Sep 2018 08:03:41 -0700 Message-Id: <20180921150351.20898-18-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921150351.20898-1-yu-cheng.yu@intel.com> References: <20180921150351.20898-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 f40387ecd920..c4cc07baccda 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2318,6 +2318,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(+)