public inbox for [email protected]
 help / color / mirror / Atom feed
From: Linus Torvalds <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Martin Raiber <[email protected]>,
	Pavel Begunkov <[email protected]>,
	io-uring <[email protected]>
Subject: Re: Fixed buffers have out-dated content
Date: Sat, 16 Jan 2021 15:34:57 -0800	[thread overview]
Message-ID: <CAHk-=wiGEFZf-+YXcUVDj_mutwG6qWZzKUKZ-5yQ5UWgLGrBNQ@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wh3Agdy3h+rsx5HTOWt6dS-jN9THBqNhk=mWG4KnCK0tw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

On Sat, Jan 16, 2021 at 3:05 PM Linus Torvalds
<[email protected]> wrote:
>
> I'll go think about this.
>
> Martin, since you can apparently trigger the problem easily, hopefully
> you're willing to try a couple of patches?

Hmm. It might end up being as simple as the attached patch.

I'm not super-happy with this situation (that whole nasty security
issue had some horrible cascading problems), and this only really
fixes _pinned_ pages.

In particular, somebody doing a plain get_user_pages() for writing can
still hit issues (admittedly that's true in general, but the vm
changes made it much more obviously true).

But for the case of io_uring buffers, this looks like the obvious simple fix.

I don't have a load to test this with, so I'll come back to ask Martin
to do so...

                 Linus

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 526 bytes --]

 mm/vmscan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 257cba79a96d..b1b574ad199d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1238,6 +1238,8 @@ static unsigned int shrink_page_list(struct list_head *page_list,
 			if (!PageSwapCache(page)) {
 				if (!(sc->gfp_mask & __GFP_IO))
 					goto keep_locked;
+				if (page_maybe_dma_pinned(page))
+					goto keep_locked;
 				if (PageTransHuge(page)) {
 					/* cannot split THP, skip it */
 					if (!can_split_huge_page(page, NULL))

  reply	other threads:[~2021-01-16 23:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 23:39 Fixed buffer have out-dated content Martin Raiber
2021-01-09 16:23 ` Jens Axboe
2021-01-09 16:58   ` Martin Raiber
2021-01-09 20:32     ` Pavel Begunkov
2021-01-10 16:50       ` Martin Raiber
2021-01-14 21:50         ` Fixed buffers " Martin Raiber
2021-01-16 19:30           ` Pavel Begunkov
2021-01-16 19:39             ` Jens Axboe
2021-01-16 22:12           ` Jens Axboe
2021-01-16 23:05             ` Linus Torvalds
2021-01-16 23:34               ` Linus Torvalds [this message]
2021-01-17 20:07                 ` Martin Raiber
2021-01-17 20:14                   ` Linus Torvalds

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='CAHk-=wiGEFZf-+YXcUVDj_mutwG6qWZzKUKZ-5yQ5UWgLGrBNQ@mail.gmail.com' \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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