From patchwork Fri Jun 29 22:39:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10497705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0A7B6016C for ; Fri, 29 Jun 2018 22:40:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F8BC29738 for ; Fri, 29 Jun 2018 22:40:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82FB52973E; Fri, 29 Jun 2018 22:40:46 +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,UNPARSEABLE_RELAY 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 0128029738 for ; Fri, 29 Jun 2018 22:40:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1682C6B0006; Fri, 29 Jun 2018 18:40:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 118996B0007; Fri, 29 Jun 2018 18:40:45 -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 007AD6B0008; Fri, 29 Jun 2018 18:40:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f69.google.com (mail-pl0-f69.google.com [209.85.160.69]) by kanga.kvack.org (Postfix) with ESMTP id B0B396B0006 for ; Fri, 29 Jun 2018 18:40:44 -0400 (EDT) Received: by mail-pl0-f69.google.com with SMTP id f5-v6so5700442plf.18 for ; Fri, 29 Jun 2018 15:40:44 -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=/chEpsQwUTuvWM7ONwHmXqhfIkREpS/QOtX63lzWubk=; b=ojy08/sHdsvMdCIL8OD5m+Yyu0rcrTUpoqPLFa7rMUohgQdKpBulTkl71HoMDx4+pF MHqaohY9xNbWq6cTKhDYj7ucbqSIOqNxDaJNNemmuxo//sPLPSyc2uMTz7J9drHo1VDB iOAkAhOpkID8v8miqWU+6SrBRyJvOCz/xPWWQAvU4hACT+Y9Bv7amRqGTO1CTIxelKd6 MYqHWDCQMm6SZTQ2wtV5Oj0CaKvUxS5riyK7RjwavNPyI+bI65H/WDcBh2ZlBYXVUFvn pD0V8cUpoVX2+Lp/KXT7iuKoE8MyFVbIClNvC29OJRVWPWx4O77w6v27TcNKpI+hfXND dKMQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Gm-Message-State: APt69E2VXaBhq8Qvh/4QWF7WROxsp8dQOWIoocXrzij1XyoH5g6qxyrh ryXdvYlZnQJEdlfPFp9p02ZY1bAYYuOefXQqVh0tJPmq9b+0g+GHAoC3ZbNKcTVAgVF8wSJDlGO 0cSAtwRaz+A6M+hwqvOUNH69fiugBEfxE6B+CYLutI+DvzlOztnNvJUBU/Iok1dRINQ== X-Received: by 2002:a63:9a52:: with SMTP id e18-v6mr13112112pgo.188.1530312044416; Fri, 29 Jun 2018 15:40:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfM7Y9blnJ+10JicMAxNnPHLxrNbhYVwwlniOutsFqaESt5ndeNZgd7A9hv4neEpaw8VkzD X-Received: by 2002:a63:9a52:: with SMTP id e18-v6mr13112081pgo.188.1530312043256; Fri, 29 Jun 2018 15:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530312043; cv=none; d=google.com; s=arc-20160816; b=Gudjx99dq4giXpUZAUReAqjLWzQix9MeEBGuY1cbIaEAku+xFs5vwUyHQELPoL05yR vJl/GkUsqxHS0Bb78pdDMCRN4Q5qNnSMhU9tC+A620QKi63ZnLRtW1hTarLQV6Deh+wz HXtcJBdUJU3V+ftt7LVnrEoscq+SvKhC7fuYds6wVJJqOzJGXPN3JsRiitEIbOX/w5EW JwLDMhqlvPea5KQoAJ85iJHwVo1kSTGVtyLbyxQN2XOWFtF/n8hYDvXsAnJKmQ+lOPxi /a+AznBZ7+cg/QBX3eES+Tq5+4sIfhpOJvBUQEYIaM8yrEk5X87Yc2Cc764y0WXt1AwN jRZA== 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 :arc-authentication-results; bh=/chEpsQwUTuvWM7ONwHmXqhfIkREpS/QOtX63lzWubk=; b=KXi2+x1FCfZxrvxD1z3Pt7s/3GQT3p3fz3ovzhsTJJ7NDnV02E8O9tzj7AwmJ7U8lb DK6HvmgwcbvXauAHUjTvpS9MUMZMVVXSgSRM12JlAS+aJx+6bSCWPQlKhijR44jHRTsL AejTp3mv7/Uw91KHDpg+eiOu3Y9aL1UnjtkE0PHmiUvieJ0hcxWR9HmTCnJ5csjxQjYw bbQnXIkn8i/CLcP/cpqJ52MIZnmOjYvLVCfsOgOgHVRiq7NXo6zpeHFbXYmsFwN+LHfR ZDvqBogAhqR5ZlVO+vpnZakmdu9SWMrzabu/R8dVjAiZ5q/UXRk1ck2/Zs7ZYGju3JSH rndg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com. [115.124.30.131]) by mx.google.com with ESMTPS id t1-v6si9195915pgn.42.2018.06.29.15.40.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jun 2018 15:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) client-ip=115.124.30.131; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R111e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01f04446; MF=yang.shi@linux.alibaba.com; NM=1; PH=DS; RN=16; SR=0; TI=SMTPD_---0T3dXmHm_1530312021; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T3dXmHm_1530312021) by smtp.aliyun-inc.com(127.0.0.1); Sat, 30 Jun 2018 06:40:29 +0800 From: Yang Shi To: mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, akpm@linux-foundation.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de, hpa@zytor.com Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [RFC v3 PATCH 1/5] uprobes: make vma_has_uprobes non-static Date: Sat, 30 Jun 2018 06:39:41 +0800 Message-Id: <1530311985-31251-2-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1530311985-31251-1-git-send-email-yang.shi@linux.alibaba.com> References: <1530311985-31251-1-git-send-email-yang.shi@linux.alibaba.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: X-Virus-Scanned: ClamAV using ClamSMTP vma_has_uprobes() will be used in the following patch to check if a vma could be unmapped with holding read mmap_sem, but it is static. So, make it non-static to use outside uprobe. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Signed-off-by: Yang Shi --- include/linux/uprobes.h | 7 +++++++ kernel/events/uprobes.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 0a294e9..7f1fb8c 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -149,6 +149,8 @@ struct uprobes_state { extern bool arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); extern void arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr, void *src, unsigned long len); +extern bool vma_has_uprobes(struct vm_area_struct *vma, unsigned long start, + unsigned long end); #else /* !CONFIG_UPROBES */ struct uprobes_state { }; @@ -203,5 +205,10 @@ static inline void uprobe_copy_process(struct task_struct *t, unsigned long flag static inline void uprobe_clear_state(struct mm_struct *mm) { } +static inline bool vma_has_uprobes(struct vm_area_struct *vma, unsigned long, + unsigned long end) +{ + return false; +} #endif /* !CONFIG_UPROBES */ #endif /* _LINUX_UPROBES_H */ diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index ccc579a..4880c46 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1095,7 +1095,7 @@ int uprobe_mmap(struct vm_area_struct *vma) return 0; } -static bool +bool vma_has_uprobes(struct vm_area_struct *vma, unsigned long start, unsigned long end) { loff_t min, max;