[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55D792C8.6090006@zytor.com>
Date: Fri, 21 Aug 2015 14:06:16 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Borislav Petkov <bp@...e.de>
CC: yalin wang <yalin.wang2010@...il.com>,
Thomas Gleixner <tglx@...utronix.de>, mingo@...hat.com,
x86@...nel.org, open list <linux-kernel@...r.kernel.org>,
Will Deacon <will.deacon@....com>
Subject: Re: [x86] copy_from{to}_user question
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists