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:	Tue, 06 May 2008 09:22:34 +1000
From:	John Williams <john.williams@...alogix.com>
To:	monstr@...nam.cz
Cc:	linux-kernel@...r.kernel.org, arnd@...db.de,
	linux-arch@...r.kernel.org, stephen.neuendorffer@...inx.com,
	John.Linn@...inx.com, matthew@....cx, will.newton@...il.com,
	drepper@...hat.com, microblaze-uclinux@...e.uq.edu.au,
	grant.likely@...retlab.ca, Michal Simek <monstr@...str.eu>
Subject: Re: [PATCH 18/56] microblaze_v2: early_printk support


On Sun, 2008-05-04 at 13:41 +0200, monstr@...nam.cz wrote:

> +++ b/arch/microblaze/kernel/early_printk.c

> +static void early_printk_putc(char c)
> +{
> +	while (ioread32(STATUS) & (1<<3));
> +	iowrite32((c & 0xff), TX_FIFO);
> +}

The while() loop needs a retry counter - if you configure
EARLY_PRINTK_BASE_ADDRESS wrongly and it points to memory or anything
that is not a uartlite, the loop spins forever and you get silent
lockup.  Not nice behaviour from debug code :)

Here's my current implementation:

static void early_printk_putc(char c)
{
        /* Limit how many times we'll spin waiting for TX FIFO status.
           This will prevent lockups if the base address is incorrectly
set, or
           any other issue on the UARTLITE.

           This limit is pretty arbitrary, unless we are at about 10
baud 
           we'll never timeout on a working UART. */

        unsigned retries=10000;
        while (retries-- && (ioread32(STATUS) & (1<<3)))
                ;

        /* Only attempt the iowrite if we didn't timeout */
        if(retries)
                iowrite32((c & 0xff), TX_FIFO);
}

Cheers

John


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ