From patchwork Thu Aug 9 23:36:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 10562135 Return-Path: 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 4F77D13BB for ; Thu, 9 Aug 2018 23:36:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EC06289DD for ; Thu, 9 Aug 2018 23:36:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 326F72BB3A; Thu, 9 Aug 2018 23:36:48 +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 8FBDE289DD for ; Thu, 9 Aug 2018 23:36:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 656FD6B0007; Thu, 9 Aug 2018 19:36:44 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5DF996B000A; Thu, 9 Aug 2018 19:36:44 -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 4CDA16B000C; Thu, 9 Aug 2018 19:36:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 0C2576B0007 for ; Thu, 9 Aug 2018 19:36:44 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id q12-v6so3506295pgp.6 for ; Thu, 09 Aug 2018 16:36: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=uBWlWGDsan3cE1ilCu507LrPY4cQ+2dlDtyHVWB0prI=; b=pWokjWv0oL9awD65IPC5uHICTgOTAJs6iG4Gss6TbFzD2HaXRqr2/5FUQSFP+2eFUd wjDk7oUWPLLrXziUuDsEJLod4njay7Xdnjk4Jhj8NPvsPCiXOlt95VvabTyrH6xVTGKf jnJYCmulsn7nuFBwSxryV0OCI2KR9QVGiCwYAVbJk0NTFm3D95ayDnqydhhhWnjkuL5o bQhMyJtYdckCnPoEG5dqgtwVyMtkT0bvHI6cdFVZhAhNjfcGIug+Otgilqr+0RJwVW5Q fqhxFXMUcJNzQakeyoa5tmxpkVcK66iAUr3Ph0g3LslkOQ2/QK4IoiUPysO+iHx54ap9 qvlg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 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: AOUpUlGk2mU7c3aMh9AduJkOIT3I2Q1IrCRFHKxaxU83LU2z83qyQrpq dtWHoYDKfmG5hyPHK9iRl8mmRtznSaf2qE0LMU60htKln0Uw9l+Yp/eFSuLsiK5wtbR0UMbSDMU MKaossSCAVpavkJvnHol5eyVtXt7XzvPiqcFKD+GkToeRgtBVfJQbneDjOcLU+B94GQ== X-Received: by 2002:a63:eb0e:: with SMTP id t14-v6mr3941516pgh.198.1533857803717; Thu, 09 Aug 2018 16:36:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx9xTYE1YYQDGAKrH8Gvti4epDioPCxTTuefQpsItBtEvgJjr7/uGUp9ATmBnAzlL/OWUN4 X-Received: by 2002:a63:eb0e:: with SMTP id t14-v6mr3941479pgh.198.1533857802733; Thu, 09 Aug 2018 16:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533857802; cv=none; d=google.com; s=arc-20160816; b=HdTWBjv3sM0BrJxnoZ5+pvMXsa+6SdEM+6SU2WPu8wTNb9vT+9RhY35B7Q4TasUxul QeEIpZfq0c6Gc/nQKsfOFlcOSI5+Qo+cWBmDeyfvcuFVIP/bAl05qrrhMnjaReyWmann 2Q/RLh0REpB9NcBWjAc51gFhU9LLdtR/7XDsIX1LQS6BTVAXcCyRccxNObsX39WbX2YG EJ//sZ+Y9jYtwL1Vld8UUA+MxUTGjoeLFOhDm/kltYWkHSciqMZnbUq8czMHxf0eNXTX EhZRzk+QjwbloavjvLtioie1o8RE9TLPT98eiuX4NWL4jA0TK+WEh9aNdRQC375Ta8t/ 2jaA== 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=uBWlWGDsan3cE1ilCu507LrPY4cQ+2dlDtyHVWB0prI=; b=zGAqLHNaDj5QkjwbYpnVJJ729eFpEHhn7MUUtZ64S7PiXhscrfK+e8EuoB4kzMrq4q l3/hYKlFCG32Lo+kqAaQTZm2UzQrnOsMWV+K7A1hD9BxHfQ1kHvnqq3P1k2LZUNrkyJO eMo1tLkHLg6N4RllWhGLWjRvgG348hyIjgMC0ZhVIdhmgAC++kEqfVcvuieEgM0BJkGB pZQw30SHRSZ6Nv4JifXi3xT/EhqIjMUfKiHM1HpQ3yfwLK22E8ETEwYFGe5N9GX1aSeM 0MRwrl+DdGE95zxjrTOvWnaLwgr1hiO9mpzYfXGwJHL1En+6hmDK0Oh0CZBPschYbObR Zmxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) smtp.mailfrom=yang.shi@linux.alibaba.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com. [47.88.44.36]) by mx.google.com with ESMTPS id d191-v6si7238763pga.157.2018.08.09.16.36.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 16:36:42 -0700 (PDT) Received-SPF: pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 as permitted sender) client-ip=47.88.44.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of yang.shi@linux.alibaba.com designates 47.88.44.36 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=01201311R121e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07486;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0T6MWc.W_1533857777; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0T6MWc.W_1533857777) by smtp.aliyun-inc.com(127.0.0.1); Fri, 10 Aug 2018 07:36:27 +0800 From: Yang Shi To: mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, kirill@shutemov.name, vbabka@suse.cz, 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 v7 PATCH 3/4] uprobes: make vma_has_uprobes non-static Date: Fri, 10 Aug 2018 07:36:02 +0800 Message-Id: <1533857763-43527-4-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533857763-43527-1-git-send-email-yang.shi@linux.alibaba.com> References: <1533857763-43527-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..caeb26b 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 start, + 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;