Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3734638ybv; Sun, 16 Feb 2020 04:34:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyjPo9kt2YDF2yt7EkGPnJUsR2qpqju2V9ysj/zQZSC9+7BcecLMxvSjAypkagfpn9TJ+Zl X-Received: by 2002:a54:468b:: with SMTP id k11mr7008276oic.134.1581856478412; Sun, 16 Feb 2020 04:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581856478; cv=none; d=google.com; s=arc-20160816; b=uCDdLTXTRNtjydv2sZKnlt0SupQPHPLm5EmLbQ4AR7g+yDMNgheiOaqmtOygcMB8LX yujLshdladw2W/EVk6rYDvrwgBIbO1Z51PNuCZhkh65MzOSJS5RM/KY0EioYsxrjbaqR Hcd6D1Psem1am6l6IDdTQ+NMbwCSR/fQxeEOZV2vxCekFcn7UKN03oM8Rcj1XoicT9MY LQ5HlmtMjLFniygInYbFWKTT3fmJRYEXq8a3ifZAHMz66C+/u3KzowCNAAG7Y2qY7b8Q k5VURorC+b0ZD7PeggoK5Iao9OpF7qd2k7nPBxdRjqUXZJL/FcxFw0QURwQ7n45kGuFa hgdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Hra/+653MPNL2ju9AZW2/XNjwtzsbKNfeRcB7Y77zcc=; b=Lgx3qoN/Gj2o+px1WYOlkF9MZDlK6lXnySHtz/Qlvrip2ngdEg3ZPDg7/I/XIwsfN0 KRZdS2B8VhaLh9OCW2VRjq3egckf41/j8nGf7PXxMIYdTEhz3ldSz4gTRGQYl9NeefZ2 /Ntxu/0k4UWrn3d6P4EgBUOsFLGOhbjZOTjuh7+nK/zEvWLL6WqOBfyGqeFzJEJXSPR4 BxAZRYaOJv4up3Q/agYaGKso2f1GDpMiJAWqrYdeV70dmIcBOP846QWdY0PI0yYcUbPY l9jAiPVPT4XWH7QGgKgls3VMp2jFdV7cfYUxeLIhEmdciry0BqI+YTzF+77A3pL4lfjm 57aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lHvJhsvI; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si4899343oic.113.2020.02.16.04.34.26; Sun, 16 Feb 2020 04:34:38 -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; dkim=pass header.i=@kernel.org header.s=default header.b=lHvJhsvI; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728133AbgBPMeR (ORCPT + 99 others); Sun, 16 Feb 2020 07:34:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:56160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbgBPMeQ (ORCPT ); Sun, 16 Feb 2020 07:34:16 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E02E5206D7; Sun, 16 Feb 2020 12:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581856456; bh=CK9AGexnenOmXyQKve9YVghVQRdcBjvKQyQ8y5gDoSM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lHvJhsvIL0eGKudTZzeOYp4p2dz5PjS6mB71vznX2KqIJass3jnGJFwrzZf5GxR7i M7hqLXVApLt9JLwbOJk6kWnneMXdQQb1gJmhn1M0xPa4+pdAxme8i2G5/73pnWmZhK UFmja6IjRgj9NmU+KzXu6B6cKE8Zd+4FxwXwBjW4= Date: Sun, 16 Feb 2020 21:34:11 +0900 From: Masami Hiramatsu To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Larry Finger , "Naveen N. Rao" , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, stable@kernel.vger.org, Anil S Keshavamurthy , "David S. Miller" Subject: Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode Message-Id: <20200216213411.824295a321d8fa979dedbbbe@kernel.org> In-Reply-To: References: <20200214225434.464ec467ad9094961abb8ddc@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 15 Feb 2020 11:28:49 +0100 Christophe Leroy wrote: > Hi, > > Le 14/02/2020 à 14:54, Masami Hiramatsu a écrit : > > Hi, > > > > On Fri, 14 Feb 2020 12:47:49 +0000 (UTC) > > Christophe Leroy wrote: > > > >> When a program check exception happens while MMU translation is > >> disabled, following Oops happens in kprobe_handler() in the following > >> test: > >> > >> } else if (*addr != BREAKPOINT_INSTRUCTION) { > > > > Thanks for the report and patch. I'm not so sure about powerpc implementation > > but at where the MMU translation is disabled, can the handler work correctly? > > (And where did you put the probe on?) > > > > Your fix may fix this Oops, but if the handler needs special care, it is an > > option to blacklist such place (if possible). > > I guess that's another story. Here we are not talking about a place > where kprobe has been illegitimately activated, but a place where there > is a valid trap, which generated a valid 'program check exception'. And > kprobe was off at that time. Ah, I got it. It is not a kprobe breakpoint, but to check that correctly, it has to know the address where the breakpoint happens. OK. > > As any 'program check exception' due to a trap (ie a BUG_ON, a WARN_ON, > a debugger breakpoint, a perf breakpoint, etc...) calls > kprobe_handler(), kprobe_handler() must be prepared to handle the case > where the MMU translation is disabled, even if probes are not supposed > to be set for functions running with MMU translation disabled. Can't we check the MMU is disabled there (as same as checking the exception happened in user space or not)? Thank you, -- Masami Hiramatsu