* [GIT PULL] tracing: Fixes for 5.13
@ 2021-06-11 20:13 Steven Rostedt
2021-06-12 0:22 ` pr-tracker-bot
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2021-06-11 20:13 UTC (permalink / raw)
To: Linus Torvalds; +Cc: LKML, Ingo Molnar, Andrew Morton
Liangyan <liangyan.peng@linux.alibaba.com>, Masami Hiramatsu
<mhiramat@kernel.org>, Steven Rostedt (VMware) <rostedt@goodmis.org>, Zhen
Lei <thunder.leizhen@huawei.com>
Linus,
Tracing fixes for 5.13:
- 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
[ Removed Peter's recordmcount fix from this one ]
Please pull the latest trace-v5.13-rc5-2 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.13-rc5-2
Tag SHA1: 03bc3d44c6ea2395ee6f0d05ac27e7fb492747d9
Head SHA1: 3e08a9f9760f4a70d633c328a76408e62d6f80a3
Liangyan (1):
tracing: Correct the length check which causes memory corruption
Masami Hiramatsu (1):
tools/bootconfig: Fix a build error accroding to undefined fallthrough
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 +-
tools/bootconfig/include/linux/bootconfig.h | 4 ++++
tools/bootconfig/main.c | 1 +
4 files changed, 13 insertions(+), 2 deletions(-)
---------------------------
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 2e8a3fde7104..72ef4dccbcc4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a21ef9cd2aae..9299057feb56 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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;
diff --git a/tools/bootconfig/include/linux/bootconfig.h b/tools/bootconfig/include/linux/bootconfig.h
index 078cbd2ba651..de7f30f99af3 100644
--- a/tools/bootconfig/include/linux/bootconfig.h
+++ b/tools/bootconfig/include/linux/bootconfig.h
@@ -4,4 +4,8 @@
#include "../../../../include/linux/bootconfig.h"
+#ifndef fallthrough
+# define fallthrough
+#endif
+
#endif
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 7362bef1a368..6cd6080cac04 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [GIT PULL] tracing: Fixes for 5.13
2021-06-11 20:13 [GIT PULL] tracing: Fixes for 5.13 Steven Rostedt
@ 2021-06-12 0:22 ` pr-tracker-bot
0 siblings, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2021-06-12 0:22 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Linus Torvalds, LKML, Ingo Molnar, Andrew Morton
The pull request you sent on Fri, 11 Jun 2021 16:13:39 -0400:
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git trace-v5.13-rc5-2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ad347abe4a9876b1f65f408ab467137e88f77eb4
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GIT PULL] tracing: Fixes for 5.13
2021-06-10 0:43 Steven Rostedt
@ 2021-06-10 14:46 ` Steven Rostedt
0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-06-10 14:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: LKML, Peter Zijlstra
On Wed, 9 Jun 2021 20:43:17 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Peter Zijlstra (1):
> recordmcount: Correct st_shndx handling
>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [GIT PULL] tracing: Fixes for 5.13
@ 2021-06-10 0:43 Steven Rostedt
2021-06-10 14:46 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2021-06-10 0:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: LKML
Linus,
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(-)
---------------------------
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 2e8a3fde7104..72ef4dccbcc4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -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;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a21ef9cd2aae..9299057feb56 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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;
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index f9b19524da11..7e8a11ed5e2f 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -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)
diff --git a/tools/bootconfig/include/linux/bootconfig.h b/tools/bootconfig/include/linux/bootconfig.h
index 078cbd2ba651..de7f30f99af3 100644
--- a/tools/bootconfig/include/linux/bootconfig.h
+++ b/tools/bootconfig/include/linux/bootconfig.h
@@ -4,4 +4,8 @@
#include "../../../../include/linux/bootconfig.h"
+#ifndef fallthrough
+# define fallthrough
+#endif
+
#endif
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 7362bef1a368..6cd6080cac04 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-12 0:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 20:13 [GIT PULL] tracing: Fixes for 5.13 Steven Rostedt
2021-06-12 0:22 ` pr-tracker-bot
-- strict thread matches above, loose matches on Subject: below --
2021-06-10 0:43 Steven Rostedt
2021-06-10 14:46 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.