Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1299579 > unrolled thread
| Started by | "Qiu, PeiyangX" <peiyangx.qiu@intel.com> |
|---|---|
| First post | 2015-12-31 06:20 +0100 |
| Last post | 2016-01-07 05:00 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] trace: correct start_index in find_next "Qiu, PeiyangX" <peiyangx.qiu@intel.com> - 2015-12-31 06:20 +0100
Re: [PATCH] trace: correct start_index in find_next "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> - 2016-01-07 04:00 +0100
Re: [PATCH] trace: correct start_index in find_next "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> - 2016-01-07 05:00 +0100
Re: [PATCH] trace: correct start_index in find_next Steven Rostedt <rostedt@goodmis.org> - 2016-01-07 05:00 +0100
| From | "Qiu, PeiyangX" <peiyangx.qiu@intel.com> |
|---|---|
| Date | 2015-12-31 06:20 +0100 |
| Subject | [PATCH] trace: correct start_index in find_next |
| Message-ID | <qLDOy-9q-9@gated-at.bofh.it> |
From: Qiu Peiyang <peiyangx.qiu@intel.com> When we do cat /sys/kernel/debug/tracing/printk_formats, we hit kernel panic at t_show. general protection fault: 0000 [#1] PREEMPT SMP CPU: 0 PID: 2957 Comm: sh Tainted: G W O 3.14.55-x86_64-01062-gd4acdc7 #2 RIP: 0010:[<ffffffff811375b2>] [<ffffffff811375b2>] t_show+0x22/0xe0 RSP: 0000:ffff88002b4ebe80 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000004 RDX: 0000000000000004 RSI: ffffffff81fd26a6 RDI: ffff880032f9f7b1 RBP: ffff88002b4ebe98 R08: 0000000000001000 R09: 000000000000ffec R10: 0000000000000000 R11: 000000000000000f R12: ffff880004d9b6c0 R13: 7365725f6d706400 R14: ffff880004d9b6c0 R15: ffffffff82020570 FS: 0000000000000000(0000) GS:ffff88003aa00000(0063) knlGS:00000000f776bc40 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 00000000f6c02ff0 CR3: 000000002c2b3000 CR4: 00000000001007f0 Call Trace: [<ffffffff811dc076>] seq_read+0x2f6/0x3e0 [<ffffffff811b749b>] vfs_read+0x9b/0x160 [<ffffffff811b7f69>] SyS_read+0x49/0xb0 [<ffffffff81a3a4b9>] ia32_do_call+0x13/0x13 ---[ end trace 5bd9eb630614861e ]--- Kernel panic - not syncing: Fatal exception When the first time find_next calls find_next_mod_format, it should iterate the trace_bprintk_fmt_list to find the first print format of the module. However in current code, start_index is smaller than *pos at first, and code will not iterate the list. Latter container_of will get the wrong address with former v, which will cause mod_fmt be a meaningless object and so is the returned mod_fmt->fmt. This patch will fix it by correcting the start_index. After fixed, when the first time calls find_next_mod_format, start_index will be equal to *pos, and code will iterate the trace_bprintk_fmt_list to get the right module printk format, so is the returned mod_fmt->fmt. Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com> --- kernel/trace/trace_printk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c index 1c2b285..64f0a26 100644 --- a/kernel/trace/trace_printk.c +++ b/kernel/trace/trace_printk.c @@ -273,6 +273,7 @@ static const char **find_next(void *v, loff_t *pos) if (*pos < last_index + start_index) return __start___tracepoint_str + (*pos - last_index); + start_index += last_index; return find_next_mod_format(start_index, v, fmt, pos); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> |
|---|---|
| Date | 2016-01-07 04:00 +0100 |
| Message-ID | <qO8XU-1Eh-5@gated-at.bofh.it> |
| In reply to | #1299579 |
On 2015/12/31 13:11, Qiu, PeiyangX wrote: > From: Qiu Peiyang <peiyangx.qiu@intel.com> > > When we do cat /sys/kernel/debug/tracing/printk_formats, we hit kernel > panic at t_show. > > general protection fault: 0000 [#1] PREEMPT SMP > CPU: 0 PID: 2957 Comm: sh Tainted: G W O 3.14.55-x86_64-01062-gd4acdc7 #2 > RIP: 0010:[<ffffffff811375b2>] > [<ffffffff811375b2>] t_show+0x22/0xe0 > RSP: 0000:ffff88002b4ebe80 EFLAGS: 00010246 > RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000004 > RDX: 0000000000000004 RSI: ffffffff81fd26a6 RDI: ffff880032f9f7b1 > RBP: ffff88002b4ebe98 R08: 0000000000001000 R09: 000000000000ffec > R10: 0000000000000000 R11: 000000000000000f R12: ffff880004d9b6c0 > R13: 7365725f6d706400 R14: ffff880004d9b6c0 R15: ffffffff82020570 > FS: 0000000000000000(0000) GS:ffff88003aa00000(0063) knlGS:00000000f776bc40 > CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 > CR2: 00000000f6c02ff0 CR3: 000000002c2b3000 CR4: 00000000001007f0 > Call Trace: > [<ffffffff811dc076>] seq_read+0x2f6/0x3e0 > [<ffffffff811b749b>] vfs_read+0x9b/0x160 > [<ffffffff811b7f69>] SyS_read+0x49/0xb0 > [<ffffffff81a3a4b9>] ia32_do_call+0x13/0x13 > ---[ end trace 5bd9eb630614861e ]--- > Kernel panic - not syncing: Fatal exception > > When the first time find_next calls find_next_mod_format, it should > iterate the trace_bprintk_fmt_list to find the first print format of > the module. However in current code, start_index is smaller than *pos > at first, and code will not iterate the list. Latter container_of will > get the wrong address with former v, which will cause mod_fmt be a > meaningless object and so is the returned mod_fmt->fmt. > > This patch will fix it by correcting the start_index. After fixed, > when the first time calls find_next_mod_format, start_index will be > equal to *pos, and code will iterate the trace_bprintk_fmt_list to > get the right module printk format, so is the returned mod_fmt->fmt. > > Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com> > --- > kernel/trace/trace_printk.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c > index 1c2b285..64f0a26 100644 > --- a/kernel/trace/trace_printk.c > +++ b/kernel/trace/trace_printk.c > @@ -273,6 +273,7 @@ static const char **find_next(void *v, loff_t *pos) > if (*pos < last_index + start_index) > return __start___tracepoint_str + (*pos - last_index); > > + start_index += last_index; > return find_next_mod_format(start_index, v, fmt, pos); > } Rusty, Steven, How is this patch? It fixes a kernel panic. Yanmin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> |
|---|---|
| Date | 2016-01-07 05:00 +0100 |
| Message-ID | <qO9TY-2mQ-19@gated-at.bofh.it> |
| In reply to | #1303253 |
On 2016/1/7 11:50, Steven Rostedt wrote: > On Thu, 07 Jan 2016 10:56:56 +0800 > "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> wrote: > >> How is this patch? It fixes a kernel panic. >> > Linus already pulled it. It's also marked for stable. See commit: > f36d1be2930ede0a1947686e1126ffda5d5ee1bb in Linus's tree. > > I renamed the subject slightly to: > > "tracing: Fix setting of start_index in find_next()" > Thanks as usual. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-01-07 05:00 +0100 |
| Message-ID | <qO9TY-2mQ-21@gated-at.bofh.it> |
| In reply to | #1303253 |
On Thu, 07 Jan 2016 10:56:56 +0800 "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> wrote: > How is this patch? It fixes a kernel panic. > Linus already pulled it. It's also marked for stable. See commit: f36d1be2930ede0a1947686e1126ffda5d5ee1bb in Linus's tree. I renamed the subject slightly to: "tracing: Fix setting of start_index in find_next()" -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web