From: Kees Cook <keescook@chromium.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Kernel Hardening <kernel-hardening@lists.openwall.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] mm: Prevent mapping typed pages to userspace
Date: Tue, 29 Jan 2019 21:09:30 +1300 [thread overview]
Message-ID: <CAGXu5jLbC1-T9JbYcDcXjA2G3jv3DLCWSUvJf3KiA8so2XC19g@mail.gmail.com> (raw)
In-Reply-To: <20190129053830.3749-1-willy@infradead.org>
On Tue, Jan 29, 2019 at 6:38 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> Pages which use page_type must never be mapped to userspace as it would
> destroy their page type. Add an explicit check for this instead of
> assuming that kernel drivers always get this right.
>
> Signed-off-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> mm/memory.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index ce8c90b752be..db3534bbd652 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1451,7 +1451,7 @@ static int insert_page(struct vm_area_struct *vma, unsigned long addr,
> spinlock_t *ptl;
>
> retval = -EINVAL;
> - if (PageAnon(page) || PageSlab(page))
> + if (PageAnon(page) || PageSlab(page) || page_has_type(page))
> goto out;
> retval = -ENOMEM;
> flush_dcache_page(page);
> --
> 2.20.1
>
--
Kees Cook
next prev parent reply other threads:[~2019-01-29 8:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 5:38 Matthew Wilcox
2019-01-29 8:09 ` Kees Cook [this message]
2019-01-30 12:01 ` David Hildenbrand
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=CAGXu5jLbC1-T9JbYcDcXjA2G3jv3DLCWSUvJf3KiA8so2XC19g@mail.gmail.com \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpe@ellerman.id.au \
--cc=will.deacon@arm.com \
--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