Re: [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()
From: Al Viro
Date: Thu Jan 26 2023 - 16:04:15 EST
On Thu, Jan 26, 2023 at 08:48:03PM +0000, Matthew Wilcox wrote:
> On Thu, Jan 26, 2023 at 12:38:58PM -0800, Andrew Morton wrote:
> > On Thu, 26 Jan 2023 15:33:46 +0100 "Fabio M. De Francesco" <fmdefrancesco@xxxxxxxxx> wrote:
> >
> > > If ARCH_HAS_FLUSH_ON_KUNMAP is defined (PA-RISC case), __kunmap_local()
> > > calls kunmap_flush_on_unmap(). The latter currently flushes the wrong
> > > address (as confirmed by Matthew Wilcox and Helge Deller). Al Viro
> > > proposed to call kunmap_flush_on_unmap() on an aligned-down to page
> > > address in order to fix this issue. Consensus has been reached on this
> > > solution.
> >
> > What are the user-visible runtime effects of this flaw?
>
> The version of this patch I sent out includes this information,
> as well as the missed alignment for kunmap_atomic().
One point: AFAICS, the situation right now is
* all callers of kunmap_local() pass page-aligned pointers
* all callers of kunmap_atomic() seem to do the same
* there's nothing in documentation that would say one can
pass anything other than the return value of original kmap_local_page()
or kmap_atomic() call to those.
* there's nothing that would outright ban doing that.
So these patches really ought to touch Documentation/mm/highmem.rst
saying that from now on kunmap_local() and kunmap_atomic() callers
are allowed to pass any pointer within the mapped area. And yes,
we want it in -stable before anything that relies upon that sucker
gets backported.