Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932482AbbHXHwU (ORCPT ); Mon, 24 Aug 2015 03:52:20 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36401 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932381AbbHXHwT convert rfc822-to-8bit (ORCPT ); Mon, 24 Aug 2015 03:52:19 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: [x86] copy_from{to}_user question From: yalin wang In-Reply-To: <20150822090519.GA2812@nazgul.tnic> Date: Mon, 24 Aug 2015 15:52:11 +0800 Cc: "H. Peter Anvin" , Thomas Gleixner , mingo@redhat.com, x86@kernel.org, open list , Will Deacon Content-Transfer-Encoding: 8BIT Message-Id: References: <7FD389F5-C677-4439-8082-EB0CAE2814F6@gmail.com> <20150812100738.GA14020@nazgul.tnic> <9232AF8E-87A3-40B2-852A-D07889F9E1B4@gmail.com> <20150813164302.GA15881@nazgul.tnic> <6ABF6137-251E-47EF-B824-AC77C9C9AB24@gmail.com> <20150817041634.GA9387@nazgul.tnic> <55D61AF3.4090004@zytor.com> <20150821043552.GA29712@nazgul.tnic> <55D792C8.6090006@zytor.com> <20150822090519.GA2812@nazgul.tnic> To: Borislav Petkov X-Mailer: Apple Mail (2.2104) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 31 > On Aug 22, 2015, at 17:05, Borislav Petkov wrote: > > On Fri, Aug 21, 2015 at 02:06:16PM -0700, H. Peter Anvin wrote: >> 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.) > > Ah, ok, so we're on the same page. > > And yep, Linus gave the probe_kernel_read() suggestion in another mail. > i am not clear about what is STAC / SMAP ? could you give me a link for understanding ? Linus suggest to use probe_kernel_read() , but also said it is not efficient to use it, because we need copy the data 2 times by this method. my patch suggests to use copy_in_user() , but seems not a generic(portable) function on all architectures. Thanks-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/