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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 20 Nov 2015 19:59:54 +0100
From:	Michal Suchanek <hramrach@...il.com>
To:	Brian Norris <computersforpeace@...il.com>
Cc:	Hou Zhiqiang <B48286@...escale.com>,
	Huang Shijie <shijie.huang@...el.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Han Xu <han.xu@...escale.com>,
	Rafał Miłecki <zajec5@...il.com>,
	Huang Shijie <b32955@...escale.com>,
	Ben Hutchings <ben@...adent.org.uk>,
	Marek Vasut <marex@...x.de>, Gabor Juhos <juhosg@...nwrt.org>,
	Bean Huo 霍斌斌, <beanhuo@...ron.com>,
	MTD Maling List <linux-mtd@...ts.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 6/7] mtd: spi-nor: simplify write loop

On 20 November 2015 at 00:18, Brian Norris <computersforpeace@...il.com> wrote:
> Hi Michal,
>
> Sorry this has sat so long...
>
> On Fri, Aug 14, 2015 at 09:23:08AM -0000, Michal Suchanek wrote:
>> The spi-nor write loop assumes that what is passed to the hardware
>> driver write() is what gets written.
>>
>> When write() writes less than page size at once data is dropped on the
>> floor. Check the amount of data writen.
>
> Have you seen write() return less than the page size? I know you've
> struggled with a SPI driver that can't do "very" (for some definition of
> very) long transfers, due to unknown bugs, but I thought that "very" was
> much larger than the page size.

Not in the case of a driver that can transfer 63 bytes at a time. It
because the DMA engine needed for normal operation was not merged yet,
though.

>
>> This also means that write can start mid-page any time so there is
>> no special case for first page.
>
> I think we'd have some problems if we start seeing hardware that can't
> write ~256 bytes at a time. If nothing else, this can be a problem
> because some SPI NOR flash are known to have inferior reliability if you
> regularly write in small chunks. I believe this is because they actually
> use some kind of internal ECC.
>
> So, if you're just guarding against a theoretical behavior, perhaps it's
> best if this is done with some kind of assertion, as I'd rather not
> encourage non-aligned writes if possible. I notice you used BUG_ON() in
> another patch, but I'd suggest maybe something less harsh, like WARN()
> or WARN_ONCE().

I agree that a warning is in order in the case when whole page cannot
be written in one go.

Thanks

Michal
--
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