Sergey Senozhatsky
caffd39d4f
printk: queue wake_up_klogd irq_work only if per-CPU areas are ready
...
commit ab6f762f0f upstream.
printk_deferred(), similarly to printk_safe/printk_nmi, does not
immediately attempt to print a new message on the consoles, avoiding
calls into non-reentrant kernel paths, e.g. scheduler or timekeeping,
which potentially can deadlock the system.
Those printk() flavors, instead, rely on per-CPU flush irq_work to print
messages from safer contexts. For same reasons (recursive scheduler or
timekeeping calls) printk() uses per-CPU irq_work in order to wake up
user space syslog/kmsg readers.
However, only printk_safe/printk_nmi do make sure that per-CPU areas
have been initialised and that it's safe to modify per-CPU irq_work.
This means that, for instance, should printk_deferred() be invoked "too
early", that is before per-CPU areas are initialised, printk_deferred()
will perform illegal per-CPU access.
Lech Perczak [0] reports that after commit 1b710b1b10 ("char/random:
silence a lockdep splat with printk()") user-space syslog/kmsg readers
are not able to read new kernel messages.
The reason is printk_deferred() being called too early (as was pointed
out by Petr and John).
Fix printk_deferred() and do not queue per-CPU irq_work before per-CPU
areas are initialized.
Link: https://lore.kernel.org/lkml/aa0732c6-5c4e-8a8b-a1c1-75ebe3dca05b@camlintechnologies.com/
Reported-by: Lech Perczak <l.perczak@camlintechnologies.com >
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com >
Tested-by: Jann Horn <jannh@google.com >
Reviewed-by: Petr Mladek <pmladek@suse.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Theodore Ts'o <tytso@mit.edu >
Cc: John Ogness <john.ogness@linutronix.de >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-22 09:32:13 +02:00
..
2019-12-13 08:51:18 +01:00
2019-01-22 21:40:33 +01:00
2020-01-14 20:07:03 +01:00
2020-04-02 15:28:16 +02:00
2018-09-30 08:49:55 -07:00
2019-12-05 09:20:15 +01:00
2020-04-29 16:31:24 +02:00
2020-01-27 14:50:42 +01:00
2019-12-17 20:35:45 +01:00
2020-06-03 08:19:11 +02:00
2020-04-02 15:28:09 +02:00
2020-06-25 15:33:08 +02:00
2020-06-03 08:19:49 +02:00
2018-10-12 15:25:17 +01:00
2020-01-27 14:51:19 +01:00
2020-02-01 09:37:10 +00:00
2020-06-30 23:17:12 -04:00
2020-01-23 08:21:39 +01:00
2020-06-22 09:05:14 +02:00
2018-08-23 13:44:43 -07:00
2018-09-28 18:04:06 -07:00
2020-06-22 09:05:29 +02:00
2020-06-25 15:33:05 +02:00
2020-01-27 14:51:00 +01:00
2020-01-09 10:19:01 +01:00
2018-08-30 14:18:03 +01:00
2019-12-13 08:52:59 +01:00
2019-03-05 17:58:50 +01:00
2019-05-31 06:46:00 -07:00
2019-12-01 09:17:07 +01:00
2020-06-25 15:33:02 +02:00
2019-04-17 08:38:51 +02:00
2018-08-31 14:48:56 -06:00
2019-10-05 13:10:03 +02:00
2020-04-29 16:31:17 +02:00
2020-04-29 16:31:17 +02:00
2019-01-31 08:14:41 +01:00
2019-07-03 13:14:48 +02:00
2019-05-25 18:23:48 +02:00
2020-04-23 10:30:12 +02:00
2019-10-05 13:09:54 +02:00
2019-08-16 10:12:38 +02:00
2020-07-22 09:32:00 +02:00
2020-07-22 09:32:00 +02:00
2019-04-05 22:33:03 +02:00
2019-08-06 19:06:52 +02:00
2019-08-06 19:06:52 +02:00
2018-11-13 11:08:25 -08:00
2019-06-09 09:17:23 +02:00
2019-02-27 10:08:53 +01:00
2019-06-09 09:17:23 +02:00
2019-02-27 10:08:53 +01:00
2020-05-20 08:18:49 +02:00
2019-11-12 19:21:38 +01:00
2019-11-20 18:47:11 +01:00
2019-12-31 16:36:22 +01:00
2019-07-26 09:14:12 +02:00
2019-11-24 08:20:07 +01:00
2019-07-31 07:27:11 +02:00
2019-05-25 18:23:26 +02:00
2020-04-17 10:48:45 +02:00
2019-09-16 08:22:12 +02:00
2020-03-20 11:55:58 +01:00
2019-12-13 08:51:54 +01:00
2020-02-24 08:34:44 +01:00
2019-06-04 08:02:34 +02:00
2019-11-20 18:47:40 +01:00
2020-03-18 07:14:21 +01:00
2019-05-16 19:41:17 +02:00
2020-06-25 15:33:02 +02:00
2020-02-11 04:34:08 -08:00
2018-08-25 13:40:38 -07:00
2019-04-05 22:32:59 +02:00
2019-11-24 08:19:14 +01:00
2020-07-16 08:17:27 +02:00
2020-05-20 08:18:45 +02:00
2018-12-17 09:24:38 +01:00
2019-11-20 18:45:55 +01:00
2018-12-01 09:37:31 +01:00
2018-12-05 19:32:10 +01:00
2020-03-25 08:06:14 +01:00
2019-12-05 09:21:03 +01:00
2020-06-25 15:33:07 +02:00
2019-02-12 19:47:14 +01:00
2019-11-10 11:27:40 +01:00
2019-09-10 10:33:44 +01:00
2019-03-23 20:10:08 +01:00
2018-11-13 11:08:54 -08:00
2019-02-12 19:47:24 +01:00
2018-12-05 19:32:13 +01:00
2020-03-05 16:42:18 +01:00
2019-01-13 09:51:04 +01:00
2019-07-31 07:26:59 +02:00
2020-01-04 19:13:32 +01:00
2019-12-17 20:35:45 +01:00
2019-05-22 07:37:40 +02:00
2019-10-17 13:45:42 -07:00
2019-11-20 18:47:31 +01:00
2019-05-08 07:21:43 +02:00
2018-11-21 09:19:20 +01:00
2019-12-05 09:19:39 +01:00
2020-05-10 10:30:12 +02:00
2019-03-05 17:58:51 +01:00
2020-01-12 12:17:25 +01:00
2019-08-09 17:52:34 +02:00
2020-07-22 09:32:00 +02:00
2020-03-18 07:14:11 +01:00
2019-12-01 09:17:05 +01:00
2019-11-20 18:45:19 +01:00
2020-02-28 16:38:59 +01:00
2020-05-10 10:30:11 +02:00
2020-04-17 10:48:41 +02:00
2019-08-04 09:30:54 +02:00
2018-08-22 10:52:52 -07:00
2019-12-31 16:35:23 +01:00
2020-02-11 04:34:18 -08:00
2019-04-05 22:33:09 +02:00
2020-02-28 16:38:50 +01:00
2019-12-13 08:52:43 +01:00
2019-06-04 08:02:34 +02:00
2019-06-04 08:02:34 +02:00
2020-07-16 08:17:26 +02:00
2019-04-20 09:15:59 +02:00
2019-07-21 09:03:11 +02:00
2019-12-13 08:52:43 +01:00
2020-04-23 10:30:24 +02:00
2020-06-22 09:05:15 +02:00
2020-06-25 15:33:10 +02:00
2020-06-22 09:05:04 +02:00
2020-04-29 16:31:19 +02:00
2020-06-25 15:33:06 +02:00
2020-01-04 19:13:15 +01:00
2019-06-09 09:17:19 +02:00
2020-02-24 08:34:46 +01:00
2019-09-06 10:22:19 +02:00
2020-01-23 08:21:29 +01:00
2018-12-29 13:37:59 +01:00
2020-02-11 04:34:18 -08:00
2019-04-17 08:38:51 +02:00
2020-01-29 16:43:27 +01:00
2020-01-29 16:43:27 +01:00
2019-01-13 09:51:04 +01:00
2019-12-31 16:35:38 +01:00
2018-09-13 15:18:04 -10:00
2019-11-12 19:20:36 +01:00
2020-06-22 09:05:01 +02:00
2020-06-22 09:05:21 +02:00
2020-06-10 21:35:01 +02:00
2019-06-09 09:17:23 +02:00
2019-05-31 06:46:05 -07:00
2019-01-09 17:38:42 +01:00
2018-12-05 19:31:59 +01:00
2019-02-23 09:07:25 +01:00
2020-06-30 23:17:07 -04:00
2019-06-04 08:02:34 +02:00
2019-06-04 08:02:34 +02:00
2018-09-23 21:55:24 -07:00
2018-08-23 16:03:58 -07:00
2019-09-06 10:22:22 +02:00
2019-09-06 10:22:23 +02:00
2018-11-21 09:19:20 +01:00
2020-01-29 16:43:26 +01:00
2020-04-13 10:45:06 +02:00
2020-04-17 10:48:45 +02:00
2018-11-13 11:08:24 -08:00
2020-01-27 14:50:37 +01:00
2018-08-23 18:48:44 -07:00
2019-05-31 06:46:30 -07:00
2020-05-27 17:37:35 +02:00
2020-03-25 08:06:13 +01:00
2020-06-22 09:05:25 +02:00
2020-04-17 10:48:46 +02:00
2019-05-25 18:23:38 +02:00
2020-04-23 10:30:20 +02:00
2020-02-11 04:34:11 -08:00
2020-01-27 14:50:27 +01:00
2018-12-01 09:37:34 +01:00
2020-03-18 07:14:17 +01:00
2019-05-04 09:20:11 +02:00
2020-01-27 14:50:26 +01:00
2020-05-20 08:18:45 +02:00
2020-01-17 19:46:55 +01:00
2020-01-04 19:13:35 +01:00
2020-07-22 09:32:13 +02:00
2019-03-23 20:10:04 +01:00
2019-06-11 12:20:52 +02:00
2019-01-09 17:38:33 +01:00
2018-12-05 19:32:03 +01:00
2019-06-15 11:54:10 +02:00
2019-12-13 08:52:28 +01:00
2020-01-04 19:12:53 +01:00
2019-12-17 20:35:17 +01:00
2020-02-24 08:34:46 +01:00
2019-07-26 09:14:07 +02:00
2019-04-05 22:32:56 +02:00
2019-12-05 09:19:38 +01:00
2019-04-05 22:32:56 +02:00
2020-01-27 14:50:37 +01:00
2020-04-17 10:48:47 +02:00
2020-01-23 08:21:29 +01:00
2020-04-02 15:28:22 +02:00
2019-12-05 09:20:25 +01:00
2019-12-13 08:51:07 +01:00
2018-10-02 14:38:02 -07:00
2020-06-22 09:05:03 +02:00
2020-01-27 14:51:05 +01:00
2019-06-04 08:02:30 +02:00
2020-01-04 19:13:30 +01:00
2019-04-03 06:26:28 +02:00
2019-05-31 06:46:16 -07:00
2019-03-13 14:02:35 -07:00
2020-06-22 09:05:20 +02:00
2018-10-12 12:35:02 +02:00
2020-04-17 10:48:43 +02:00
2019-12-05 09:20:57 +01:00
2020-04-23 10:30:19 +02:00
2020-01-27 14:50:22 +01:00
2018-12-29 13:37:55 +01:00
2018-11-13 11:08:51 -08:00
2019-06-17 19:51:56 +02:00
2019-05-31 06:46:29 -07:00
2019-12-21 10:57:17 +01:00
2019-11-20 18:45:24 +01:00
2018-09-03 13:26:44 +02:00
2020-01-23 08:21:32 +01:00
2019-12-05 09:19:49 +01:00
2018-10-17 15:35:29 -04:00
2018-12-08 12:59:07 +01:00
2020-05-20 08:18:45 +02:00
2020-06-22 09:04:58 +02:00
2018-09-12 14:58:47 -07:00
2019-05-08 07:21:44 +02:00
2018-08-23 18:48:44 -07:00
2018-09-13 17:58:30 +02:00
2020-06-30 23:17:00 -04:00
2019-04-17 08:38:52 +02:00
2018-09-13 15:18:04 -10:00
2018-09-13 15:18:04 -10:00
2020-04-29 16:31:27 +02:00
2019-07-14 08:11:21 +02:00
2020-04-02 15:28:23 +02:00
2018-11-13 11:08:42 -08:00