Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-19 Thread Chris Metcalf
On 5/19/2016 1:54 PM, Peter Zijlstra wrote: So the 'simple' thing is: struct rq *rq = cpu_rq(cpu); struct task_struct *task; raw_spin_lock_irq(&rq->lock); task = rq->curr; get_task_struct(task); raw_spin_unlock_irq(&rq->lock); Because by holding

Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-19 Thread Peter Zijlstra
On Thu, May 19, 2016 at 10:42:39AM -0400, Chris Metcalf wrote: > + rcu_read_lock(); > + p = cpu_curr(cpu); Here @cpu can schedule, hit TASK_DEAD and do put_task_struct() and kfree() the task. > + get_task_struct(p); And here we then do a use-after-free. > + rcu_read_unlock(); >

Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-19 Thread Chris Metcalf
(Resending in text/plain. I just screwed around with my Thunderbird config some more in hopes of getting it to pay attention to all the settings that say "use plain text for LKML", but, we'll see.) On 5/18/2016 1:06 PM, Peter Zijlstra wrote: On Wed, May 18, 2016 at 12:35:19PM -0400, Chris Metca

Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-18 Thread Peter Zijlstra
On Wed, May 18, 2016 at 12:35:19PM -0400, Chris Metcalf wrote: > On 5/18/2016 9:56 AM, Peter Zijlstra wrote: > >On Tue, Apr 05, 2016 at 01:38:36PM -0400, Chris Metcalf wrote: > >>+#ifdef CONFIG_TASK_ISOLATION > >>+void task_isolation_debug(int cpu) > >>+{ > >>+ struct task_struct *p; > >>+ > >>+

Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-18 Thread Chris Metcalf
(Oops, missed one that I should have forced to text/plain. Resending.) On 5/18/2016 9:56 AM, Peter Zijlstra wrote: On Tue, Apr 05, 2016 at 01:38:36PM -0400, Chris Metcalf wrote: +#ifdef CONFIG_TASK_ISOLATION +void task_isolation_debug(int cpu) +{ + struct task_struct *p; + + if (!ta

Re: [PATCH v12 07/13] task_isolation: add debug boot flag

2016-05-18 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 01:38:36PM -0400, Chris Metcalf wrote: > +#ifdef CONFIG_TASK_ISOLATION > +void task_isolation_debug(int cpu) > +{ > + struct task_struct *p; > + > + if (!task_isolation_possible(cpu)) > + return; > + > + rcu_read_lock(); > + p = cpu_curr(cpu); > +

[PATCH v12 07/13] task_isolation: add debug boot flag

2016-04-05 Thread Chris Metcalf
The new "task_isolation_debug" flag simplifies debugging of TASK_ISOLATION kernels when processes are running in PR_TASK_ISOLATION_ENABLE mode. Such processes should get no interrupts from the kernel, and if they do, we notify either the process (if STRICT mode is set and the interrupt is not an N