From patchwork Thu Aug 29 14:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 11121487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA1121399 for ; Thu, 29 Aug 2019 14:42:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B716423403 for ; Thu, 29 Aug 2019 14:42:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fG90n0eW"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="sr1uDFL0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B716423403 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X++sJ3Fi0uVe0oKBGBNnywqHvzQ3/FU7VqJ0EDmaSTg=; b=fG90n0eW4uNopu WdQDic9v79/NGi9T2xohBszgKBKv/189FfwR4AySnOxj88Q7uGJ1FCJP9TIEquuPV+8PWcBXwagA7 oucArC0jdP6aZI4Hksnd//8M7h7TUrS0C7CZPr4ci/hUhyKv1sAfTeMpDjVvEC529bQGtcifztCbi vpjHpS5+AFCLZ1Dob6YKyqeF6UN+7rimSqGacO9kRN1gFGdjw1xnPkm2pgdEhERXsl9Z1/cmKma6v RZxvXbSSkt+I/bD5DgydPAzzqmdQX0xPBm0GOz+/1QUrVgPplEL5tL5ShVNn51hmbfZJPhN4ni6JU P+b0tBG5CFwPoourQHOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i3Ld3-0001by-1Q; Thu, 29 Aug 2019 14:42:25 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i3LaY-0008HW-64 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2019 14:39:54 +0000 Received: from quaco.ghostprotocols.net (unknown [179.97.35.50]) (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 CEA7823407; Thu, 29 Aug 2019 14:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567089587; bh=uDqbdBuhP1ybWO26e7nw/Zs1qPgjlmnImdxzHTf5pjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sr1uDFL0ReGbbsBRLZMfTE4qbYgiuDtFWrZtR3RYGgZOaKp+GxcBq+bfFb/o0QSyZ dLFXUbxi6lC6FztMeA1sPmNWzPTEmXweCwZsEmvQHSTJvltxIDb3xS+tEOCBMTPj+6 dACQaAqr84dX+CLgOrHVxpJVVM3NbkC0mKftGG7s= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Subject: [PATCH 02/37] perf event: Check ref_reloc_sym before using it Date: Thu, 29 Aug 2019 11:38:42 -0300 Message-Id: <20190829143917.29745-3-acme@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190829143917.29745-1-acme@kernel.org> References: <20190829143917.29745-1-acme@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190829_073952_562215_42067187 X-CRM114-Status: GOOD ( 10.96 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnaldo Carvalho de Melo , Mathieu Poirier , Suzuki Poulouse , Clark Williams , Alexey Budankov , Igor Lubashev , linux-kernel@vger.kernel.org, James Morris , linux-perf-users@vger.kernel.org, Alexander Shishkin , Peter Zijlstra , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Igor Lubashev Check for ref_reloc_sym before using it instead of checking symbol_conf.kptr_restrict and relying solely on that check. Reported-by: Mathieu Poirier Signed-off-by: Igor Lubashev Tested-by: Mathieu Poirier Cc: Alexander Shishkin Cc: Alexey Budankov Cc: James Morris Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Suzuki Poulouse Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1566869956-7154-2-git-send-email-ilubashe@akamai.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 33616ea62a47..e33dd1a040cc 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -913,11 +913,13 @@ static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, int err; union perf_event *event; - if (symbol_conf.kptr_restrict) - return -1; if (map == NULL) return -1; + kmap = map__kmap(map); + if (!kmap->ref_reloc_sym) + return -1; + /* * We should get this from /sys/kernel/sections/.text, but till that is * available use this, and after it is use this as a fallback for older @@ -940,7 +942,6 @@ static int __perf_event__synthesize_kernel_mmap(struct perf_tool *tool, event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; } - kmap = map__kmap(map); size = snprintf(event->mmap.filename, sizeof(event->mmap.filename), "%s%s", machine->mmap_name, kmap->ref_reloc_sym->name) + 1; size = PERF_ALIGN(size, sizeof(u64));