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]
Date:   Thu, 14 Oct 2021 11:12:37 +0200
From:   Francesco Dolcini <francesco.dolcini@...adex.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Francesco Dolcini <francesco.dolcini@...adex.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Stefan Agner <stefan@...er.ch>, linux-serial@...r.kernel.org,
        Jiri Slaby <jirislaby@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        linux-kernel@...r.kernel.org, Shawn Guo <shawnguo@...nel.org>,
        NXP Linux Team <linux-imx@....com>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/2] serial: imx: fix crash when un/re-binding console

Hello Uwe,

On Thu, Oct 14, 2021 at 10:10:28AM +0200, Uwe Kleine-König wrote:
> On Thu, Oct 14, 2021 at 10:01:53AM +0200, Francesco Dolcini wrote:
> > Hello Greg,
> > 
> > On Thu, Oct 14, 2021 at 09:33:55AM +0200, Greg Kroah-Hartman wrote:
> > > On Thu, Oct 14, 2021 at 09:10:52AM +0200, Francesco Dolcini wrote:
> > > > From: Stefan Agner <stefan@...er.ch>
> > > > 
> > > > If the device used as a serial console gets un/re-binded, then
> > > > register_console() will call imx_uart_setup_console() again.
> > > > Drop __init so that imx_uart_setup_console() can be safely called
> > > > at runtime.
> > > > 
> > > > Signed-off-by: Stefan Agner <stefan@...er.ch>
> > > > Signed-off-by: Francesco Dolcini <francesco.dolcini@...adex.com>
> > > > ---
> > > >  drivers/tty/serial/imx.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > What commit does this "fix"?
> > 
> > root@...ibri-imx6ull-06746657:~# cat /sys/devices/virtual/tty/console/active 
> > tty1 ttymxc0
> > root@...ibri-imx6ull-06746657:~# echo -n N > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> > root@...ibri-imx6ull-06746657:~# echo -n Y > /sys/devices/virtual/tty/console/subsystem/ttymxc0/console
> > 
> > struct console ->setup is called at that time, but imx_uart_console_setup() is gone ...
> > 
> > According to the original report from Stefan the issue is the same with unbind/bind of the console,
> > see https://marc.info/?l=linux-serial&m=154221779312036&w=2.
> > 
> > 
> > > Should this go to stable kernels?  If so, how far back?
> > This is present also in 4.19 kernel, I feel like the issue is there since it is possible to unbind
> > a console driver (since ever considering the current LTS releases?). I could
> > investigate this a little bit more.
> > 
> > We have this patch in our kernel branch since 3 years but for some reason we never managed to upstream it.
> 
> I think this is a bigger problem not only affecting imx.c. Just look at
> the output of:
> 
> 	git grep -E '__init.*setup' drivers/tty/serial/

I agree, but I think that all the earlyconsole stuff is not affected, so the amount of drivers
that should be fixed is less than it looks like.

Apart for that once you fix this issue you need to be sure that on the unbind/unregister path you undo
all you did in the setup, maybe for most of the drivers is nothing, but for serial/imx I had to
disable the clock there (see patch 2/2 in this patchset).

Francesco

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ