Re: [PATCH] ARM: mm: fix no-MMU ZERO_PAGE() implementation

From: Arnd Bergmann
Date: Wed Oct 19 2022 - 07:29:52 EST


On Wed, Oct 19, 2022, at 11:09, Russell King (Oracle) wrote:

> When the only users in the kernel _were_ ZERO_PAGE() for this, which
> is defined to return a struct page pointer, there was no need to make
> "empty_zero_page" anything but a struct page pointer, rather than a
> runtime translation from an address to a struct page.

Fair enough.

> IMHO, we should _not_ be exposing empty_zero_page to devices - we
> certainly do not want the DMA API performing cache maintenance on
> this page since the primary purpose of this page is to fill in
> userspace BSS pages that have not been written.

It should be easy enough to not expose it by renaming the
symbol to something other than empty_zero_page. That way,
any incorrect users that may come up in the future would
at least result in a build failure instead of runtime
data corruption.

> So, the only one that needs fixing is the SPI usage, which IMHO
> is wrong. ARM being different finds what I consider a driver bug.
> Good for 32-bit ARM. :)

The SPI driver is powerpc specific, so it's also not going to
get hit.

Arnd