From patchwork Mon Jul 7 13:45:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 4494881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B5C979F3B4 for ; Mon, 7 Jul 2014 13:47:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECA2520211 for ; Mon, 7 Jul 2014 13:47:57 +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 3536D20225 for ; Mon, 7 Jul 2014 13:47:57 +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 1X49F6-0003qP-Pq; Mon, 07 Jul 2014 13:46:04 +0000 Received: from mail-wg0-f42.google.com ([74.125.82.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X49Ev-0003ZR-Qs for linux-arm-kernel@lists.infradead.org; Mon, 07 Jul 2014 13:45:55 +0000 Received: by mail-wg0-f42.google.com with SMTP id n12so2618480wgh.1 for ; Mon, 07 Jul 2014 06:45:31 -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=6CnSWppcA15UeYWC7bCJbmNINYCOM5/0EFdUgxX0m54=; b=jBV92V/fbPWq1iqN2HbNm4g5yN/UG9Xcc2Mg5J5Otq9NAgnlbRKG8KarECwMjTw/Ao V1Pue8lAzeHXgC5K0iz/yQ2qCpOxe7W9uf8Vgm5nsiP1uxve/fr/+xPZS3cj8/QjM16b 8hco3e437sBTd4L/qf2QoO1P+DZzxU5uLF4jvZjIIz0fwhq854yDeebhBsMn9amz5Yl0 CzZKtiPYP8SnpfJz1t/61kGncd0PiNdh39ovTE9fmTbLoI5arVni2ETb18NJ0Je6QjpN uK5ZPbQuOonYUIBq/m4pAQdYVmCEXr5ixggDJBCTm8pLLPl1DyFVqkrHIbNmbIY6FRg9 yViQ== X-Gm-Message-State: ALoCoQnoMq1eCIiGu5Vlomy3ie8ZyUHqO6avC3h+I8eY+vvVwA4QwYiXZ4xyLwmYEX6ayM/llEmF X-Received: by 10.180.100.200 with SMTP id fa8mr36192978wib.23.1404740731021; Mon, 07 Jul 2014 06:45:31 -0700 (PDT) Received: from rachael.linaro.local ([213.122.173.130]) by mx.google.com with ESMTPSA id e18sm26653901wic.0.2014.07.07.06.45.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jul 2014 06:45:30 -0700 (PDT) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Will Deacon Subject: [PATCH 1/3] ARM: perf: Check that current->mm is alive before getting user callchain Date: Mon, 7 Jul 2014 15:45:08 +0200 Message-Id: <1404740710-14691-2-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1404740710-14691-1-git-send-email-jean.pihet@linaro.org> References: <1404740710-14691-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140707_064554_014750_3B5D142F X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Arnaldo Carvalho de Melo , steve.capper@linaro.org, Jean Pihet , Jiri Olsa , Ingo Molnar 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=-2.6 required=5.0 tests=BAYES_00,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) &&