tracing: Fixes for 5.13
Subsystems (3)
Steven Rostedt
maintainerLinus,
Tracing fixes for 5.13:
- Fix the length check in the temp buffer filter
- Fix record mcount handling of st_shndx
- Fix build failure in bootconfig tools for "fallthrough" macro
- Fix error return of bootconfig apply_xbc() routine
Please pull the latest trace-v5.13-rc5 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.13-rc5
Tag SHA1: 000cdf0e4dec9904fa4a66eb4a173b14208377c3 Head SHA1: 9e419de4c678418a7eb17f27f9d07c0e47bd463a
Liangyan (1):
tracing: Correct the length check which causes memory corruption
Masami Hiramatsu (1):
tools/bootconfig: Fix a build error accroding to undefined fallthrough
Peter Zijlstra (1):
recordmcount: Correct st_shndx handling
Steven Rostedt (VMware) (1):
ftrace: Do not blindly read the ip address in ftrace_bug()
Zhen Lei (1):
tools/bootconfig: Fix error return code in apply_xbc()
----
kernel/trace/ftrace.c | 8 +++++++- kernel/trace/trace.c | 2 +- scripts/recordmcount.h | 13 +++++++++---- tools/bootconfig/include/linux/bootconfig.h | 4 ++++ tools/bootconfig/main.c | 1 + 5 files changed, 22 insertions(+), 6 deletions(-)
---------------------------
kernel/trace/ftrace.c +7 -1
@@ -1967,12 +1967,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops,static void print_ip_ins (const char *fmt,const unsigned char *p) { +char ins[MCOUNT_INSN_SIZE ];int i; +if (copy_from_kernel_nofault (ins, p,MCOUNT_INSN_SIZE )) { +printk (KERN_CONT "%s[FAULT] %px\n" , fmt, p); +return ; + } +printk (KERN_CONT "%s" , fmt);for (i =0 ; i <MCOUNT_INSN_SIZE ; i++) -printk (KERN_CONT "%s%02x" , i ?":" :"" , p[i]); +printk (KERN_CONT "%s%02x" , i ?":" :"" , ins[i]); }enum ftrace_bug_type ftrace_bug_type;
kernel/trace/trace.c +1 -1
@@ -2736,7 +2736,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb, (entry = this_cpu_read(trace_buffered_event))) {/* Try to use the per cpu buffer first */ val =this_cpu_inc_return (trace_buffered_event_cnt); -if ((len < (PAGE_SIZE -sizeof (*entry))) && val ==1 ) { +if ((len < (PAGE_SIZE -sizeof (*entry) -sizeof (entry->array[0 ]))) && val ==1 ) {trace_event_setup (entry, type, trace_ctx); entry->array[0 ] = len;return entry;
scripts/recordmcount.h +9 -4
@@ -194,13 +194,18 @@ static unsigned int get_symindex(Elf_Sym const *sym, Elf32_Word const *symtab,unsigned long offset;int index; -if (sym->st_shndx !=SHN_XINDEX ) +if (sym->st_shndx >SHN_UNDEF && + sym->st_shndx <SHN_LORESERVE )return w2 (sym->st_shndx); - offset = (unsigned long )sym - (unsigned long )symtab; - index = offset /sizeof (*sym); +if (sym->st_shndx ==SHN_XINDEX ) { + offset = (unsigned long )sym - (unsigned long )symtab; + index = offset /sizeof (*sym); -return w (symtab_shndx[index]); +return w (symtab_shndx[index]); + } + +return 0 ; }static unsigned int get_shnum (Elf_Ehdr const *ehdr,Elf_Shdr const *shdr0)
tools/bootconfig/include/linux/bootconfig.h +4 -0
@@ -4,4 +4,8 @@#include "../../../../include/linux/bootconfig.h" +#ifndef fallthrough +# define fallthrough +#endif +#endif
tools/bootconfig/main.c +1 -0
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path) }/* TODO: Ensure the @path is initramfs/initrd image */ if (fstat (fd, &stat) <0 ) { + ret = -errno;pr_err ("Failed to get the size of %s\n" , path); goto out; }
Steven Rostedt
maintainerQuoted 4 lines · On Wed, 9 Jun 2021 20:43:17 -0400 Steven Rostedt <[email protected]> wrote:
Peter Zijlstra (1):
recordmcount: Correctst_shndxhandling
Please don't pull this one. It appears that this patch breaks the PPC build.
I'll send a new pull request without this patch added. It was the last one in the series, so I don't need to retest anything.
-- Steve