Merge tag 'trace-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: "There's not much changes for the tracing system this release. Mostly small clean ups and fixes. The biggest change is to how bprintf works. bprintf is used by trace_printk() to just save the format and args of a printf call, and the formatting is done when the trace buffer is read. This is done to keep the formatting out of the fast path (this was recommended by you). The issue is when arguments are de-referenced. If a pointer is saved, and the format has something like "%*pbl", when the buffer is read, it will de-reference the argument then. The problem is if the data no longer exists. This can cause the kernel to oops. The fix for this was to make these de-reference pointes do the formatting at the time it is called (the fast path), as this guarantees that the data exists (and doesn't change later)" * tag 'trace-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: vsprintf: Do not have bprintf dereference pointers ftrace: Mark function tracer test functions noinline/noclone trace_uprobe: Display correct offset in uprobe_events tracing: Make sure the parsed string always terminates with '\0' tracing: Clear parser->idx if only spaces are read tracing: Detect the string nul character when parsing user input string
This commit is contained in:
@@ -5015,7 +5015,6 @@ int ftrace_regex_release(struct inode *inode, struct file *file)
|
||||
|
||||
parser = &iter->parser;
|
||||
if (trace_parser_loaded(parser)) {
|
||||
parser->buffer[parser->idx] = 0;
|
||||
ftrace_match_records(iter->hash, parser->buffer, parser->idx);
|
||||
}
|
||||
|
||||
@@ -5329,7 +5328,6 @@ ftrace_graph_release(struct inode *inode, struct file *file)
|
||||
parser = &fgd->parser;
|
||||
|
||||
if (trace_parser_loaded((parser))) {
|
||||
parser->buffer[parser->idx] = 0;
|
||||
ret = ftrace_graph_set_hash(fgd->new_hash,
|
||||
parser->buffer);
|
||||
}
|
||||
|
@@ -530,8 +530,6 @@ int trace_pid_write(struct trace_pid_list *filtered_pids,
|
||||
ubuf += ret;
|
||||
cnt -= ret;
|
||||
|
||||
parser.buffer[parser.idx] = 0;
|
||||
|
||||
ret = -EINVAL;
|
||||
if (kstrtoul(parser.buffer, 0, &val))
|
||||
break;
|
||||
@@ -1236,18 +1234,18 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
|
||||
cnt--;
|
||||
}
|
||||
|
||||
parser->idx = 0;
|
||||
|
||||
/* only spaces were written */
|
||||
if (isspace(ch)) {
|
||||
if (isspace(ch) || !ch) {
|
||||
*ppos += read;
|
||||
ret = read;
|
||||
goto out;
|
||||
}
|
||||
|
||||
parser->idx = 0;
|
||||
}
|
||||
|
||||
/* read the non-space input */
|
||||
while (cnt && !isspace(ch)) {
|
||||
while (cnt && !isspace(ch) && ch) {
|
||||
if (parser->idx < parser->size - 1)
|
||||
parser->buffer[parser->idx++] = ch;
|
||||
else {
|
||||
@@ -1262,12 +1260,14 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
|
||||
}
|
||||
|
||||
/* We either got finished input or we have to wait for another call. */
|
||||
if (isspace(ch)) {
|
||||
if (isspace(ch) || !ch) {
|
||||
parser->buffer[parser->idx] = 0;
|
||||
parser->cont = false;
|
||||
} else if (parser->idx < parser->size - 1) {
|
||||
parser->cont = true;
|
||||
parser->buffer[parser->idx++] = ch;
|
||||
/* Make sure the parsed string always terminates with '\0'. */
|
||||
parser->buffer[parser->idx] = 0;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
|
@@ -885,8 +885,6 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
|
||||
if (*parser.buffer == '!')
|
||||
set = 0;
|
||||
|
||||
parser.buffer[parser.idx] = 0;
|
||||
|
||||
ret = ftrace_set_clr_event(tr, parser.buffer + !set, set);
|
||||
if (ret)
|
||||
goto out_put;
|
||||
|
@@ -1,13 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
#include "trace.h"
|
||||
|
||||
int DYN_FTRACE_TEST_NAME(void)
|
||||
noinline __noclone int DYN_FTRACE_TEST_NAME(void)
|
||||
{
|
||||
/* used to call mcount */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DYN_FTRACE_TEST_NAME2(void)
|
||||
noinline __noclone int DYN_FTRACE_TEST_NAME2(void)
|
||||
{
|
||||
/* used to call mcount */
|
||||
return 0;
|
||||
|
@@ -608,7 +608,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
|
||||
|
||||
/* Don't print "0x (null)" when offset is 0 */
|
||||
if (tu->offset) {
|
||||
seq_printf(m, "0x%p", (void *)tu->offset);
|
||||
seq_printf(m, "0x%px", (void *)tu->offset);
|
||||
} else {
|
||||
switch (sizeof(void *)) {
|
||||
case 4:
|
||||
|
مرجع در شماره جدید
Block a user