From patchwork Wed Nov 19 06:50:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 41097 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54B36246E3 for ; Wed, 19 Nov 2014 06:54:31 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id k14sf4487027wgh.8 for ; Tue, 18 Nov 2014 22:54:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=vWe0tHaxpwOkKBtC1HBDLb+v/LUGKOZbFEXXDhhbnbY=; b=LFv2RQcjd5EH2BZNDJQU2Xqh/mT5k8fzAi1wBSS5zC8bKyV87eko7CSPnwSRN+I5uL 2MPznyecyZSfecL1hjcr+trVAUyu32nVG8nFFdIjE9ljy60A9YHky2anYik7FbFvFPD2 YwWDBPLxcqDa4RWCziPv0k11dl5JiBUAkNrPPUEC4s/JPZvnNP8YIjFwvXCUahX+3Kmv wiBLy5tXtgPGGN+sRQQI3eKaE53o+WSoh5Kp15JGvmgZiJ9cbfWNkn0gLf9pcbM1iq18 yLmO2Mc4jbDid7OVB5ZkVcg+tDi6N2TvMBwF+2rHW9yJjZYHtT/kqAJoVPnFCB7U8o8U 9jUg== X-Gm-Message-State: ALoCoQmsp55wEp4yzuaqoPAgcn0HSAvSIOm43ObU5TnzGssL3Vjfd4l6fYYaG5hDqkEkrL/w9fdN X-Received: by 10.152.43.202 with SMTP id y10mr688677lal.5.1416380070528; Tue, 18 Nov 2014 22:54:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.132 with SMTP id dc4ls256868lad.97.gmail; Tue, 18 Nov 2014 22:54:30 -0800 (PST) X-Received: by 10.112.130.132 with SMTP id oe4mr404473lbb.82.1416380070071; Tue, 18 Nov 2014 22:54:30 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id y1si824874laa.37.2014.11.18.22.54.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 22:54:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id q1so3380026lam.39 for ; Tue, 18 Nov 2014 22:54:29 -0800 (PST) X-Received: by 10.112.162.41 with SMTP id xx9mr40279600lbb.21.1416380069720; Tue, 18 Nov 2014 22:54:29 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp37157lbc; Tue, 18 Nov 2014 22:54:28 -0800 (PST) X-Received: by 10.68.220.169 with SMTP id px9mr17655585pbc.146.1416380068042; Tue, 18 Nov 2014 22:54:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id co10si1071424pdb.92.2014.11.18.22.54.26 for ; Tue, 18 Nov 2014 22:54:28 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754965AbaKSGyJ (ORCPT + 26 others); Wed, 19 Nov 2014 01:54:09 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:57430 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754066AbaKSGyI (ORCPT ); Wed, 19 Nov 2014 01:54:08 -0500 Received: from 172.24.2.119 (EHLO lggeml425-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AXI34862; Wed, 19 Nov 2014 14:53:46 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml425-hub.china.huawei.com (10.72.61.35) with Microsoft SMTP Server id 14.3.158.1; Wed, 19 Nov 2014 14:53:32 +0800 From: Wang Nan To: , CC: , , , , , , , , , , Subject: [PATCH v9 1/2] kprobes: Pass the original kprobe for preparing optimized kprobe Date: Wed, 19 Nov 2014 14:50:43 +0800 Message-ID: <1416379844-25160-2-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1416379844-25160-1-git-send-email-wangnan0@huawei.com> References: <1416379844-25160-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020207.546C3E7A.0106, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0e149c312e69524d28a530aeb6c8b281 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Masami Hiramatsu Pass the original kprobe for preparing an optimized kprobe arch-dep part, since for some architecture (e.g. ARM32) requires the information in original kprobe. Signed-off-by: Masami Hiramatsu Cc: Wang Nan --- arch/x86/kernel/kprobes/opt.c | 3 ++- include/linux/kprobes.h | 3 ++- kernel/kprobes.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index f1314d0..7028296 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -320,7 +320,8 @@ void arch_remove_optimized_kprobe(struct optimized_kprobe *op) * Target instructions MUST be relocatable (checked inside) * This is called when new aggr(opt)probe is allocated or reused. */ -int arch_prepare_optimized_kprobe(struct optimized_kprobe *op) +int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, + struct kprobe *__unused) { u8 *buf; int ret; diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index f7296e5..7ab2c93 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -308,7 +308,8 @@ struct optimized_kprobe { /* Architecture dependent functions for direct jump optimization */ extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn); extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); -extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op); +extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, + struct kprobe *orig); extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); extern void arch_optimize_kprobes(struct list_head *oplist); extern void arch_unoptimize_kprobes(struct list_head *oplist, diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 3995f54..9f28aa7 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -717,7 +717,7 @@ static void prepare_optimized_kprobe(struct kprobe *p) struct optimized_kprobe *op; op = container_of(p, struct optimized_kprobe, kp); - arch_prepare_optimized_kprobe(op); + arch_prepare_optimized_kprobe(op, p); } /* Allocate new optimized_kprobe and try to prepare optimized instructions */ @@ -731,7 +731,7 @@ static struct kprobe *alloc_aggr_kprobe(struct kprobe *p) INIT_LIST_HEAD(&op->list); op->kp.addr = p->addr; - arch_prepare_optimized_kprobe(op); + arch_prepare_optimized_kprobe(op, p); return &op->kp; }