Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-31 Thread zhouchengming
On 2017/11/1 5:59, Steven Rostedt wrote: On Mon, 30 Oct 2017 17:03:23 +0900 Masami Hiramatsu wrote: static LIST_HEAD(smp_alt_modules); -static DEFINE_MUTEX(smp_alt); -static bool uniproc_patched = false; /* protected by smp_alt */ +static bool uniproc_patched = false;

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-31 Thread zhouchengming
On 2017/11/1 5:59, Steven Rostedt wrote: On Mon, 30 Oct 2017 17:03:23 +0900 Masami Hiramatsu wrote: static LIST_HEAD(smp_alt_modules); -static DEFINE_MUTEX(smp_alt); -static bool uniproc_patched = false; /* protected by smp_alt */ +static bool uniproc_patched = false; /* protected by

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-31 Thread Steven Rostedt
On Mon, 30 Oct 2017 17:03:23 +0900 Masami Hiramatsu wrote: > > static LIST_HEAD(smp_alt_modules); > > -static DEFINE_MUTEX(smp_alt); > > -static bool uniproc_patched = false; /* protected by smp_alt */ > > +static bool uniproc_patched = false; /* protected by

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-31 Thread Steven Rostedt
On Mon, 30 Oct 2017 17:03:23 +0900 Masami Hiramatsu wrote: > > static LIST_HEAD(smp_alt_modules); > > -static DEFINE_MUTEX(smp_alt); > > -static bool uniproc_patched = false; /* protected by smp_alt */ > > +static bool uniproc_patched = false; /* protected by text_mutex */ We

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-30 Thread Masami Hiramatsu
On Fri, 27 Oct 2017 17:34:44 +0800 Zhou Chengming wrote: > Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved > functions" > > We use alternatives_text_reserved() to check if the address is in > the fixed pieces of alternative reserved, but the problem

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-30 Thread Masami Hiramatsu
On Fri, 27 Oct 2017 17:34:44 +0800 Zhou Chengming wrote: > Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved > functions" > > We use alternatives_text_reserved() to check if the address is in > the fixed pieces of alternative reserved, but the problem is that > we don't hold the

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread zhouchengming
On 2017/10/28 16:43, Masami Hiramatsu wrote: On Fri, 27 Oct 2017 21:30:24 +0800 zhouchengming wrote: On 2017/10/27 20:33, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines,

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread zhouchengming
On 2017/10/28 16:43, Masami Hiramatsu wrote: On Fri, 27 Oct 2017 21:30:24 +0800 zhouchengming wrote: On 2017/10/27 20:33, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines, below is the calltrace. We can

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread Masami Hiramatsu
On Sat, 28 Oct 2017 09:26:56 +0800 zhouchengming wrote: > On 2017/10/27 22:15, Peter Zijlstra wrote: > > On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: > >> On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > >>> This is a real bug

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread Masami Hiramatsu
On Sat, 28 Oct 2017 09:26:56 +0800 zhouchengming wrote: > On 2017/10/27 22:15, Peter Zijlstra wrote: > > On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: > >> On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > >>> This is a real bug happened on one of our machines,

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread Masami Hiramatsu
On Fri, 27 Oct 2017 21:30:24 +0800 zhouchengming wrote: > On 2017/10/27 20:33, Borislav Petkov wrote: > > On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > >> This is a real bug happened on one of our machines, below is the calltrace. > >> We can see the

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-28 Thread Masami Hiramatsu
On Fri, 27 Oct 2017 21:30:24 +0800 zhouchengming wrote: > On 2017/10/27 20:33, Borislav Petkov wrote: > > On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > >> This is a real bug happened on one of our machines, below is the calltrace. > >> We can see the trigger is at

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 22:15, Peter Zijlstra wrote: On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines, below is the calltrace. We can see the trigger is at

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 22:15, Peter Zijlstra wrote: On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines, below is the calltrace. We can see the trigger is at

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Peter Zijlstra
On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: > On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > > This is a real bug happened on one of our machines, below is the calltrace. > > We can see the trigger is at alternatives_text_reserved+0x20/0x80, and > > encounter

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Peter Zijlstra
On Fri, Oct 27, 2017 at 02:33:48PM +0200, Borislav Petkov wrote: > On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > > This is a real bug happened on one of our machines, below is the calltrace. > > We can see the trigger is at alternatives_text_reserved+0x20/0x80, and > > encounter

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 20:33, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines, below is the calltrace. We can see the trigger is at alternatives_text_reserved+0x20/0x80, and encounter a deleted (poisoned) list_head.

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 20:33, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: This is a real bug happened on one of our machines, below is the calltrace. We can see the trigger is at alternatives_text_reserved+0x20/0x80, and encounter a deleted (poisoned) list_head.

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Borislav Petkov
On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > This is a real bug happened on one of our machines, below is the calltrace. > We can see the trigger is at alternatives_text_reserved+0x20/0x80, and > encounter a deleted (poisoned) list_head. Looks like some out-of-tree, old kernel

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Borislav Petkov
On Fri, Oct 27, 2017 at 07:42:45PM +0800, zhouchengming wrote: > This is a real bug happened on one of our machines, below is the calltrace. > We can see the trigger is at alternatives_text_reserved+0x20/0x80, and > encounter a deleted (poisoned) list_head. Looks like some out-of-tree, old kernel

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 19:15, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 05:34:44PM +0800, Zhou Chengming wrote: Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved functions" We use alternatives_text_reserved() to check if the address is in the fixed pieces of alternative reserved,

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread zhouchengming
On 2017/10/27 19:15, Borislav Petkov wrote: On Fri, Oct 27, 2017 at 05:34:44PM +0800, Zhou Chengming wrote: Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved functions" We use alternatives_text_reserved() to check if the address is in the fixed pieces of alternative reserved,

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Borislav Petkov
On Fri, Oct 27, 2017 at 05:34:44PM +0800, Zhou Chengming wrote: > Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved > functions" > > We use alternatives_text_reserved() to check if the address is in > the fixed pieces of alternative reserved, but the problem is that > we don't hold

Re: [PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Borislav Petkov
On Fri, Oct 27, 2017 at 05:34:44PM +0800, Zhou Chengming wrote: > Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved > functions" > > We use alternatives_text_reserved() to check if the address is in > the fixed pieces of alternative reserved, but the problem is that > we don't hold

[PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Zhou Chengming
Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved functions" We use alternatives_text_reserved() to check if the address is in the fixed pieces of alternative reserved, but the problem is that we don't hold the smp_alt mutex when call this function. So the list traversal may

[PATCH] kprobes, x86/alternatives: use text_mutex to protect smp_alt_modules

2017-10-27 Thread Zhou Chengming
Fixes: 2cfa197 "ftrace/alternatives: Introducing *_text_reserved functions" We use alternatives_text_reserved() to check if the address is in the fixed pieces of alternative reserved, but the problem is that we don't hold the smp_alt mutex when call this function. So the list traversal may