Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697077 > unrolled thread

Re: [PATCH 1/2] printk/console: Always disable boot consoles that use init memory before it is freed

Started bySergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
First post2017-07-26 15:10 +0200
Last post2017-07-26 15:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] printk/console: Always disable boot consoles that  use init memory before it is freed Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-07-26 15:10 +0200

#1697077 — Re: [PATCH 1/2] printk/console: Always disable boot consoles that use init memory before it is freed

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-07-26 15:10 +0200
SubjectRe: [PATCH 1/2] printk/console: Always disable boot consoles that use init memory before it is freed
Message-ID<u7ueC-Iw-17@gated-at.bofh.it>
On (07/14/17 14:51), Petr Mladek wrote:
> From: Matt Redfearn <matt.redfearn@imgtec.com>
> 
> Commit 4c30c6f566c0 ("kernel/printk: do not turn off bootconsole in
> printk_late_init() if keep_bootcon") added a check on keep_bootcon to
> ensure that boot consoles were kept around until the real console is
> registered.
> 
> This can lead to problems if the boot console data and code are in the
> init section, since it can be freed before the boot console is
> unregistered.
> 
> Commit 81cc26f2bd11 ("printk: only unregister boot consoles when
> necessary") fixed this a better way. It allowed to keep boot consoles
> that did not use init data. Unfortunately it did not remove the check
> of keep_bootcon.
> 
> This can lead to crashes and weird panics when the bootconsole is
> accessed after free, especially if page poisoning is in use and the
> code / data have been overwritten with a poison value.
> 
> To prevent this, always free the boot console if it is within the init
> section. In addition, print a warning about that the console is removed
> prematurely.
> 
> Finally there is a new comment how to avoid the warning. It replaced
> an explanation that duplicated a more comprehensive function
> description few lines above.
> 
> Fixes: 4c30c6f566c0 ("kernel/printk: do not turn off bootconsole in printk_late_init() if keep_bootcon")
> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
> [pmladek@suse.com: print the warning, code and comments clean up]
> Signed-off-by: Petr Mladek <pmladek@suse.com>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web