Skip to content

Commit ad347ab

Browse files
committed
Merge tag 'trace-v5.13-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: - Fix the length check in the temp buffer filter - Fix build failure in bootconfig tools for "fallthrough" macro - Fix error return of bootconfig apply_xbc() routine * tag 'trace-v5.13-rc5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Correct the length check which causes memory corruption ftrace: Do not blindly read the ip address in ftrace_bug() tools/bootconfig: Fix a build error accroding to undefined fallthrough tools/bootconfig: Fix error return code in apply_xbc()
2 parents 548843c + 3e08a9f commit ad347ab

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

kernel/trace/ftrace.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1967,12 +1967,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops,
19671967

19681968
static void print_ip_ins(const char *fmt, const unsigned char *p)
19691969
{
1970+
char ins[MCOUNT_INSN_SIZE];
19701971
int i;
19711972

1973+
if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) {
1974+
printk(KERN_CONT "%s[FAULT] %px\n", fmt, p);
1975+
return;
1976+
}
1977+
19721978
printk(KERN_CONT "%s", fmt);
19731979

19741980
for (i = 0; i < MCOUNT_INSN_SIZE; i++)
1975-
printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]);
1981+
printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]);
19761982
}
19771983

19781984
enum ftrace_bug_type ftrace_bug_type;

kernel/trace/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2736,7 +2736,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
27362736
(entry = this_cpu_read(trace_buffered_event))) {
27372737
/* Try to use the per cpu buffer first */
27382738
val = this_cpu_inc_return(trace_buffered_event_cnt);
2739-
if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) {
2739+
if ((len < (PAGE_SIZE - sizeof(*entry) - sizeof(entry->array[0]))) && val == 1) {
27402740
trace_event_setup(entry, type, trace_ctx);
27412741
entry->array[0] = len;
27422742
return entry;

tools/bootconfig/include/linux/bootconfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44

55
#include "../../../../include/linux/bootconfig.h"
66

7+
#ifndef fallthrough
8+
# define fallthrough
9+
#endif
10+
711
#endif

tools/bootconfig/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
399399
}
400400
/* TODO: Ensure the @path is initramfs/initrd image */
401401
if (fstat(fd, &stat) < 0) {
402+
ret = -errno;
402403
pr_err("Failed to get the size of %s\n", path);
403404
goto out;
404405
}

0 commit comments

Comments
 (0)