Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5898454ybv; Tue, 18 Feb 2020 06:08:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxKuy0ZrC9watBXEgT2T+Fz4CwsZnk8QcvWyGHbpLI7OiURzM4PbjoElmmt2gRyP8FmgeXZ X-Received: by 2002:a05:6830:140b:: with SMTP id v11mr15907299otp.340.1582034904426; Tue, 18 Feb 2020 06:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582034904; cv=none; d=google.com; s=arc-20160816; b=f7RJbV4dof7YuRKJ+g4N9TdKoJT/GIKAP8cG1eIQ8SG6XAi4SYBXANtQbUxdju7WaZ lFaMTW9EefKDjnCiCDDtnZ+o25bH8qkkaVCGdGw+qUcQ6qUeW4Sq4TjPoVLFTweeDnmS UlqIPdXU+xQ0FRozYeKH16/fDMjb7RAKgY2EnNNZ9RBorh/RpXPH/sYli3obWSJqxyrj 4W+n3/uQ6Uepc13lpYV8DGHjzHgVqpmdye7BK3W6mHiG0M3fFKCF5LlsOL9OKn93pWaR mSPZZqu3bpFZ6ByN0Jn14JaUKMXX2ZRtGisXoOQHoJzF4B1yC8+V+SglVPiRIbDwNX/w yy2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date; bh=YOza34ncedjgE68skktSSYDkgGsIPcSlVpFE/+XJ1aA=; b=VMTcPaCljPQT1kbZDKjGx+AXHjQHzi9UlPX+xawjaJ3EgN7HdPaafK4EO3G/6uXpZN nATj90jtbCkObOVRZ7xIZrT9MgcfWWCE5OCDU+33L2poJtnL9cnz/cTuwr7WlOhV3cHo nFti3c+YEwHLC5YoqAXGewMQlowN/EgDjE0DQRzJg0JKXuhA3JZ7yZAs7LQE7WIlS0si 5xYAHWe28ScRp275Qlu2TMSYbBbysj5vAtPP3KvBexitiJPXCWIHqFOUF0LXicYW5kJ/ 81OoWVdTqY0GKzkwcIK+OTwyIrXGVeFANVurx/rv71WGqV3LAaO+lDxWDF+oWvd7xdcx 8hQA== ARC-Authentication-Results: i=1; mx.google.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si1737767otk.318.2020.02.18.06.08.09; Tue, 18 Feb 2020 06:08:24 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbgBROHD convert rfc822-to-8bit (ORCPT + 99 others); Tue, 18 Feb 2020 09:07:03 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:28682 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726567AbgBROHC (ORCPT ); Tue, 18 Feb 2020 09:07:02 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01IDvoo3133991 for ; Tue, 18 Feb 2020 09:07:01 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6cbakmq7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Feb 2020 09:07:01 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Feb 2020 14:06:58 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Feb 2020 14:06:54 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01IE6rt919398782 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Feb 2020 14:06:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2328A4C050; Tue, 18 Feb 2020 14:06:53 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B43B94C04E; Tue, 18 Feb 2020 14:06:52 +0000 (GMT) Received: from localhost (unknown [9.199.60.10]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 18 Feb 2020 14:06:52 +0000 (GMT) Date: Tue, 18 Feb 2020 19:36:51 +0530 From: "Naveen N. Rao" Subject: Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode To: Christophe Leroy , Masami Hiramatsu Cc: Anil =?iso-8859-1?q?S=0A?= Keshavamurthy , Benjamin Herrenschmidt , "David S. Miller" , Larry Finger , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Paul Mackerras , stable@kernel.vger.org References: <20200214225434.464ec467ad9094961abb8ddc@kernel.org> <20200216213411.824295a321d8fa979dedbbbe@kernel.org> <20200217192735.5070f0925c4159ccffa4e465@kernel.org> <20200218094421.6d402de389ce23a55a3ec084@kernel.org> <20200218192905.a3ed969e8565901c4f69fa22@kernel.org> <2b3f664e-d4ad-edd3-5bed-a4492f4ed213@c-s.fr> <20200218213317.533c78753cefb05bd42cc6ad@kernel.org> In-Reply-To: <20200218213317.533c78753cefb05bd42cc6ad@kernel.org> MIME-Version: 1.0 User-Agent: astroid/v0.15-13-gb675b421 (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: 20021814-4275-0000-0000-000003A32911 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021814-4276-0000-0000-000038B73025 Message-Id: <1582033782.f2l6jsd36b.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-18_02:2020-02-17,2020-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 clxscore=1015 phishscore=0 mlxscore=0 mlxlogscore=971 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002180110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Masami, Christophe, Apologies for pitching in late here... Masami Hiramatsu wrote: > On Tue, 18 Feb 2020 12:04:41 +0100 > Christophe Leroy wrote: > >> >> Nevertheless, if one symbol has been forgotten in the blacklist, I think >> >> it is a problem if it generate Oopses. >> > >> > There is a long history also on x86 to make a blacklist. Anyway, how did >> > you get this error on PPC32? Somewhere would you like to probe and >> > it is a real mode function? Or, it happened unexpectedly? >> >> The first Oops I got was triggered by a WARN_ON() kind of trap in real >> mode. The trap exception handler called kprobe_handler() which tried to >> read the instruction at the trap address (which was a real-mode address) >> so it triggered a Bad Access Fault. >> >> This was initially the purpose of my patch. > > OK, then filtering the trap reason in kprobe handler is a bit strange. > It should be done in the previous stage (maybe in trap.c) > Can we filter it by exception flag or only by checking the instruction > which causes the exception, or needs get_kprobe()...? I think Masami's earlier patch proposal to bail out early from kprobe_handler() is appropriate here. We don't support kprobe in real mode since we don't have a way to ensure that the pre/post handlers work properly. We will obviously also have to blacklist some of the real mode code from being probed to begin with. In addition, we will also have to blacklist any location where we can't take a trap (MSR_RI being unset, as an example) Christophe, See some of the below patch series: https://patchwork.ozlabs.org/patch/752336/ https://patchwork.ozlabs.org/patch/752333/ https://patchwork.ozlabs.org/patch/782399/ - Naveen