Received: by 10.192.165.156 with SMTP id m28csp1411429imm; Mon, 16 Apr 2018 21:35:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/nqy8QLmNQXxNZjRxrCIF34XUOW1AfU9HIZgKbL3gqzQZHdGD1sz9S2FYyzx7SX33t00ap X-Received: by 10.99.109.7 with SMTP id i7mr521896pgc.174.1523939747687; Mon, 16 Apr 2018 21:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523939747; cv=none; d=google.com; s=arc-20160816; b=V+jE7V4tBTdUJg5Ux2N3LnQs7fJQd3oVS2daz1Kome/elvTmM8LSpuDAhZRkiMvAhh UacZjD3qx+MjMTbsKMybuJDrKbssot8iZvogR62BVhLuPTogiFfoXhLNDE4W4w5ZNidO EoMQb9wzUXyhk3Ioe3+vPOyXetdGGd0ZpgDil/hlAHfS3boRDdCW0aRZzp7/zb65SMhC qSyg0jutV0yz3ReWZeTYZ51MDKpkNLgoRBf/A0lL6G/qFQMeuhtZ3GOfzGvMfKP/mob3 uk6ZPj+IIjrSbF75XKrNBiggb0nQpZM41embltQap6+h6hL6652VXX+WEF1hFSkEpWeO npWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=oBScW0de69Ettk5C2hBOc1sE9VgFKpoKfUHefUj/nLM=; b=H/lF6sFl+hjS57/fG9bOKFC67wa9+pOWnM7p1wFnHwq3gWwk71OUWHllyKJlQ7P9CJ 1HZPrvlY2RCLmyksOgBTWplfrtQo9Pho/8GIXNb5LZz34M1bIpPsYyRYCfdiDlR+/xC+ U+ke54ysVJf0v7E/BBqGrpKZ/JwdTIB8M7+uYct8jhCM6asqVaT9tEYF9aRFoF8wZq0P H8IStN3G0sAxg3zdPH1MQvZahQfo5/mc/JayGtESdU9QGZTSUCwFoueMCAp9P5vu+Azx Mc3uAjkIr7pQbUG14xTRxonbtrzOQa4UqwDtmcofkk02gi6Oa7bpoEQcY9ED7odjCUMy zXQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si9359178pgq.176.2018.04.16.21.35.33; Mon, 16 Apr 2018 21:35:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbeDQEeF (ORCPT + 99 others); Tue, 17 Apr 2018 00:34:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60858 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbeDQEeC (ORCPT ); Tue, 17 Apr 2018 00:34:02 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3H4Xwvr056892 for ; Tue, 17 Apr 2018 00:34:01 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hd6dnfnpq-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 00:34:01 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 05:33:50 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 05:33:42 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3H4XfxT17564002; Tue, 17 Apr 2018 04:33:41 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 311F5AE053; Tue, 17 Apr 2018 05:23:32 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B34FAE04D; Tue, 17 Apr 2018 05:23:27 +0100 (BST) Received: from bangoria.in.ibm.com (unknown [9.124.31.151]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 05:23:27 +0100 (BST) From: Ravi Bangoria To: mhiramat@kernel.org, oleg@redhat.com, peterz@infradead.org, srikar@linux.vnet.ibm.com, rostedt@goodmis.org Cc: acme@kernel.org, ananth@linux.vnet.ibm.com, akpm@linux-foundation.org, alexander.shishkin@linux.intel.com, alexis.berlemont@gmail.com, corbet@lwn.net, dan.j.williams@intel.com, jolsa@redhat.com, kan.liang@intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, tglx@linutronix.de, yao.jin@linux.intel.com, fengguang.wu@intel.com, jglisse@redhat.com, Ravi Bangoria Subject: [PATCH v3 5/9] Uprobe: Export uprobe_map_info along with uprobe_{build/free}_map_info() Date: Tue, 17 Apr 2018 10:02:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180417043244.7501-1-ravi.bangoria@linux.vnet.ibm.com> References: <20180417043244.7501-1-ravi.bangoria@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18041704-0012-0000-0000-000005CBA367 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041704-0013-0000-0000-00001947EB43 Message-Id: <20180417043244.7501-6-ravi.bangoria@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-17_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170042 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ravi Bangoria Given the file(inode) and offset, build_map_info() finds all existing mm that map the portion of file containing offset. Exporting these functions and data structure will help to use them in other set of files. Signed-off-by: Ravi Bangoria Reviewed-by: Jérôme Glisse --- include/linux/uprobes.h | 9 +++++++++ kernel/events/uprobes.c | 14 +++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 0a294e9..7bd2760 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -109,12 +109,19 @@ enum rp_check { RP_CHECK_RET, }; +struct address_space; struct xol_area; struct uprobes_state { struct xol_area *xol_area; }; +struct uprobe_map_info { + struct uprobe_map_info *next; + struct mm_struct *mm; + unsigned long vaddr; +}; + extern int set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); extern int set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); extern bool is_swbp_insn(uprobe_opcode_t *insn); @@ -149,6 +156,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 struct uprobe_map_info *uprobe_free_map_info(struct uprobe_map_info *info); +extern struct uprobe_map_info *uprobe_build_map_info(struct address_space *mapping, loff_t offset, bool is_register); #else /* !CONFIG_UPROBES */ struct uprobes_state { }; diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 477dc42..096d1e6 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -695,14 +695,7 @@ static void delete_uprobe(struct uprobe *uprobe) put_uprobe(uprobe); } -struct uprobe_map_info { - struct uprobe_map_info *next; - struct mm_struct *mm; - unsigned long vaddr; -}; - -static inline struct uprobe_map_info * -uprobe_free_map_info(struct uprobe_map_info *info) +struct uprobe_map_info *uprobe_free_map_info(struct uprobe_map_info *info) { struct uprobe_map_info *next = info->next; mmput(info->mm); @@ -710,9 +703,8 @@ struct uprobe_map_info { return next; } -static struct uprobe_map_info * -uprobe_build_map_info(struct address_space *mapping, loff_t offset, - bool is_register) +struct uprobe_map_info *uprobe_build_map_info(struct address_space *mapping, + loff_t offset, bool is_register) { unsigned long pgoff = offset >> PAGE_SHIFT; struct vm_area_struct *vma; -- 1.8.3.1