Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp805647ybz; Wed, 29 Apr 2020 09:41:28 -0700 (PDT) X-Google-Smtp-Source: APiQypLvhsJRl3uvgIO+4FdblKM15ORrpiMoOzFZ1Ca5JX4HTfHgs2u/QSJLgnVefv5WQ69JEsil X-Received: by 2002:a17:906:4a94:: with SMTP id x20mr3512240eju.306.1588178488544; Wed, 29 Apr 2020 09:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588178488; cv=none; d=google.com; s=arc-20160816; b=EMoa9yz/hVUtFm6HfZrLpZt/1+lXUO6Tkl1CqiR/PhRerqBn0nD11CXNCyWmASVZiP DKs9FV3kOodsoycJMRjYbYsbOueegambY7/DU4h+RUsGHfkZqA/oOsnaEZHpniue/GMR NOL1nP4Uhrl0wwTXUfhPpj9mYmMKkBOClD/X5iOfAZVPLJGLLjF/g1xNBm2sn9iO0uJn l/IrJXIpUWS3U+KEVnOSe1OdK0IBfm/q6FGB9p4GYEFavNt+dsAEef0mPZWYafZRrqMM huDvO1kK19pAFXZ0DHnbC2/AfbUv6LvEhYmQIBZWxNuT8TP7zOGuK4FvEN36E/KTymIx teWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PYrW8QbWPmgOqVEyiqZLdTGs3TOGsh9OAn8MGLn5nFA=; b=MvIIJkhrbj45niobm9RBgyQET6+UYGZqDzo21xvSYdG4xFT12RIQuFCg9ar3QNqKTv Eu/KRd/pYVhq9/v2YOfcNjYV9I3A39Pbno/tSdGhA7zTx3qTekBKD/11xGN/tdIvT3hb CEpVSaXjr41fI3BLXYmNdSgb5l6LUh4z5hqlpMy4afQL1vTtaxvPD5S69wZKKvXIW5n6 JNwygiwepzB5lhaQ6uBjriZzwT5UfRgqPxJFm8n9PRSSaW6xKKnwgvJWM0Jil5MhHzU9 IJhJsKvLF/R+fOi6ul5cWR6lYPl9UGbvMfxSIlxnjVtrJ8fbuKwq+rOTN86eXvTjTmmW Zn7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NJODSSyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si4049050ejn.341.2020.04.29.09.41.03; Wed, 29 Apr 2020 09:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=NJODSSyM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbgD2QjO (ORCPT + 99 others); Wed, 29 Apr 2020 12:39:14 -0400 Received: from mail.skyhub.de ([5.9.137.197]:57264 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbgD2QjN (ORCPT ); Wed, 29 Apr 2020 12:39:13 -0400 Received: from zn.tnic (p200300EC2F0B950044557BF5C5A01829.dip0.t-ipconnect.de [IPv6:2003:ec:2f0b:9500:4455:7bf5:c5a0:1829]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id EE8691EC0CCC; Wed, 29 Apr 2020 18:39:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1588178352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=PYrW8QbWPmgOqVEyiqZLdTGs3TOGsh9OAn8MGLn5nFA=; b=NJODSSyMww+Qc3Kz7fsHSNqGHT3aSs1h6149Kjal3hSqfuV2mRLNk5Fes37qygIXKkh0I7 Gz1mJgenVLvs4peXq6pCuTL8mt/TzR/pmZEHpFA0IjE9YG/rC9ZGtWF83QtMpOm96eWhBV 0bYeGdeDhaO14r/Vr9TIwy7flJN8/TU= Date: Wed, 29 Apr 2020 18:39:06 +0200 From: Borislav Petkov To: Yu-cheng Yu Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Dave Hansen , Tony Luck , Andy Lutomirski , Rik van Riel , "Ravi V. Shankar" , Sebastian Andrzej Siewior , Fenghua Yu , Peter Zijlstra Subject: Re: [PATCH v3 05/10] x86/fpu/xstate: Define new functions for clearing fpregs and xstates Message-ID: <20200429163906.GC16407@zn.tnic> References: <20200328164307.17497-6-yu-cheng.yu@intel.com> <20200429160644.28584-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200429160644.28584-1-yu-cheng.yu@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 09:06:44AM -0700, Yu-cheng Yu wrote: > From: Fenghua Yu > > Currently, fpu__clear() clears all fpregs and xstates. Once XSAVES > supervisor states are introduced, supervisor settings (e.g. CET xstates) > must remain active for signals; It is necessary to have separate functions: > > - Create fpu__clear_user_states(): clear only user settings for signals; > - Create fpu__clear_all(): clear both user and supervisor settings in > flush_thread(). > > Also modify copy_init_fpstate_to_fpregs() to take a mask from above two > functions. > > Signed-off-by: Fenghua Yu > Co-developed-by: Yu-cheng Yu > Signed-off-by: Yu-cheng Yu > Reviewed-by: Dave Hansen > Reviewed-by: Tony Luck > > v3: > - Put common code into a static function fpu__clear(), with a parameter > user_only. > > v2: > - Fixed an issue where fpu__clear_user_states() drops supervisor xstates. > - Revise commit log. Try applying that patch from this mail yourself and see whether the patch changelog will remain in the commit message or it will get discarded. > @@ -318,18 +313,40 @@ static inline void copy_init_fpstate_to_fpregs(void) > * Called by sys_execve(), by the signal handler code and by various > * error paths. > */ > -void fpu__clear(struct fpu *fpu) > +static void fpu__clear(struct fpu *fpu, int user_only) > { > - WARN_ON_FPU(fpu != ¤t->thread.fpu); /* Almost certainly an anomaly */ > + WARN_ON_FPU(fpu != ¤t->thread.fpu); Why did you remove the side comment? Is it wrong? Why do you do such arbitrary changes which are not needed instead of concentrating on only the changes the patch should do? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette