From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@suse.de>
Cc: yalin wang <yalin.wang2010@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
mingo@redhat.com, x86@kernel.org,
open list <linux-kernel@vger.kernel.org>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [x86] copy_from{to}_user question
Date: Fri, 21 Aug 2015 14:06:16 -0700 [thread overview]
Message-ID: <55D792C8.6090006@zytor.com> (raw)
In-Reply-To: <20150821043552.GA29712@nazgul.tnic>
On 08/20/2015 09:35 PM, Borislav Petkov wrote:
> On Thu, Aug 20, 2015 at 11:22:43AM -0700, H. Peter Anvin wrote:
>> There is a valid reason to do this, which is that currently
>> copy_{to,from}_user() effectively bypass SMAP as they don't verify that
>> the kernel pointer is actually a kernel pointer.
>
> Well, we do STAC before we copy but SMAP is checking for supervisor
> access to *user* data. But you say "kernel pointers" which is supervisor
> data. What am I missing?
>
What I'm saying is that we do do STAC, which *disables* SMAP. We have
to do that because one pointer is known to be a user space pointer.
However, we currently don't verify that the *other* pointer is kernel
space, which it is supposed to be (if not, we should be using
copy_in_user). We have to do this manually since we have to STAC which
means SMAP doesn't do anything at all. I believe it would be a good
idea to add such checks (and they would even benefit non-SMAP hardware.)
-hpa
next prev parent reply other threads:[~2015-08-21 21:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 9:01 [x86] copy_from{to}_user question yalin wang
2015-08-12 10:07 ` Borislav Petkov
2015-08-13 10:04 ` yalin wang
2015-08-13 16:43 ` Borislav Petkov
2015-08-17 3:27 ` yalin wang
2015-08-17 4:16 ` Borislav Petkov
2015-08-20 8:58 ` yalin wang
2015-08-20 18:22 ` H. Peter Anvin
2015-08-21 4:35 ` Borislav Petkov
2015-08-21 21:06 ` H. Peter Anvin [this message]
2015-08-22 9:05 ` Borislav Petkov
2015-08-24 7:52 ` yalin wang
2015-08-24 12:05 ` Jeff Epler
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=55D792C8.6090006@zytor.com \
--to=hpa@zytor.com \
--cc=bp@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
--cc=yalin.wang2010@gmail.com \
/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