From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755200AbcEBVc3 (ORCPT ); Mon, 2 May 2016 17:32:29 -0400 Received: from mga09.intel.com ([134.134.136.24]:31788 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754953AbcEBVcU (ORCPT ); Mon, 2 May 2016 17:32:20 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,569,1455004800"; d="scan'208";a="797224986" Subject: Re: [PATCH v4 04/10] x86/xsaves: Introduce a new check that allows correct xstates copy from kernel to user directly To: Yu-cheng Yu References: <5723BF63.2000100@linux.intel.com> <20160429224338.GA15757@test-lenovo> <5723FE20.7000906@linux.intel.com> <20160502155734.GA21577@test-lenovo> <57277B11.9080802@linux.intel.com> <20160502163410.GA21734@test-lenovo> <572783C3.8040907@linux.intel.com> <20160502171936.GA22224@test-lenovo> <57278F56.6050600@linux.intel.com> <20160502211817.GA22492@test-lenovo> <20160502212449.GA22532@test-lenovo> Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Sai Praneeth Prakhya , "Ravi V. Shankar" , Fenghua Yu From: Dave Hansen Message-ID: <5727C75E.8000401@linux.intel.com> Date: Mon, 2 May 2016 14:32:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160502212449.GA22532@test-lenovo> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/2016 02:24 PM, Yu-cheng Yu wrote: > On Mon, May 02, 2016 at 02:18:17PM -0700, Yu-cheng Yu wrote: >> > Before Linux gets into copy_fpstate_to_sigframe(), >> > current->thread.fpu.fpstate_active must be true. >> > For eagerfpu, fpregs_active() must also be true. >> > For lazyfpu, once we try to do FSAVE/FXSAVE/XSAVE, >> > fpregs_active() will become true as well. >> > >> > We should have not based on boot_cpu_has(X86_FEATURE_XSAVES) >> > at all. >> > >> > Why don't we make it simple and always copy_fpregs_to_signal_frame()? >> > Or, only for the lazy case, i.e. !fpregs_active(), we do __copy_to_user(). > For (lazy && not XSAVES) actually! I think we're off in the weeds here. Please just send an updated patch for what you want to do here.