Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2588241ybl; Mon, 19 Aug 2019 04:37:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTYrmXdyU/RQeR705fyZu4VMdVedcKzu2vpjMcPjp3ywIA+CPMwsOaP4gMPdOlZJGVPBSd X-Received: by 2002:a65:6904:: with SMTP id s4mr19351692pgq.33.1566214660332; Mon, 19 Aug 2019 04:37:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1566214660; cv=pass; d=google.com; s=arc-20160816; b=qa+0nX79C9jFamDhBg2AANVH+KTqhgfzh9sEeps2jYfDUEKSziya7wDWw401ZTocKi Wg7QIjsICNutNRQAer32IEiKgcZIvoCYadgNqouunp5F3yEa6jBMgySPuAx8wTJeUfMg ceV1aICqfCvI+1NqiIDyD4CcpcQKAcnkJxpBpFHQSWnvpJq4q92Dhx7/UEtJIfRa/iEb DHfoDgbRXiVImXAOakQayfo+KthaS9atrVT7dkXj+qLIy7V4ZxCqyNJa2QzviCl9CYN0 +y3hS84QiEBDN6hOrF3ri3zCtmLYh5bEW/EfE0X3/+DXZhkmsi//cGq6yNezF2ZrixMs BVww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=EKpBe//J7CHtDTR2w3jG8GwEs1XJGPcWYz2zYmDSEZs=; b=mF5OKBuuu+i+Eshkc4s+hqx+12zP+QTvACOFlzHeQ5Wp2GQmL/+KJWULiT/t/fwleH je33/UzydX1eyDYnfmn42Ccc0bgF//C4eg0u7bGX71dej6v40mY4xunZr209YZEiqy8y +R665fifoiDA3cH8w8YCkhhVmuP5wNfHL4nrLKvislm4ST3Wrm9N87kssiRt4Q1aNxa8 GErJ41eK95MeHD7Yy11ZHc1l6XaU1yRt9ZsqQBa7r+N/lOlKiS8oFLz0fiqIPge7/7sy iQRpni2W5M0g2XvLhu+F51sUsyJXYR9OsqvOSEIGpqPMVl5sTYv73Dck9wLWo2VQTTVh Bi/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=EZN53o4d; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v71si9590172pgd.468.2019.08.19.04.37.25; Mon, 19 Aug 2019 04:37:40 -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; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=EZN53o4d; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727422AbfHSLgN (ORCPT + 99 others); Mon, 19 Aug 2019 07:36:13 -0400 Received: from mail-eopbgr770041.outbound.protection.outlook.com ([40.107.77.41]:61973 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726717AbfHSLgM (ORCPT ); Mon, 19 Aug 2019 07:36:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ob/qWgPxLDbO1j2rVc45mkZRHnS6njXTehJk2JeEQmWwRrt1QtP0/RiPvdRUDr5YPRvgNCBigJ0+2AUV+m5IO1EgbvYX1lY+MryQWgVhliYjE4pVIWQLWcTDDvX0rzEDtoGvch/JamldjdhownxiwsXNTsT8XzbG9Q0QfaAGYK1odjudyOBs0bfeSTm2kU57O6PvQU34V46i+qLOrGSMEgpgA6s0kViOp67MckzwKDCPR6xfMzmEXIEtuzvlTWXNsRJub8Vy6Yo5M/fNCUyUIw5uWg8dZYWqSTKyTq7BSJNuwjMOnJg3dPQTb7oLWrb5LA/9I6xsMkH5MUcgfUhBKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EKpBe//J7CHtDTR2w3jG8GwEs1XJGPcWYz2zYmDSEZs=; b=bNFk7nEZ95GGwtx6TBuaxp6RgpHFN8+zdI7+g3LYJDtYE1vgUHiEF/HrIWSlXZ47bSC4cDpVr6hGKGYU46rXiIiE0CDdUiY5BswHj4r2EWecquLo0XdRcUfspQIC7f6xqMfv9WsqIlnm8ewqoAGNUoAA2XH19xOBKdQcuat4uA+8ATfvOo+kZS2r5y8hR3Ad1Aj5CZEaTHZRDZ5mvXesTcZmmy9hUaC5rH1SDggssk3BbMS7f9PtRoqMib8S5wfBhsF+4Ogq+89VG3L+Nt+xauXsEcHpzFpXGQtSwlEWYTdP46cga0wGcqxqs4ea37G8lUsA3K1aObuZ7b8ahyuN4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EKpBe//J7CHtDTR2w3jG8GwEs1XJGPcWYz2zYmDSEZs=; b=EZN53o4d/t7XYuciWjmoGPuY7Y7LlGFxAAJcCujA2ZGaInhPIcGOMv0z6jyJ4c2TojPAh2VpcLOCyIhHa73nBjykq/UU1hHsFHg8Qxl26yjGkWk0u55gdQgo/CFTXF0AeOSqMpn/ckAZvYJ2/L3sYmK9C1IqYrBVF+KX9WAWf8w= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4838.namprd03.prod.outlook.com (20.179.93.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Mon, 19 Aug 2019 11:36:10 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::a517:3578:67bf:6c88]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::a517:3578:67bf:6c88%7]) with mapi id 15.20.2157.022; Mon, 19 Aug 2019 11:36:10 +0000 From: Jisheng Zhang To: Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Masami Hiramatsu , "David S. Miller" , Anil S Keshavamurthy , "Naveen N. Rao" , Steven Rostedt CC: "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH 1/4] kprobes: adjust kprobe addr for KPROBES_ON_FTRACE Thread-Topic: [PATCH 1/4] kprobes: adjust kprobe addr for KPROBES_ON_FTRACE Thread-Index: AQHVVoJMyFG9yAYnDUGqVMEGNEXBVw== Date: Mon, 19 Aug 2019 11:36:09 +0000 Message-ID: <20190819192505.483c0bf0@xhacker.debian> References: <20190819192422.5ed79702@xhacker.debian> In-Reply-To: <20190819192422.5ed79702@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [124.74.246.114] x-clientproxiedby: TYCPR01CA0053.jpnprd01.prod.outlook.com (2603:1096:405:2::17) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2c17c311-704d-49d0-e979-08d724996e64 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BYAPR03MB4838; x-ms-traffictypediagnostic: BYAPR03MB4838: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:478; x-forefront-prvs: 0134AD334F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(396003)(376002)(346002)(366004)(189003)(199004)(316002)(50226002)(7416002)(52116002)(99286004)(6486002)(478600001)(2906002)(66066001)(71200400001)(54906003)(86362001)(14454004)(3846002)(5660300002)(71190400001)(110136005)(76176011)(4744005)(8936002)(6436002)(66946007)(305945005)(81156014)(66446008)(64756008)(81166006)(66556008)(66476007)(8676002)(6116002)(7736002)(186003)(102836004)(1076003)(26005)(6512007)(446003)(9686003)(11346002)(53936002)(486006)(6506007)(386003)(476003)(256004)(25786009)(4326008)(921003)(1121003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4838;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: c81MKNF1YphsHMlylKiRBU9aJ/xP+u1Lbl7wz7r9VK8QVsMiwQP716huOxdjDlYnF3KL+jyYIKS4gjY3lHngl/P/23jPM9fCt2/k3VtDdDwn+AIR6grdlMY+S5qfz3xrgJFmDLnobohoEwX7oOwWMAgF4ycFuG1NF0UOkpVzYQ9fW3Rislt7AcgmT/c0OUsteCC1jJYPK9bDRsdFzqcmvT5IVTHTxFpphG/zgd+P/wbo7/DO6ZROzcSSVwmtCviGynM31y+8rPofZShups3RsSPd7udYV8sLqaVTuOcmuSvTtRRU+jBGL4tHZhQRrKIHdLnJ0N1gmdz8ShX/4mhGEaS8ZaALF5r1jESAFJnLCQHRhwZD6cGeqiUrBRPpNOIzUpzoU5mnWrybcJFHBfhce+A/UViQTaqshE7eWp5lsTU= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c17c311-704d-49d0-e979-08d724996e64 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Aug 2019 11:36:10.0036 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0nXnn4v0KeDRAUFNixQYt1ALLlXZaxisepbnOOmcF1QL3/QeF5ra00On90OhH//GuJZKNwV0Ve2tlIF6fTLQPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4838 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D kprobe_addr(p); if (IS_ERR(addr)) return PTR_ERR(addr); +#ifdef CONFIG_KPROBES_ON_FTRACE + addr =3D (kprobe_opcode_t *)ftrace_call_adjust((unsigned long)addr); +#endif p->addr =3D addr; =20 ret =3D check_kprobe_rereg(p); --=20 2.23.0.rc1