Received: by 10.213.65.68 with SMTP id h4csp331479imn; Tue, 13 Mar 2018 05:57:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELt+32I4vqqN7sjkEPUW42hNMiup2wdUpHdVo4NXRyTUns4gmQNKDL+XbVVd62vyWAjFwAIm X-Received: by 2002:a17:902:684:: with SMTP id 4-v6mr511985plh.262.1520945832575; Tue, 13 Mar 2018 05:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520945832; cv=none; d=google.com; s=arc-20160816; b=oZQJdLmlkgIm0JgQlOoO9ymUYDB/y+1huBDbdHoV7D9dB32sB8StMNfJ8nqXhr0vRH +PxD/s2Va7g9yJXq7UB1OOgkoFYdO88s2L9aNyB+VziEexMM6mVdBbVgDym9OKtmZ1EB FFRbaWYFLzypDgmfwHcvuq5AZorztW8Muhr8WjCCOHp6Y2URH5mUeWrUoy8XLV4Z3Rj/ M3C8ay9dD346k+qmyYupZm9XXww2cRquuK/2ID6PrnKBogrrb67VbihNmEr8CH/2I8nG /vPPB1fgHDTGDXwWuvAbqLr+xyAixd8aPa6OGjw7djR+JVUVfCvZV9oBKVV6fT7MG6v6 V7Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=4e6DbnzQbrEqHjJHotwM3+3Fm2D5JswjzjLZw71R5JI=; b=CjbuO/8dohAZCq6nU8gQVJLTjEGzfGj8NafHsP7BAnzmbXyJfQph7R5aRIeINYyBG3 hMq8zC5ndYHLmtn3eHOsTA/g9607RBSJcQbSx5TRuKPYNbtYIws0RvPypxPrXBp83k/0 9by0NuXatcH3f8i34QA+LSmcRZFK9h/tEgp62OFz8AsQof1ed0CiCPpFWeqmSC7QaYxO V6zp81ps/DZi7d5RHTGKUXlO51ccoUDk0OcvjYgLhnc8WB5em0Q4FwUUIqLXql9mTKEr AzHinh/XctuquSH+HVir+cFrnGpDShQh+wxj8tqaQbxYpY60TpKpRPVALJfmd6AtVimB cMIA== 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 r59-v6si90682plb.647.2018.03.13.05.56.58; Tue, 13 Mar 2018 05:57:12 -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 S1752535AbeCMMyU (ORCPT + 99 others); Tue, 13 Mar 2018 08:54:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35242 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751757AbeCMMyT (ORCPT ); Tue, 13 Mar 2018 08:54:19 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2DCn6Yk081737 for ; Tue, 13 Mar 2018 08:54:19 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gpeft9sd1-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 13 Mar 2018 08:54:18 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Mar 2018 12:54:14 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 Mar 2018 12:54:06 -0000 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 w2DCs6Z865077364; Tue, 13 Mar 2018 12:54:06 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A72511C052; Tue, 13 Mar 2018 12:46:45 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF7E411C050; Tue, 13 Mar 2018 12:46:33 +0000 (GMT) Received: from bangoria.in.ibm.com (unknown [9.124.221.140]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 13 Mar 2018 12:46:33 +0000 (GMT) From: Ravi Bangoria To: mhiramat@kernel.org, oleg@redhat.com, peterz@infradead.org, srikar@linux.vnet.ibm.com 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, gregkh@linuxfoundation.org, huawei.libin@huawei.com, hughd@google.com, jack@suse.cz, jglisse@redhat.com, jolsa@redhat.com, kan.liang@intel.com, kirill.shutemov@linux.intel.com, kjlx@templeofstupid.com, kstewart@linuxfoundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, milian.wolff@kdab.com, mingo@redhat.com, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, pc@us.ibm.com, pombredanne@nexb.com, rostedt@goodmis.org, tglx@linutronix.de, tmricht@linux.vnet.ibm.com, willy@infradead.org, yao.jin@linux.intel.com, fengguang.wu@intel.com, Ravi Bangoria Subject: [PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions Date: Tue, 13 Mar 2018 18:25:56 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313125603.19819-1-ravi.bangoria@linux.vnet.ibm.com> References: <20180313125603.19819-1-ravi.bangoria@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18031312-0008-0000-0000-000004DBFABF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031312-0009-0000-0000-00001E6F2D65 Message-Id: <20180313125603.19819-2-ravi.bangoria@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-13_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 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-1803130153 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functionality changes. Signed-off-by: Ravi Bangoria --- include/linux/mm.h | 12 ++++++++++++ kernel/events/uprobes.c | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index ad06d42..95909f2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2274,6 +2274,18 @@ struct vm_unmapped_area_info { return unmapped_area(info); } +static inline unsigned long +offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) +{ + return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); +} + +static inline loff_t +vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) +{ + return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); +} + /* truncate.c */ extern void truncate_inode_pages(struct address_space *, loff_t); extern void truncate_inode_pages_range(struct address_space *, diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index ce6848e..bd6f230 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -130,16 +130,6 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register) return vma->vm_file && (vma->vm_flags & flags) == VM_MAYEXEC; } -static unsigned long offset_to_vaddr(struct vm_area_struct *vma, loff_t offset) -{ - return vma->vm_start + offset - ((loff_t)vma->vm_pgoff << PAGE_SHIFT); -} - -static loff_t vaddr_to_offset(struct vm_area_struct *vma, unsigned long vaddr) -{ - return ((loff_t)vma->vm_pgoff << PAGE_SHIFT) + (vaddr - vma->vm_start); -} - /** * __replace_page - replace page in vma by new page. * based on replace_page in mm/ksm.c -- 1.8.3.1