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-next>] [day] [month] [year] [list]
Message-Id: <20200519132616.794171-1-timo@incline.eu>
Date:   Tue, 19 May 2020 15:26:16 +0200
From:   Timo Beckers <timo@...line.eu>
To:     unlisted-recipients:; (no To-header on input)
Cc:     timo@...line.eu, Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM)
Subject: [PATCH] perf core: apply calculated padding to PERF_SAMPLE_RAW output

Zero the amount of padding bytes determined in perf_prepare_sample().
This prevents garbage being read from the ring buffer after it has wrapped
the page boundary at least once.

Signed-off-by: Timo Beckers <timo@...line.eu>
---
 kernel/events/core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 80cf996a7f19..d4e0b003ece0 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6807,8 +6807,16 @@ void perf_output_sample(struct perf_output_handle *handle,
 					break;
 				frag = frag->next;
 			} while (1);
-			if (frag->pad)
-				__output_skip(handle, NULL, frag->pad);
+			/*
+			 * The padding value is determined in
+			 * perf_prepare_sample() and is not
+			 * expected to exceed u64.
+			 */
+			if (frag->pad) {
+				u64 zero = 0;
+
+				__output_copy(handle, &zero, frag->pad);
+			}
 		} else {
 			struct {
 				u32	size;
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ