linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 0/2] Access console drivers list under console_sem
@ 2019-04-23  6:25 Sergey Senozhatsky
  2019-04-23  6:25 ` [RFC][PATCH 1/2] printk: lock console_sem before we unregister boot consoles Sergey Senozhatsky
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Sergey Senozhatsky @ 2019-04-23  6:25 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt
  Cc: Andrew Morton, linux-kernel, Sergey Senozhatsky, Sergey Senozhatsky

Petr, Steven,

	RFC

	Normally, we grab console_sem lock before we iterate consoles
list, which is necessary if we want to be race free. The only exception
to this rule is console_flush_on_panic(). However, it seems that we are
not fully race free - register_console() iterates console drivers list
in unsafe manner in several places. E.g. the following scenarion:

	CPU0					CPU1
	register_console()			unregister_console()
						 console_lock()
	  for_each_console()			  // modify console_drivers
	    con->foo				    kfree(con)

So I have two quick-n-dirty patches, which remove unsafe console list
access.

What do you think?

Sergey Senozhatsky (2):
  printk: lock console_sem before we unregister boot consoles
  printk: take console_sem when accessing console drivers list

 kernel/printk/printk.c | 117 ++++++++++++++++++++++++-----------------
 1 file changed, 69 insertions(+), 48 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-04-25 16:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23  6:25 [RFC][PATCH 0/2] Access console drivers list under console_sem Sergey Senozhatsky
2019-04-23  6:25 ` [RFC][PATCH 1/2] printk: lock console_sem before we unregister boot consoles Sergey Senozhatsky
2019-04-24 14:49   ` Petr Mladek
2019-04-25  3:52     ` Sergey Senozhatsky
2019-04-25  6:43       ` Sergey Senozhatsky
2019-04-25  9:20         ` Petr Mladek
2019-04-25 16:05           ` Steven Rostedt
2019-04-25  7:50       ` Petr Mladek
2019-04-25  7:56         ` Sergey Senozhatsky
2019-04-25  9:37           ` Sergey Senozhatsky
2019-04-23  6:25 ` [RFC][PATCH 2/2] printk: take console_sem when accessing console drivers list Sergey Senozhatsky
2019-04-24 15:13   ` Petr Mladek
2019-04-25  5:19     ` Sergey Senozhatsky
2019-04-25  6:47       ` Sergey Senozhatsky
2019-04-25  8:53       ` Petr Mladek
2019-04-23 13:48 ` [RFC][PATCH 0/2] Access console drivers list under console_sem Steven Rostedt
2019-04-24  5:43   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).