lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <167404187070.4906.11315546110666794035.tip-bot2@tip-bot2>
Date:   Wed, 18 Jan 2023 11:37:50 -0000
From:   "tip-bot2 for Namhyung Kim" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Namhyung Kim <namhyung@...nel.org>, Ingo Molnar <mingo@...nel.org>,
        Jiri Olsa <jolsa@...nel.org>, Song Liu <song@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: perf/core] perf/core: Call perf_prepare_sample() before running BPF

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     0eed28220598cd990d094b7b9f8c832c425080c0
Gitweb:        https://git.kernel.org/tip/0eed28220598cd990d094b7b9f8c832c425080c0
Author:        Namhyung Kim <namhyung@...nel.org>
AuthorDate:    Tue, 17 Jan 2023 22:05:59 -08:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Wed, 18 Jan 2023 11:57:21 +01:00

perf/core: Call perf_prepare_sample() before running BPF

As BPF can access sample data, it needs to populate the data.  Also
remove the logic to get the callchain specifically as it's covered by
the perf_prepare_sample() now.

Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Tested-by: Jiri Olsa <jolsa@...nel.org>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Acked-by: Song Liu <song@...nel.org>
Acked-by: Peter Zijlstra <peterz@...radead.org>
Link: https://lore.kernel.org/r/20230118060559.615653-9-namhyung@kernel.org
---
 kernel/events/core.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4aa73ed..380476a 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10356,13 +10356,7 @@ static void bpf_overflow_handler(struct perf_event *event,
 	rcu_read_lock();
 	prog = READ_ONCE(event->prog);
 	if (prog) {
-		if (prog->call_get_stack &&
-		    (event->attr.sample_type & PERF_SAMPLE_CALLCHAIN) &&
-		    !(data->sample_flags & PERF_SAMPLE_CALLCHAIN)) {
-			data->callchain = perf_callchain(event, regs);
-			data->sample_flags |= PERF_SAMPLE_CALLCHAIN;
-		}
-
+		perf_prepare_sample(data, event, regs);
 		ret = bpf_prog_run(prog, &ctx);
 	}
 	rcu_read_unlock();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ