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] [day] [month] [year] [list]
Message-ID: <20210108141040.GA1081858@ubuntu2004>
Date:   Fri, 8 Jan 2021 16:10:40 +0200
From:   Cristian Ciocaltea <cristian.ciocaltea@...il.com>
To:     Jiri Slaby <jirislaby@...nel.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andreas Färber <afaerber@...e.de>,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
        linux-serial@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-actions@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] tty: serial: owl: Add support for kernel debugger

On Fri, Jan 08, 2021 at 08:58:38AM +0100, Jiri Slaby wrote:
> On 07. 01. 21, 19:16, Cristian Ciocaltea wrote:
> > Hi Greg,
> > 
> > Thank you for the review!
> > 
> > On Thu, Jan 07, 2021 at 04:20:55PM +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Jan 05, 2021 at 07:02:02PM +0200, Cristian Ciocaltea wrote:
> > > > Implement 'poll_put_char' and 'poll_get_char' callbacks in struct
> > > > 'owl_uart_ops' that enables OWL UART to be used for kernel debugging
> > > > over serial line.
> > > > 
> > > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...il.com>
> > 
> > [...]
> > 
> > > > +
> > > > +static void owl_uart_poll_put_char(struct uart_port *port, unsigned char ch)
> > > > +{
> > > > +	while (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_TFFU)
> > > > +		cpu_relax();
> > > 
> > > Unbounded loops?  What could possibly go wrong?
> > > 
> > > :(
> > > 
> > > Please don't do that in the kernel, put a max bound on this.
> > 
> > I didn't realize the issue since I had encountered this pattern in many
> > other serial drivers, as well: altera_uart, arc_uart, atmel_serial, etc.
> > 
> > > And are you _SURE_ that cpu_relax() is what you want to call here?
> > 
> > I'm thinking of replacing the loop with 'readl_poll_timeout_atomic()',
> > if that would be a better approach.
> 
> It might be better, yes. Either way, if you add a bound to the loop, you
> definitely need a more precise timing, so ndelay/udelay instead of
> cpu_relax.

I will use 1-5 us for the timing, but I'm not quite sure about the
overall timeout - 10 ms would suffice?

Thanks,
Cristi

> thanks,
> -- 
> js

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ