From patchwork Fri Jun 27 14:57:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 4435781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0D5DABEEAA for ; Fri, 27 Jun 2014 15:00:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A10C20320 for ; Fri, 27 Jun 2014 15:00:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4011020263 for ; Fri, 27 Jun 2014 15:00:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0Xc7-0004yn-HG; Fri, 27 Jun 2014 14:58:55 +0000 Received: from mail-wg0-f50.google.com ([74.125.82.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X0Xbg-0004hX-L5 for linux-arm-kernel@lists.infradead.org; Fri, 27 Jun 2014 14:58:29 +0000 Received: by mail-wg0-f50.google.com with SMTP id m15so5154004wgh.33 for ; Fri, 27 Jun 2014 07:58:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KD0347MgWus2nay50UkKYlKROaX98+dTHHNpWvWPVB8=; b=QeHBaBmJFvn/cPtdiaKn9cuWJHdgijAULNYpDseJNSBX5yTUwLhMCaAau7GMd9QPka I9bFar1qhezaiM0j3gkFUmErjRfKl9PcbvFem8uUdnJmGR3kIHdTkoZftg57eV72xCA4 wHwKR9N2OOGwEZgq6napKTv84tJR+OGCsR8/ckZK68zmyWHkq0o3+V/RNPGz2WAiZKNB X+xapTJzqLg4ILYYGcEWxDDF/T2LHUhLy1nZ8p5Ju/IAmfsPv7qJSjtIYxwv8vetBsRq JfqrULfeH0HkilzReOSJuSWdscuJ5+g+z8hJNU+Ox9yjffZCB98f/KN18PeMcqFvA/FX +zbQ== X-Gm-Message-State: ALoCoQmtbolV/b6Qfz/afF2FOKnJHy2dOkdLEz2w4OlfwkD+VufoyFqusrw2PnbU2lZG7m2eZfGy X-Received: by 10.194.77.238 with SMTP id v14mr26101067wjw.103.1403881086570; Fri, 27 Jun 2014 07:58:06 -0700 (PDT) Received: from localhost.localdomain (216.193-240-81.adsl-dyn.isp.belgacom.be. [81.240.193.216]) by mx.google.com with ESMTPSA id 19sm21920749wjz.3.2014.06.27.07.58.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jun 2014 07:58:05 -0700 (PDT) From: Jean Pihet To: Will Deacon , linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, Sneha Priya , linux-kernel@vger.kernel.org, Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 1/3] ARM: perf: Check that current->mm is alive before getting user callchain Date: Fri, 27 Jun 2014 16:57:45 +0200 Message-Id: <1403881067-22690-2-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403881067-22690-1-git-send-email-jean.pihet@linaro.org> References: <1403881067-22690-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140627_075828_844940_7123CF09 X-CRM114-Status: UNSURE ( 9.33 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Jean Pihet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP An event may occur when an mm is already released. As per commit 20afc60f892d285fde179ead4b24e6a7938c2f1b 'x86, perf: Check that current->mm is alive before getting user callchain' Signed-off-by: Jean Pihet Cc: Will Deacon Acked-by: Will Deacon --- arch/arm/kernel/perf_event.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 4238bcb..6493c4c 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -590,6 +590,10 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) } perf_callchain_store(entry, regs->ARM_pc); + + if (!current->mm) + return; + tail = (struct frame_tail __user *)regs->ARM_fp - 1; while ((entry->nr < PERF_MAX_STACK_DEPTH) &&