From: Ira Weiny <ira.weiny@intel.com>
To: Al Viro <viro@zeniv.linux.org.uk>, Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
Ira Weiny <ira.weiny@intel.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Tony Luck <tony.luck@intel.com>,
Bagas Sanjaya <bagasdotme@gmail.com>,
David Sterba <dsterba@suse.com>,
Kees Cook <keescook@chromium.org>, <linux-kernel@vger.kernel.org>,
<linux-mm@kvack.org>, Thomas Gleixner <tglx@linutronix.de>,
Helge Deller <deller@gmx.de>
Subject: Re: [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap()
Date: Fri, 27 Jan 2023 15:13:07 -0800 [thread overview]
Message-ID: <63d45a837b15b_7f63c294a2@iweiny-mobl.notmuch> (raw)
In-Reply-To: <Y9L7/b/33mXvRsyX@ZenIV>
Al Viro wrote:
> On Thu, Jan 26, 2023 at 09:56:07PM +0000, Matthew Wilcox wrote:
> > On Thu, Jan 26, 2023 at 09:04:02PM +0000, Al Viro wrote:
> > > 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@gmail.com> 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
> >
> > Ah, no. kmap_local_folio() accepts a byte offset within the folio
> > and returns a pointer to that byte. I hadn't noticed the parisc
> > case and thought it was already allowed to pass a misaligned pointer
> > to kunmap_local() since it is allowed for the highmem case. It
> > simplified the callers, so it looked like a good tradeoff.
> >
> > See, eg 338f379cf7c2:
> >
> > - src_addr = kmap_atomic(src_page);
> > - dest_addr = kmap_atomic(dest_page);
> > + src_addr = kmap_local_folio(src_folio,
> > + offset_in_folio(src_folio, srcoff));
> > + dst_addr = kmap_local_folio(dst_folio,
> > + offset_in_folio(dst_folio, dstoff));
> >
> > - if (memcmp(src_addr + src_poff, dest_addr + dest_poff, cmp_len))
> > + if (memcmp(src_addr, dst_addr, cmp_len))
> >
> > - kunmap_atomic(dest_addr);
> > - kunmap_atomic(src_addr);
> > + kunmap_local(dst_addr);
> > + kunmap_local(src_addr);
>
> Argh... Missed that.
>
> OK, then Fixes: on the patch makes a lot of sense. And it still
> needs a chunk in D/m/highmem.rst...
>
I believe this is taken care of because the kdocs for
kunmap_{local,atomic}() are included there. And those kdocs indicate the
ability to use any address in the page.
Thanks for setting me straight on the parisc/highmem thing I missed that.
Ira
next prev parent reply other threads:[~2023-01-27 23:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 14:33 [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap() Fabio M. De Francesco
2023-01-26 19:50 ` Ira Weiny
2023-01-26 20:37 ` Helge Deller
2023-01-26 20:49 ` Matthew Wilcox
2023-01-27 23:07 ` Ira Weiny
2023-01-26 20:53 ` Al Viro
2023-01-27 22:48 ` Ira Weiny
2023-01-26 20:07 ` Matthew Wilcox
2023-01-27 17:58 ` Fabio M. De Francesco
2023-01-27 18:03 ` Matthew Wilcox
2023-01-26 20:38 ` Andrew Morton
2023-01-26 20:48 ` Matthew Wilcox
2023-01-26 21:04 ` Al Viro
2023-01-26 21:56 ` Matthew Wilcox
2023-01-26 22:17 ` Al Viro
2023-01-27 23:13 ` Ira Weiny [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-01-26 14:11 Fabio M. De Francesco
2023-01-26 14:26 ` Fabio M. De Francesco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63d45a837b15b_7f63c294a2@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=deller@gmx.de \
--cc=dsterba@suse.com \
--cc=fmdefrancesco@gmail.com \
--cc=glider@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).