Commit 8066178f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Fix bad git merge of #endif in arm64 code

   A merge of the arm64 tree caused #endif to go into the wrong place

 - Fix crash on lseek of write access to tracefs/error_log

   Opening error_log as write only, and then doing an lseek() causes a
   kernel panic, because the lseek() handle expects a "seq_file" to
   exist (which is not done on write only opens). Use tracing_lseek()
   that tests for this instead of calling the default seq lseek handler.

 - Check for negative instead of -E2BIG for error on strscpy() returns

   Instead of testing for -E2BIG from strscpy(), to be more robust,
   check for less than zero, which will make sure it catches any error
   that strscpy() may someday return.

* tag 'trace-v6.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/boot: Test strscpy() against less than zero for error
  arm64: ftrace: fix build error with CONFIG_FUNCTION_GRAPH_TRACER=n
  tracing: Fix null pointer dereference in tracing_err_log_open()
parents 7fdeb23f fddca7db
...@@ -213,9 +213,9 @@ int main(void) ...@@ -213,9 +213,9 @@ int main(void)
DEFINE(FGRET_REGS_X7, offsetof(struct fgraph_ret_regs, regs[7])); DEFINE(FGRET_REGS_X7, offsetof(struct fgraph_ret_regs, regs[7]));
DEFINE(FGRET_REGS_FP, offsetof(struct fgraph_ret_regs, fp)); DEFINE(FGRET_REGS_FP, offsetof(struct fgraph_ret_regs, fp));
DEFINE(FGRET_REGS_SIZE, sizeof(struct fgraph_ret_regs)); DEFINE(FGRET_REGS_SIZE, sizeof(struct fgraph_ret_regs));
#endif
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
DEFINE(FTRACE_OPS_DIRECT_CALL, offsetof(struct ftrace_ops, direct_call)); DEFINE(FTRACE_OPS_DIRECT_CALL, offsetof(struct ftrace_ops, direct_call));
#endif
#endif #endif
return 0; return 0;
} }
...@@ -8146,7 +8146,7 @@ static const struct file_operations tracing_err_log_fops = { ...@@ -8146,7 +8146,7 @@ static const struct file_operations tracing_err_log_fops = {
.open = tracing_err_log_open, .open = tracing_err_log_open,
.write = tracing_err_log_write, .write = tracing_err_log_write,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = tracing_lseek,
.release = tracing_err_log_release, .release = tracing_err_log_release,
}; };
......
...@@ -31,7 +31,7 @@ trace_boot_set_instance_options(struct trace_array *tr, struct xbc_node *node) ...@@ -31,7 +31,7 @@ trace_boot_set_instance_options(struct trace_array *tr, struct xbc_node *node)
/* Common ftrace options */ /* Common ftrace options */
xbc_node_for_each_array_value(node, "options", anode, p) { xbc_node_for_each_array_value(node, "options", anode, p) {
if (strscpy(buf, p, ARRAY_SIZE(buf)) == -E2BIG) { if (strscpy(buf, p, ARRAY_SIZE(buf)) < 0) {
pr_err("String is too long: %s\n", p); pr_err("String is too long: %s\n", p);
continue; continue;
} }
...@@ -87,7 +87,7 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node) ...@@ -87,7 +87,7 @@ trace_boot_enable_events(struct trace_array *tr, struct xbc_node *node)
const char *p; const char *p;
xbc_node_for_each_array_value(node, "events", anode, p) { xbc_node_for_each_array_value(node, "events", anode, p) {
if (strscpy(buf, p, ARRAY_SIZE(buf)) == -E2BIG) { if (strscpy(buf, p, ARRAY_SIZE(buf)) < 0) {
pr_err("String is too long: %s\n", p); pr_err("String is too long: %s\n", p);
continue; continue;
} }
...@@ -486,7 +486,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode, ...@@ -486,7 +486,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
p = xbc_node_find_value(enode, "filter", NULL); p = xbc_node_find_value(enode, "filter", NULL);
if (p && *p != '\0') { if (p && *p != '\0') {
if (strscpy(buf, p, ARRAY_SIZE(buf)) == -E2BIG) if (strscpy(buf, p, ARRAY_SIZE(buf)) < 0)
pr_err("filter string is too long: %s\n", p); pr_err("filter string is too long: %s\n", p);
else if (apply_event_filter(file, buf) < 0) else if (apply_event_filter(file, buf) < 0)
pr_err("Failed to apply filter: %s\n", buf); pr_err("Failed to apply filter: %s\n", buf);
...@@ -494,7 +494,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode, ...@@ -494,7 +494,7 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode,
if (IS_ENABLED(CONFIG_HIST_TRIGGERS)) { if (IS_ENABLED(CONFIG_HIST_TRIGGERS)) {
xbc_node_for_each_array_value(enode, "actions", anode, p) { xbc_node_for_each_array_value(enode, "actions", anode, p) {
if (strscpy(buf, p, ARRAY_SIZE(buf)) == -E2BIG) if (strscpy(buf, p, ARRAY_SIZE(buf)) < 0)
pr_err("action string is too long: %s\n", p); pr_err("action string is too long: %s\n", p);
else if (trigger_process_regex(file, buf) < 0) else if (trigger_process_regex(file, buf) < 0)
pr_err("Failed to apply an action: %s\n", p); pr_err("Failed to apply an action: %s\n", p);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment