Skip to contentSkip to conversation

tracing: Histogram fix take two and two more fixes

GIT PULL Merged Steven Rostedt 2 participants 2 messages Nov 19, 2021 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Linus,

Tracing fixes:

- Fix double free in destroy_hist_field

- Harden memset() of trace_iterator structure

- Do not warn in trace printk check when test buffer fills up

Please pull the latest trace-v5.16-6 tree, which can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.16-6

Tag SHA1: 61ba32adb5e7d2d6534234bd22bd43a259419187 Head SHA1: 2ef75e9bd2c998f1c6f6f23a3744136105ddefd5

Kalesh Singh (1):
tracing/histogram: Fix UAF in destroy_hist_field()

Kees Cook (1):
tracing: Use memset_startat() to zero struct trace_iterator

Nikita Yushchenko (1):
tracing: Don't use out-of-sync va_list in event printing

----

 kernel/trace/trace.c             | 16 +++++++++++++---
 kernel/trace/trace_events_hist.c | 41 +++++++++++++++++++++-------------------
 2 files changed, 35 insertions(+), 22 deletions(-)

---------------------------

kernel/trace/trace.c +13 -3
index f9139dc1262c..88de94da596b 100644
@@ -3812,6 +3812,18 @@ void trace_check_vprintf(struct trace_iterator *iter, const char *fmt,
 		iter->fmt[i] = '\0';
 		trace_seq_vprintf(&iter->seq, iter->fmt, ap);
 
+		/*
+		 * If iter->seq is full, the above call no longer guarantees
+		 * that ap is in sync with fmt processing, and further calls
+		 * to va_arg() can return wrong positional arguments.
+		 *
+		 * Ensure that ap is no longer used in this case.
+		 */
+		if (iter->seq.full) {
+			p = "";
+			break;
+		}
+
 		if (star)
 			len = va_arg(ap, int);
 
@@ -6706,9 +6718,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
 		cnt = PAGE_SIZE - 1;
 
 	/* reset all but tr, trace, and overruns */
-	memset(&iter->seq, 0,
-	       sizeof(struct trace_iterator) -
-	       offsetof(struct trace_iterator, seq));
+	memset_startat(iter, 0, seq);
 	cpumask_clear(iter->started);
 	trace_seq_init(&iter->seq);
 	iter->pos = -1;
kernel/trace/trace_events_hist.c +22 -19

112 lines not on this page · raw message

merge bot Merged
#1 lore raw
The pull request you sent on Fri, 19 Nov 2021 16:12:28 -0500:

The pull request you sent on Fri, 19 Nov 2021 16:12:28 -0500:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git trace-v5.16-6

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e4365e369fcc974057377e8cdcd9dfe5a7b05b62

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html