From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from aserp2120.oracle.com ([141.146.126.78]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fE8Zl-00033L-PI for speck@linutronix.de; Thu, 03 May 2018 09:22:50 +0200 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w437LU1p009986 for ; Thu, 3 May 2018 07:22:43 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2hmgxg0740-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 03 May 2018 07:22:43 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w437MgSr014644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 3 May 2018 07:22:42 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w437MgiG010447 for ; Thu, 3 May 2018 07:22:42 GMT Date: Thu, 3 May 2018 03:22:41 -0400 From: Konrad Rzeszutek Wilk Subject: [MODERATED] Re: [patch V11 14/16] SSB 14 Message-ID: <20180503072241.GD30144@char.us.oracle.com> References: <20180502215102.192655950@linutronix.de> <20180502215417.260586111@linutronix.de> MIME-Version: 1.0 In-Reply-To: <20180502215417.260586111@linutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Wed, May 02, 2018 at 11:51:16PM +0200, speck for Thomas Gleixner wrote: > Subject: [patch V11 14/16] prctl: Add speculation control prctls > From: Thomas Gleixner > > Add two new prctls to control aspects of speculation related vulnerabilites > and their mitigations to provide finer grained control over performance > impacting mitigations. > > PR_GET_SPECULATION_CTRL returns the state of the speculation misfeature > which is selected with arg2 of prctl(2). The return value uses bit 0-2 with > the following meaning: > > Bit Define Description > 0 PR_SPEC_PRCTL Mitigation can be controlled per task by > PR_SET_SPECULATION_CTRL > 1 PR_SPEC_ENABLE The speculation feature is enabled, mitigation is > disabled > 2 PR_SPEC_DISABLE The speculation feature is disabled, mitigation is > enabled > > If all bits are 0 the CPU is not affected by the speculation misfeature. > > If PR_SPEC_PRCTL is set, then the per task control of the mitigation is > available. If not set, prctl(PR_SET_SPECULATION_CTRL) for the speculation > misfeature will fail. > > PR_SET_SPECULATION_CTRL allows to control the speculation misfeature, which > is selected by arg2 of prctl(2) per task. arg3 is used to hand in the > control value, i.e. either PR_SPEC_ENABLE or PR_SPEC_DISABLE. > > The common return values are: > > EINVAL prctl is not implemented by the architecture or the unused prctl() > arguments are not 0 > ENODEV arg2 is selecting a not supported speculation misfeature > > PR_SET_SPECULATION_CTRL has these additional return values: > > ERANGE arg3 is incorrect, i.e. it's not either PR_SPEC_ENABLE or PR_SPEC_DISABLE > ENXIO prctl control of the selected speculation misfeature is disabled > > The first supported controlable speculation misfeature is > PR_SPEC_STORE_BYPASS. Add the define so this can be shared between > architectures. > > TODO: Write a man prctl(2) patch. > > Based on an initial patch from Tim Chen and mostly rewritten. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Ingo Molnar Reviewed-by: Konrad Rzeszutek Wilk with the "TODO: Write a man ..." removed from it.