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: <X/cm1+wVQpoXj5Xr@kroah.com>
Date:   Thu, 7 Jan 2021 16:20:55 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Cristian Ciocaltea <cristian.ciocaltea@...il.com>
Cc:     Jiri Slaby <jirislaby@...nel.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 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>
> ---
> Changes in v2:
>  - Reverted unnecessary changes per Andreas feedback
>  - Optimized implementation for 'owl_uart_poll_get_char()'
>    and 'owl_uart_poll_put_char()' callbacks
> 
>  drivers/tty/serial/owl-uart.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
> index c149f8c30007..54b24669ebc5 100644
> --- a/drivers/tty/serial/owl-uart.c
> +++ b/drivers/tty/serial/owl-uart.c
> @@ -12,6 +12,7 @@
>  #include <linux/console.h>
>  #include <linux/delay.h>
>  #include <linux/io.h>
> +#include <linux/iopoll.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> @@ -461,6 +462,26 @@ static void owl_uart_config_port(struct uart_port *port, int flags)
>  	}
>  }
>  
> +#ifdef CONFIG_CONSOLE_POLL
> +
> +static int owl_uart_poll_get_char(struct uart_port *port)
> +{
> +	if (owl_uart_read(port, OWL_UART_STAT) & OWL_UART_STAT_RFEM)
> +		return NO_POLL_CHAR;
> +
> +	return owl_uart_read(port, OWL_UART_RXDAT);
> +}
> +
> +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.

And are you _SURE_ that cpu_relax() is what you want to call here?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ