Received: by 10.213.65.68 with SMTP id h4csp2119801imn; Sun, 8 Apr 2018 20:11:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+9vEm+sqzxA76p/xkYayFWXSpB+6aqTscN7IBHIR3F+tDWsNLnCfwpUjzFhmpKF9mk8+vw X-Received: by 2002:a17:902:8481:: with SMTP id c1-v6mr36129734plo.304.1523243400616; Sun, 08 Apr 2018 20:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243400; cv=none; d=google.com; s=arc-20160816; b=cShTdE9QzDvoRUMYTik0ykTUv5I8zD4y2SFB4ybKeVDCp5QoDLmYOvRi/WjB7l0Gkl Td3qPGXIvPrcoWiwkCdyHPEgTkUAl77IXF/r01W0XkOsK1uWVUPGWCBzIbYmzCF9k4+4 XLoVFwo1j2yZO56Ehk1IkNU9Ap4eNB7ssns4MsjOBKM1NcDao94UxyChWzdo+v72DoPx MwRJSBWX7u+wfBqEVuXexGWE4lMIHsERevx13PzYmTzbpOzjmRBrnrmQSx/uSUfmlL84 xC8YrbSqhJeBFQu6IEy6otmp6PVzhYblOGvxG4FKNxocDm3MafYjZ0GvIYWL3y0NLWXD jWYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=fO5hYRPcF3Gc7qg+DmbRLNDSUBftWJoCoPGykGQY4MY=; b=wh6WqhdGr5RHUCmYpOjSDaqdY7XbQer8ZGWLBv26AG7PS7h+bMqkABsvVs4MjYiwA0 rUUmKRDBwn+EJxjQsU3s4jqkahFCqOMeTzwyw3CA1Yx508dhF5P5nS7P/XkmAjd7I2el yEsvAdwFZpD0/A71zGS5EnStgUDYjwO5/onZE69ioIw1tnBlZLtQD3RCa1TzOFOVvtf1 PqMPEi382yLC1kB+cSEwcZ0oMuRiErjFYv/zG4mtMKwZOmdrxVqj3tq62eZweBzstaa9 ATcyssuoKWiuYY356vn1rkTdYvHGH+BeanzKWJpQm6eHZRLS+4OBrB8wjv7P3PvZar2Q Pd+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=O8xlMOaR; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s10si10543973pgc.129.2018.04.08.20.09.23; Sun, 08 Apr 2018 20:10:00 -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=@microsoft.com header.s=selector1 header.b=O8xlMOaR; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933142AbeDICqm (ORCPT + 99 others); Sun, 8 Apr 2018 22:46:42 -0400 Received: from mail-by2nam01on0099.outbound.protection.outlook.com ([104.47.34.99]:2811 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754613AbeDIA0l (ORCPT ); Sun, 8 Apr 2018 20:26:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fO5hYRPcF3Gc7qg+DmbRLNDSUBftWJoCoPGykGQY4MY=; b=O8xlMOaRKvQNuzDBJ1UHsj/yZLvGs3PK3akoN5U3prk6/s1F3v5HlK0gCN3p92K0I8fDuFGaN2IWNuANoFIlWzuDKsnKMaxxqsm+CpMWQcQzwLuvZhy6VCI7WQbqr8fjzvYY+aYCRT/3hrc2yaENJOhsSg4DWdSt2KZ7hhP6WTU= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:26:35 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:26:35 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Marcin Nowakowski , "linux-mips@linux-mips.org" , Ralf Baechle , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 009/293] MIPS: kprobes: flush_insn_slot should flush only if probe initialised Thread-Topic: [PATCH AUTOSEL for 4.9 009/293] MIPS: kprobes: flush_insn_slot should flush only if probe initialised Thread-Index: AQHTz5jnNpNo6d8vfUWSLB18nGrY1A== Date: Mon, 9 Apr 2018 00:22:54 +0000 Message-ID: <20180409002239.163177-9-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:Afu48+naUoc+ZnViNY+20BGvYAiQiDdwY1vNwZ5SC21xywmY/esUNUziaW80HSLqSvedE5+8VqTonFFIfc6QmMSkLMRCti5q3WUwJBQw1vmmzBH09eneJwXULEEwta7PrEMsgbTpiqAQFPT3wyr3lt+kv2dG4CdWgEB2Fxt1LeKaSBwOXC2/u1l6olDyruGZ/Ye0OVz11SxJjxDxz9WZfCt8UglXNoRU84Ofxevgzwde2Iw7Zhybrlj+S7vhKIG+;20:LZC32FPyFh2qtOfJW08ZGHGYMm6e9EmqUStSyMfZLOUcXlYijNPVEIhLNp7wmqFnsUw2W4XaE5J9rjEY9fjVlDJNZbs7d3BYfZPPWEWdTr6psREW7+BWs5SZwzplEeCVVJSyORDU4iJOELT5WzRv7k1c+ySh7nSnI/O+E0Gdp3c= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 55e7b2f3-58ad-47b0-ad7c-08d59db08d3d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(39380400002)(376002)(346002)(366004)(189003)(199004)(53936002)(4326008)(478600001)(72206003)(3280700002)(2616005)(14454004)(305945005)(5250100002)(3660700001)(2501003)(2900100001)(54906003)(110136005)(86362001)(1076002)(966005)(107886003)(6506007)(36756003)(446003)(68736007)(6512007)(7736002)(486006)(2906002)(6306002)(5660300001)(6436002)(3846002)(86612001)(6486002)(66066001)(11346002)(476003)(6666003)(59450400001)(26005)(10090500001)(316002)(22452003)(8676002)(81156014)(81166006)(6116002)(105586002)(99286004)(186003)(106356001)(76176011)(25786009)(97736004)(10290500003)(102836004)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: vfFjxEJSNoQlpX3fHMXq15DyCZAX/ymYh9KDczFH04tiPF5/5KyHlVbYNwy2ZdaZ4fOFeseS8nYpI+WxzBb3Mf+Im1tTi0slGA3eztQ4tULGgNZaLxbv9/v4+9ZKMIVtbmCP5atTkK4XXzdzB6oG7V2NNpscjKMrVQucG0ldY05GGjeBHR0H8anY0nzB5+anHPfz61l7riRBZXfncO87avxuE0NtrK1PDH2OkWWMOHlE4Ihbi61XN5pCqam9nSyls4FnzYkbBXZL0aVsLkbB+C3euQnhlV2FoHRX9QTsUIi/nbhRFxEvRPCkL1pCLemqy5CSCX27NIlAyZ1iVQMYL3p67LHTx69/2L8TSlaHe4X32L9NE1vl+bG9ZSjO9yrQQtNNJbnSZTSktW8GQnj4KRe3RF9J2VLnkkjw0ewFHFY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55e7b2f3-58ad-47b0-ad7c-08d59db08d3d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:22:54.5654 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marcin Nowakowski [ Upstream commit 698b851073ddf5a894910d63ca04605e0473414e ] When ftrace is used with kprobes, it is possible for a kprobe to contain an invalid location (ie. only initialised to 0 and not to a specific location in the code). Trying to perform a cache flush on such location leads to a crash r4k_flush_icache_range(). Fixes: c1bf207d6ee1 ("MIPS: kprobe: Add support.") Signed-off-by: Marcin Nowakowski Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/16296/ Signed-off-by: Ralf Baechle Signed-off-by: Sasha Levin --- arch/mips/include/asm/kprobes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobe= s.h index daba1f9a4f79..174aedce3167 100644 --- a/arch/mips/include/asm/kprobes.h +++ b/arch/mips/include/asm/kprobes.h @@ -40,7 +40,8 @@ typedef union mips_instruction kprobe_opcode_t; =20 #define flush_insn_slot(p) \ do { \ - flush_icache_range((unsigned long)p->addr, \ + if (p->addr) \ + flush_icache_range((unsigned long)p->addr, \ (unsigned long)p->addr + \ (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \ } while (0) --=20 2.15.1