From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932234AbcEBWhr (ORCPT ); Mon, 2 May 2016 18:37:47 -0400 Received: from mga14.intel.com ([192.55.52.115]:30373 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755166AbcEBWhq (ORCPT ); Mon, 2 May 2016 18:37:46 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,569,1455004800"; d="scan'208";a="797264596" 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: <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> <5727C75E.8000401@linux.intel.com> <20160502221754.GA22667@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: <5727D6B7.6080004@linux.intel.com> Date: Mon, 2 May 2016 15:37:43 -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: <20160502221754.GA22667@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 03:17 PM, Yu-cheng Yu wrote: > @@ -167,7 +168,7 @@ int copy_fpstate_to_sigframe(void __user *buf, void __user *buf_fx, int size) > sizeof(struct user_i387_ia32_struct), NULL, > (struct _fpstate_32 __user *) buf) ? -1 : 1; > > - if (fpregs_active()) { > + if (fpregs_active() || using_compacted_format()) { > /* Save the live register state to the user directly. */ > if (copy_fpregs_to_sigframe(buf_fx)) > return -1; So, compared to the first patch, you move the fpregs_active() check out to the caller of may_copy_fpregs_to_sigframe() (good) and removed a bunch of comments explaining what was going on (bad). Do we really want all those comments to die?