lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200129151243.GA488@jagdpanzerIV.localdomain>
Date:   Thu, 30 Jan 2020 00:12:43 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/5] console: Introduce ->exit() callback

On (20/01/29 16:25), Andy Shevchenko wrote:
> I understand. Seems the ->setup() has to be idempotent. We can tell the same
> for ->exit() in some comment.
> 
> Can you describe, btw, struct console in kernel doc format?
> It will be very helpful!

We probably need some documentation.

> > > In both cases we will get the console to have CON_ENABLED flag set.
> > 
> > And there are sneaky consoles that have CON_ENABLED before we even
> > register them.
> 
> So, taking into consideration my comment to the previous patch, what would be
> suggested guard here?
> 
> For a starter something like this?
> 
>   if ((console->flags & CON_ENABLED) && console->exit)
> 	console->exit(console);

This will work if we also add something like this

---

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a30ff46c0081..01ced6f38776 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2739,6 +2739,8 @@ void register_console(struct console *newcon)
 		}
 	}
 
+	newcon->flags &= ~CON_ENABLED;
+
 	if (console_drivers && console_drivers->flags & CON_BOOT)
 		bcon = console_drivers;
 

---

I don't know why some consoles set CON_ENABLED statically.

E.g. drivers/tty/serial/mux.c

static struct console mux_console = {
        .name =         "ttyB",
        .write =        mux_console_write,
        .device =       uart_console_device,
        .setup =        mux_console_setup,
        .flags =        CON_ENABLED | CON_PRINTBUFFER,
        .index =        0,
        .data =         &mux_driver,
};

No idea...

Such consoles still will have CON_ENABLED even if registration failed
and we never ->setup() them.

	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ