From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9323C3A5A1 for ; Mon, 19 Aug 2019 16:43:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C316E2070B for ; Mon, 19 Aug 2019 16:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727908AbfHSQnN convert rfc822-to-8bit (ORCPT ); Mon, 19 Aug 2019 12:43:13 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:23116 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbfHSQnN (ORCPT ); Mon, 19 Aug 2019 12:43:13 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7JGRamg125271 for ; Mon, 19 Aug 2019 12:43:12 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ufwf1ne08-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Aug 2019 12:43:12 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Aug 2019 17:43:09 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 19 Aug 2019 17:43:05 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7JGgi8i42009006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Aug 2019 16:42:44 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51FA252059; Mon, 19 Aug 2019 16:43:04 +0000 (GMT) Received: from localhost (unknown [9.85.69.174]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id E705452051; Mon, 19 Aug 2019 16:43:03 +0000 (GMT) Date: Mon, 19 Aug 2019 22:13:02 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH 1/4] kprobes: adjust kprobe addr for KPROBES_ON_FTRACE To: Anil S Keshavamurthy , Borislav Petkov , Catalin Marinas , "David S. Miller" , "H. Peter Anvin" , Jisheng Zhang , =?iso-8859-1?q?Masami=0A?= Hiramatsu , Ingo Molnar , Steven Rostedt , Thomas Gleixner , Will Deacon Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" References: <20190819192422.5ed79702@xhacker.debian> <20190819192505.483c0bf0@xhacker.debian> In-Reply-To: <20190819192505.483c0bf0@xhacker.debian> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 19081916-0016-0000-0000-000002A06A45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19081916-0017-0000-0000-00003300958E Message-Id: <1566232801.derqq08wxh.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-19_03:,, 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908190176 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jisheng Zhang wrote: > For KPROBES_ON_FTRACE case, we need to adjust the kprobe's addr > correspondingly. > > Signed-off-by: Jisheng Zhang > --- > kernel/kprobes.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index 9873fc627d61..f8400753a8a9 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1560,6 +1560,9 @@ int register_kprobe(struct kprobe *p) > addr = kprobe_addr(p); > if (IS_ERR(addr)) > return PTR_ERR(addr); > +#ifdef CONFIG_KPROBES_ON_FTRACE > + addr = (kprobe_opcode_t *)ftrace_call_adjust((unsigned long)addr); > +#endif > p->addr = addr; I'm not sure what this is achieving, but looks wrong to me. If you intend to have kprobes default to using ftrace entry for probing functions, consider over-riding kprobe_lookup_name() -- see powerpc variant for example. - Naveen