Received: by 10.213.65.68 with SMTP id h4csp470525imn; Wed, 4 Apr 2018 01:32:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+NXP6bdakPvyU9zS423Xp4WL/0KGEFdF/5EbzBK3vl49BxymAlC5wZb3uoIqnfeP6WjOIK X-Received: by 10.101.85.72 with SMTP id t8mr6929213pgr.347.1522830777289; Wed, 04 Apr 2018 01:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522830777; cv=none; d=google.com; s=arc-20160816; b=rLU1vYCz7lWNjl8pCslNjK9YEBnrCi0vw7/98zP42bDLsKWLoq15YqCVWRHRUR2wuq VUIC1dzFDhyvHYHn/jpqj+ZdOApDvx2p3805RS0uD/oG+YKWs68ziRoaynHCKttcMrrr 3ig8HfUIljW7BoJbuTLmRWjxw9/nLxguOmDrie1uWSmLGr6QttzoBhqwYefhbYSu1qcL hrimM/6cV0Q+B8aDKUWHX/JP4JS9fKRL2q61/9t1W3LXrVfkMbxaRlmtaFfehaXEEzyc 1KIFx7IArwyayV47hK7KkEfYnpqkcnK+2Mcl07xdG6Xf5nXp3CGZ7y71pogujItr8Wkk 0laA== 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=2T5/rhXxD0bgAYGRv1fGllyy9pmiSqFauVKTbJWwekU=; b=d0jsSz9+CjuTc/qAsBFxnB+pm5F3Xz4qCXhm3nZyECF1e/NruoCpN4Cw41NBG7cFOO yPiIXxirRbnAQ4cWjg+imEiw8GOJy1ZVC5E09ymBVKLI+8XAlv/6YJpe/FT71yf54ok/ P3ZDzXQ3KpdaAmqdWSp2w4um5+2GXGUfhSvVMfdNIzbA/LzMF+tRDUIK6IPEFjpwNf54 b5AA3hF+hOn07oZtxZ1hKEeYsW7OoX6cy+6XWsQcK1EAnsTVMC+ehJP//JsUFe4u2gKY 5PM/5tcBn1j+zKdqOsyq2AmJd3AqmDr3nSMqEx9Av9O5I8OZBbS5AZEHJjaFDAYlSPbr Jw/w== 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 y14si3709016pff.54.2018.04.04.01.32.43; Wed, 04 Apr 2018 01:32:57 -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 S1751946AbeDDIbA (ORCPT + 99 others); Wed, 4 Apr 2018 04:31:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55824 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751262AbeDDIa7 (ORCPT ); Wed, 4 Apr 2018 04:30:59 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w348UmUc098597 for ; Wed, 4 Apr 2018 04:30:58 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h4s8en9gs-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 04 Apr 2018 04:30:54 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2018 09:29:09 +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; Wed, 4 Apr 2018 09:29:02 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w348T2QD57344088; Wed, 4 Apr 2018 08:29:02 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6ED7411C050; Wed, 4 Apr 2018 09:21:17 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC99811C04A; Wed, 4 Apr 2018 09:21:12 +0100 (BST) Received: from bangoria.in.ibm.com (unknown [9.124.31.24]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Apr 2018 09:21:12 +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 v2 5/9] Uprobe: Export uprobe_map_info along with uprobe_{build/free}_map_info() Date: Wed, 4 Apr 2018 14:01:06 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180404083110.18647-1-ravi.bangoria@linux.vnet.ibm.com> References: <20180404083110.18647-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: 18040408-0012-0000-0000-000005C6DACF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040408-0013-0000-0000-00001942EBC7 Message-Id: <20180404083110.18647-6-ravi.bangoria@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-04_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-1804040090 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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