public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: linux-kernel@vger•kernel.org
Cc: Mathieu Poirier <mathieu.poirier@linaro•org>,
	Suzuki Poulouse <suzuki.poulose@arm•com>,
	Alexander Shishkin <alexander.shishkin@linux•intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
	Alexey Budankov <alexey.budankov@linux•intel.com>,
	Igor Lubashev <ilubashe@akamai•com>,
	James Morris <jmorris@namei•org>,
	stable@vger•kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat•com>,
	Peter Zijlstra <peterz@infradead•org>,
	Jiri Olsa <jolsa@kernel•org>, Namhyung Kim <namhyung@kernel•org>,
	Alexander Dahl <ada@thorsis•com>,
	linux-arm-kernel@lists•infradead.org
Subject: [PATCH 4.19 01/57] perf event: Check ref_reloc_sym before using it
Date: Tue,  1 Dec 2020 09:53:06 +0100	[thread overview]
Message-ID: <20201201084647.886759183@linuxfoundation.org> (raw)
In-Reply-To: <20201201084647.751612010@linuxfoundation.org>

From: Igor Lubashev <ilubashe@akamai•com>

commit e9a6882f267a8105461066e3ea6b4b6b9be1b807 upstream.

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 <mathieu.poirier@linaro•org>
Signed-off-by: Igor Lubashev <ilubashe@akamai•com>
Tested-by: Mathieu Poirier <mathieu.poirier@linaro•org>
Cc: Alexander Shishkin <alexander.shishkin@linux•intel.com>
Cc: Alexey Budankov <alexey.budankov@linux•intel.com>
Cc: James Morris <jmorris@namei•org>
Cc: Jiri Olsa <jolsa@kernel•org>
Cc: Namhyung Kim <namhyung@kernel•org>
Cc: Peter Zijlstra <peterz@infradead•org>
Cc: Suzuki Poulouse <suzuki.poulose@arm•com>
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 <acme@redhat•com>
Cc: Alexander Dahl <ada@thorsis•com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation•org>

---
 tools/perf/util/event.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -912,11 +912,13 @@ static int __perf_event__synthesize_kern
 	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
@@ -939,7 +941,6 @@ static int __perf_event__synthesize_kern
 		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));



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

           reply	other threads:[~2020-12-01  9:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20201201084647.751612010@linuxfoundation.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201084647.886759183@linuxfoundation.org \
    --to=gregkh@linuxfoundation$(echo .)org \
    --cc=acme@redhat$(echo .)com \
    --cc=ada@thorsis$(echo .)com \
    --cc=alexander.shishkin@linux$(echo .)intel.com \
    --cc=alexey.budankov@linux$(echo .)intel.com \
    --cc=ilubashe@akamai$(echo .)com \
    --cc=jmorris@namei$(echo .)org \
    --cc=jolsa@kernel$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mathieu.poirier@linaro$(echo .)org \
    --cc=namhyung@kernel$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=stable@vger$(echo .)kernel.org \
    --cc=suzuki.poulose@arm$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox