Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-07 Thread Jiri Kosina
On Fri, 4 Oct 2019, Will Deacon wrote: > Indeed, and I think the LED blinking is already unreliable if the > brightness operation needs to sleep. One thing is that led_set_brightness() can probably be forced to avoid the workqueue scheduling, by setting LED_BLINK_SW on the device (e.g. by

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-04 Thread Feng Tang
On Fri, Oct 04, 2019 at 01:15:21PM +0200, Petr Mladek wrote: > On Fri 2019-10-04 11:49:48, Will Deacon wrote: > > On Fri, Oct 04, 2019 at 10:29:17AM +0100, Russell King - ARM Linux admin > > wrote: > > > On Fri, Oct 04, 2019 at 11:11:42AM +0200, Petr Mladek wrote: > > > > On Thu 2019-10-03

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-04 Thread Petr Mladek
On Fri 2019-10-04 11:49:48, Will Deacon wrote: > On Fri, Oct 04, 2019 at 10:29:17AM +0100, Russell King - ARM Linux admin > wrote: > > On Fri, Oct 04, 2019 at 11:11:42AM +0200, Petr Mladek wrote: > > > On Thu 2019-10-03 21:56:34, Will Deacon wrote: > > > > I've deliberately left the irq part

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-04 Thread Will Deacon
On Fri, Oct 04, 2019 at 10:29:17AM +0100, Russell King - ARM Linux admin wrote: > On Fri, Oct 04, 2019 at 11:11:42AM +0200, Petr Mladek wrote: > > On Thu 2019-10-03 21:56:34, Will Deacon wrote: > > > I've deliberately left the irq part alone, since I think > > > having magic sysrq work via the

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-04 Thread Russell King - ARM Linux admin
On Fri, Oct 04, 2019 at 11:11:42AM +0200, Petr Mladek wrote: > On Thu 2019-10-03 21:56:34, Will Deacon wrote: > > Hi Kees, > > > > On Wed, Oct 02, 2019 at 01:58:46PM -0700, Kees Cook wrote: > > > On Wed, Oct 02, 2019 at 01:35:38PM +0100, Will Deacon wrote: > > > > Calling 'panic()' on a kernel

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-04 Thread Petr Mladek
On Thu 2019-10-03 21:56:34, Will Deacon wrote: > Hi Kees, > > On Wed, Oct 02, 2019 at 01:58:46PM -0700, Kees Cook wrote: > > On Wed, Oct 02, 2019 at 01:35:38PM +0100, Will Deacon wrote: > > > Calling 'panic()' on a kernel with CONFIG_PREEMPT=y can leave the > > > calling CPU in an infinite loop,

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-03 Thread Will Deacon
Hi Kees, On Wed, Oct 02, 2019 at 01:58:46PM -0700, Kees Cook wrote: > On Wed, Oct 02, 2019 at 01:35:38PM +0100, Will Deacon wrote: > > Calling 'panic()' on a kernel with CONFIG_PREEMPT=y can leave the > > calling CPU in an infinite loop, but with interrupts and preemption > > enabled. From this

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-03 Thread Will Deacon
Hi Andrew, Thanks for having a look. On Wed, Oct 02, 2019 at 02:45:58PM -0700, Andrew Morton wrote: > On Wed, 2 Oct 2019 13:35:38 +0100 Will Deacon wrote: > > Disable preemption in 'panic()' before re-enabling interrupts. > > > > ... > > > > --- a/kernel/panic.c > > +++ b/kernel/panic.c > >

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-02 Thread Andrew Morton
On Wed, 2 Oct 2019 13:35:38 +0100 Will Deacon wrote: > Calling 'panic()' on a kernel with CONFIG_PREEMPT=y can leave the > calling CPU in an infinite loop, but with interrupts and preemption > enabled. From this state, userspace can continue to be scheduled, > despite the system being "dead" as

Re: [PATCH] panic: Ensure preemption is disabled during panic()

2019-10-02 Thread Kees Cook
On Wed, Oct 02, 2019 at 01:35:38PM +0100, Will Deacon wrote: > Calling 'panic()' on a kernel with CONFIG_PREEMPT=y can leave the > calling CPU in an infinite loop, but with interrupts and preemption > enabled. From this state, userspace can continue to be scheduled, > despite the system being

[PATCH] panic: Ensure preemption is disabled during panic()

2019-10-02 Thread Will Deacon
Calling 'panic()' on a kernel with CONFIG_PREEMPT=y can leave the calling CPU in an infinite loop, but with interrupts and preemption enabled. From this state, userspace can continue to be scheduled, despite the system being "dead" as far as the kernel is concerned. This is easily reproducible on