From patchwork Mon Jun 18 23:34:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10472781 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 83B4D6020C for ; Mon, 18 Jun 2018 23:35:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 748F12857E for ; Mon, 18 Jun 2018 23:35:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 689A528A95; Mon, 18 Jun 2018 23:35:06 +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=unavailable 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 0F1F32857E for ; Mon, 18 Jun 2018 23:35:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 208106B000C; Mon, 18 Jun 2018 19:35:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1B7B46B000D; Mon, 18 Jun 2018 19:35:05 -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 0A7056B000E; Mon, 18 Jun 2018 19:35:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f198.google.com (mail-pf0-f198.google.com [209.85.192.198]) by kanga.kvack.org (Postfix) with ESMTP id BB29E6B000C for ; Mon, 18 Jun 2018 19:35:04 -0400 (EDT) Received: by mail-pf0-f198.google.com with SMTP id y26-v6so9299632pfn.14 for ; Mon, 18 Jun 2018 16:35:04 -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=IDJMBd+8EcVwH6+ovvFQAjEVVw6Ivou8Gp8oHsz/vv4=; b=Q6qhiV0dY3dHuYnBgmrk3es0uKCp/pkapSm/lsyMEpEkmoUlMdzBoPXVKlNAWhykWG 1RK4CW9cbhr09hjfh32Qs3T/BVJbSJhdVKEXIQJtjiOLJyWxL8+bXcEyzVdxL2o8EiyM tvirfkMQa1MQJBFCEWwUT+HboULK47OJ+TpN6lMIo2skWH3rLw/vefH9qDk3Q6G6mea8 MjZDpAPSI12VIlCacvZPiW4GN3lrT9J0opRHYQnKEmgqU6itcviVc22nWte9JiEQcGFL U4YBKfPfTTZtezIt5lfn2AHrRhtBMDk0TPQ/DJF09BzFtE7n0u5HOVsqsllK6xChI3hj RpRg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 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: APt69E1h+doY1I0djSZ1utMH6uMoTXAVB/RefnmmMwPLxOmk9sRRKQ0m TCBqdsBw/mXTzPXhKP6+ozuGG3t1x/IHGbRsmioMMxx1bWAfLA2s+Cs624O0tQ0IxG/5Wgldz/r 3qlmS8DItG3oZYsQEtUFdkeRjq/41ASPtNhUKPYk1rf21qxu/AYMXII/8qZuauj1YnA== X-Received: by 2002:a62:1f45:: with SMTP id f66-v6mr15498920pff.253.1529364904459; Mon, 18 Jun 2018 16:35:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLGq2hjOlZTOXzBo2OhoIeuNl8f8AMERBQzgvS3F+9PAnTIQKpfkXZLulHFbzkAuqHiWwZw X-Received: by 2002:a62:1f45:: with SMTP id f66-v6mr15498865pff.253.1529364903381; Mon, 18 Jun 2018 16:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529364903; cv=none; d=google.com; s=arc-20160816; b=hlpANkPtCVuMed7aESw4dKJjR57FJGratWcau+OSl6Uk7Ph2i5bbaKp8JaeYjH82zC 8fc3RPj1JnOtNlukgkLB+8bT4iquVrqqBfPefpY8aRcr/JJgGIutjjjlQ8Waw6iSpjh5 rpFH/0eycXp8JFIJpKyww/FxGWNlqjkfwGPziYBzD1eAxmBpJOzYWw9W5hExLPfuMGiz zt6QRWrOLehcBmoaHl/cAKe2RLIBbwIpaAh9U9HT8zDlbVi7Ru1LOMTV1lszf8BxHD7+ HpM/yYrDXEWY+v+5S0lkRJA43fULicW5EDzNMYXd0iIc7/4sPL55auqCtqpf4bC+rZdA +/Ow== 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=IDJMBd+8EcVwH6+ovvFQAjEVVw6Ivou8Gp8oHsz/vv4=; b=zdqcwXiGmpO+sR7HLFrzmcWGUHQRYHikTSVGgpkKanyt3Sql3wc4iHBBiSUvtQucJ5 gIERCirm09TjTco63+gMtd5+ve14DAlxM/vFmI8MB1/6k/q6nq+bFP71DY47ZZ4Algo8 Rw7H9qe1xV2naoAktyz4gHyRGPJh2LmIkAfYpawbc1hummfCFzJXsWAg23hYIfQTpWow tZHCH8RxiKZrytiJSGwAjCR/wP8kqH4wB9qRsGw8w/6DoEPrvj9/bzhK63qzdRpy0MVv vbsDrEWrMkNeVShsyS47pfxowfjMNAWD6mpIQ1/B5WM6xKWh07QnlXqdcCxcCv3JUU2z v/VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4437.biz.mail.alibaba.com (out4437.biz.mail.alibaba.com. [47.88.44.37]) by mx.google.com with ESMTPS id h1-v6si12472180pfb.70.2018.06.18.16.35.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 16:35:03 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 as permitted sender) client-ip=47.88.44.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.37 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=01201311R841e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04400; MF=yang.shi@linux.alibaba.com; NM=1; PH=DS; RN=13; SR=0; TI=SMTPD_---0T2yMyYn_1529364870; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T2yMyYn_1529364870) by smtp.aliyun-inc.com(127.0.0.1); Tue, 19 Jun 2018 07:34:36 +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 Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v2 PATCH 1/2] uprobes: make vma_has_uprobes non-static Date: Tue, 19 Jun 2018 07:34:15 +0800 Message-Id: <1529364856-49589-2-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1529364856-49589-1-git-send-email-yang.shi@linux.alibaba.com> References: <1529364856-49589-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 1725b90..bd46b7a 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;