Re: [PATCH] random: Fix early crash in credit_entropy_bits
On Wed, Oct 05, 2016 at 04:27:35PM -0400, Theodore Ts'o wrote: > This was discussed and Linus wanted to fix it a different way. Please > see this thread: > > http://www.gossamer-threads.com/lists/linux/kernel/2525929 > > Cheers, ook, thanks for info jirka
Re: [PATCH] random: Fix early crash in credit_entropy_bits
On Wed, Oct 05, 2016 at 04:27:35PM -0400, Theodore Ts'o wrote: > This was discussed and Linus wanted to fix it a different way. Please > see this thread: > > http://www.gossamer-threads.com/lists/linux/kernel/2525929 > > Cheers, ook, thanks for info jirka
Re: [PATCH] random: Fix early crash in credit_entropy_bits
This was discussed and Linus wanted to fix it a different way. Please see this thread: http://www.gossamer-threads.com/lists/linux/kernel/2525929 Cheers, - Ted
Re: [PATCH] random: Fix early crash in credit_entropy_bits
This was discussed and Linus wanted to fix it a different way. Please see this thread: http://www.gossamer-threads.com/lists/linux/kernel/2525929 Cheers, - Ted
Re: [PATCH] random: Fix early crash in credit_entropy_bits
ping thanks, jirka On Wed, Sep 21, 2016 at 05:07:11PM +0200, Jiri Olsa wrote: > From: Jiri Olsa> > When printing out some early acpi messages I hit bug in > work queue code. The system_wq is not initialized at the > time acpi_early_init is called and causes irq storm that > makes credit_entropy_bits call schedule_work and crash: > > BUG: unable to handle kernel NULL pointer dereference at 0102^M > IP: [] __queue_work+0x32/0x450^M > PGD 0 ^M > Oops: [#1] SMP^M > ... > Call Trace:^M > [ 286.521689] [] ? > _raw_write_unlock_irqrestore+0x16/0x20^M >[] ? add_interrupt_randomness+0x1c2/0x200^M >[] queue_work_on+0x27/0x40^M >[] credit_entropy_bits+0x219/0x280^M >[] ? __mix_pool_bytes+0x36/0x90^M >[] add_interrupt_randomness+0x1c2/0x200^M >[] handle_irq_event_percpu+0x40/0x80^M >[] handle_irq_event+0x2c/0x50^M >[] handle_level_irq+0x83/0x100^M >[] handle_irq+0x73/0x120^M >[] ? _local_bh_enable+0x21/0x50^M >[] do_IRQ+0x4b/0xd0^M >[] common_interrupt+0x8c/0x8c^M > [ 286.521717] [] ? native_restore_fl+0x6/0x10^M >[] console_unlock+0x3ef/0x5d0^M >[] ? update_sample+0x6e/0xe0^M >[] vprintk_emit+0x2aa/0x520^M >[] vprintk_default+0x1f/0x30^M >[] printk+0x57/0x73^M >[] acpi_os_vprintf+0x3f/0x41^M >[] acpi_os_printf+0x52/0x6e^M >... >[] acpi_load_tables+0x6c/0xf4^M >[] acpi_early_init+0x7a/0xf0^M >[] start_kernel+0x3be/0x472^M > > Preventing this by checking the system_wq has been initialized already. > > Signed-off-by: Jiri Olsa > --- > drivers/char/random.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/random.c b/drivers/char/random.c > index 3efb3bf0ab83..f4dec86c2e25 100644 > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -725,7 +725,8 @@ retry: > /* If the input pool is getting full, send some >* entropy to the blocking pool until it is 75% full. >*/ > - if (entropy_bits > random_write_wakeup_bits && > + if (keventd_up() && > + entropy_bits > random_write_wakeup_bits && > r->initialized && > r->entropy_total >= 2*random_read_wakeup_bits) { > struct entropy_store *other = _pool; > -- > 2.7.4 >
Re: [PATCH] random: Fix early crash in credit_entropy_bits
ping thanks, jirka On Wed, Sep 21, 2016 at 05:07:11PM +0200, Jiri Olsa wrote: > From: Jiri Olsa > > When printing out some early acpi messages I hit bug in > work queue code. The system_wq is not initialized at the > time acpi_early_init is called and causes irq storm that > makes credit_entropy_bits call schedule_work and crash: > > BUG: unable to handle kernel NULL pointer dereference at 0102^M > IP: [] __queue_work+0x32/0x450^M > PGD 0 ^M > Oops: [#1] SMP^M > ... > Call Trace:^M > [ 286.521689] [] ? > _raw_write_unlock_irqrestore+0x16/0x20^M >[] ? add_interrupt_randomness+0x1c2/0x200^M >[] queue_work_on+0x27/0x40^M >[] credit_entropy_bits+0x219/0x280^M >[] ? __mix_pool_bytes+0x36/0x90^M >[] add_interrupt_randomness+0x1c2/0x200^M >[] handle_irq_event_percpu+0x40/0x80^M >[] handle_irq_event+0x2c/0x50^M >[] handle_level_irq+0x83/0x100^M >[] handle_irq+0x73/0x120^M >[] ? _local_bh_enable+0x21/0x50^M >[] do_IRQ+0x4b/0xd0^M >[] common_interrupt+0x8c/0x8c^M > [ 286.521717] [] ? native_restore_fl+0x6/0x10^M >[] console_unlock+0x3ef/0x5d0^M >[] ? update_sample+0x6e/0xe0^M >[] vprintk_emit+0x2aa/0x520^M >[] vprintk_default+0x1f/0x30^M >[] printk+0x57/0x73^M >[] acpi_os_vprintf+0x3f/0x41^M >[] acpi_os_printf+0x52/0x6e^M >... >[] acpi_load_tables+0x6c/0xf4^M >[] acpi_early_init+0x7a/0xf0^M >[] start_kernel+0x3be/0x472^M > > Preventing this by checking the system_wq has been initialized already. > > Signed-off-by: Jiri Olsa > --- > drivers/char/random.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/char/random.c b/drivers/char/random.c > index 3efb3bf0ab83..f4dec86c2e25 100644 > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -725,7 +725,8 @@ retry: > /* If the input pool is getting full, send some >* entropy to the blocking pool until it is 75% full. >*/ > - if (entropy_bits > random_write_wakeup_bits && > + if (keventd_up() && > + entropy_bits > random_write_wakeup_bits && > r->initialized && > r->entropy_total >= 2*random_read_wakeup_bits) { > struct entropy_store *other = _pool; > -- > 2.7.4 >
[PATCH] random: Fix early crash in credit_entropy_bits
From: Jiri OlsaWhen printing out some early acpi messages I hit bug in work queue code. The system_wq is not initialized at the time acpi_early_init is called and causes irq storm that makes credit_entropy_bits call schedule_work and crash: BUG: unable to handle kernel NULL pointer dereference at 0102^M IP: [] __queue_work+0x32/0x450^M PGD 0 ^M Oops: [#1] SMP^M ... Call Trace:^M [ 286.521689] [] ? _raw_write_unlock_irqrestore+0x16/0x20^M [] ? add_interrupt_randomness+0x1c2/0x200^M [] queue_work_on+0x27/0x40^M [] credit_entropy_bits+0x219/0x280^M [] ? __mix_pool_bytes+0x36/0x90^M [] add_interrupt_randomness+0x1c2/0x200^M [] handle_irq_event_percpu+0x40/0x80^M [] handle_irq_event+0x2c/0x50^M [] handle_level_irq+0x83/0x100^M [] handle_irq+0x73/0x120^M [] ? _local_bh_enable+0x21/0x50^M [] do_IRQ+0x4b/0xd0^M [] common_interrupt+0x8c/0x8c^M [ 286.521717] [] ? native_restore_fl+0x6/0x10^M [] console_unlock+0x3ef/0x5d0^M [] ? update_sample+0x6e/0xe0^M [] vprintk_emit+0x2aa/0x520^M [] vprintk_default+0x1f/0x30^M [] printk+0x57/0x73^M [] acpi_os_vprintf+0x3f/0x41^M [] acpi_os_printf+0x52/0x6e^M ... [] acpi_load_tables+0x6c/0xf4^M [] acpi_early_init+0x7a/0xf0^M [] start_kernel+0x3be/0x472^M Preventing this by checking the system_wq has been initialized already. Signed-off-by: Jiri Olsa --- drivers/char/random.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 3efb3bf0ab83..f4dec86c2e25 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -725,7 +725,8 @@ retry: /* If the input pool is getting full, send some * entropy to the blocking pool until it is 75% full. */ - if (entropy_bits > random_write_wakeup_bits && + if (keventd_up() && + entropy_bits > random_write_wakeup_bits && r->initialized && r->entropy_total >= 2*random_read_wakeup_bits) { struct entropy_store *other = _pool; -- 2.7.4
[PATCH] random: Fix early crash in credit_entropy_bits
From: Jiri Olsa When printing out some early acpi messages I hit bug in work queue code. The system_wq is not initialized at the time acpi_early_init is called and causes irq storm that makes credit_entropy_bits call schedule_work and crash: BUG: unable to handle kernel NULL pointer dereference at 0102^M IP: [] __queue_work+0x32/0x450^M PGD 0 ^M Oops: [#1] SMP^M ... Call Trace:^M [ 286.521689] [] ? _raw_write_unlock_irqrestore+0x16/0x20^M [] ? add_interrupt_randomness+0x1c2/0x200^M [] queue_work_on+0x27/0x40^M [] credit_entropy_bits+0x219/0x280^M [] ? __mix_pool_bytes+0x36/0x90^M [] add_interrupt_randomness+0x1c2/0x200^M [] handle_irq_event_percpu+0x40/0x80^M [] handle_irq_event+0x2c/0x50^M [] handle_level_irq+0x83/0x100^M [] handle_irq+0x73/0x120^M [] ? _local_bh_enable+0x21/0x50^M [] do_IRQ+0x4b/0xd0^M [] common_interrupt+0x8c/0x8c^M [ 286.521717] [] ? native_restore_fl+0x6/0x10^M [] console_unlock+0x3ef/0x5d0^M [] ? update_sample+0x6e/0xe0^M [] vprintk_emit+0x2aa/0x520^M [] vprintk_default+0x1f/0x30^M [] printk+0x57/0x73^M [] acpi_os_vprintf+0x3f/0x41^M [] acpi_os_printf+0x52/0x6e^M ... [] acpi_load_tables+0x6c/0xf4^M [] acpi_early_init+0x7a/0xf0^M [] start_kernel+0x3be/0x472^M Preventing this by checking the system_wq has been initialized already. Signed-off-by: Jiri Olsa --- drivers/char/random.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 3efb3bf0ab83..f4dec86c2e25 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -725,7 +725,8 @@ retry: /* If the input pool is getting full, send some * entropy to the blocking pool until it is 75% full. */ - if (entropy_bits > random_write_wakeup_bits && + if (keventd_up() && + entropy_bits > random_write_wakeup_bits && r->initialized && r->entropy_total >= 2*random_read_wakeup_bits) { struct entropy_store *other = _pool; -- 2.7.4