From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbdBOSSM (ORCPT ); Wed, 15 Feb 2017 13:18:12 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48397 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751583AbdBOSSJ (ORCPT ); Wed, 15 Feb 2017 13:18:09 -0500 From: "Naveen N. Rao" To: Ananth N Mavinakayanahalli , Masami Hiramatsu , Arnaldo Carvalho de Melo Cc: Ingo Molnar , Namhyung Kim , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] trace/kprobes: allow return probes with offsets and absolute addresses Date: Wed, 15 Feb 2017 23:47:53 +0530 X-Mailer: git-send-email 2.11.0 In-Reply-To: References: <20170215175346.GE3169@naverao1-tp.localdomain> In-Reply-To: References: X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021518-0008-0000-0000-0000052B546D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021518-0009-0000-0000-000013319441 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-15_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702150170 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the kernel includes many non-global functions with same names, we will need to use offsets from other symbols (typically _text/_stext) or absolute addresses to place return probes on specific functions. Also, the core register_kretprobe() API never forbid use of offsets or absolute addresses with kretprobes. Allow its use with the trace infrastructure. Signed-off-by: Naveen N. Rao --- kernel/trace/trace_kprobe.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 7ad9e53ad174..2768cb60ebd7 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -679,10 +679,6 @@ static int create_trace_kprobe(int argc, char **argv) return -EINVAL; } if (isdigit(argv[1][0])) { - if (is_return) { - pr_info("Return probe point must be a symbol.\n"); - return -EINVAL; - } /* an address specified */ ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr); if (ret) { @@ -698,10 +694,6 @@ static int create_trace_kprobe(int argc, char **argv) pr_info("Failed to parse symbol.\n"); return ret; } - if (offset && is_return) { - pr_info("Return probe must be used without offset.\n"); - return -EINVAL; - } } argc -= 2; argv += 2; -- 2.11.0