From owner-freebsd-current@FreeBSD.ORG Sun Sep 9 06:42:39 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E01B6106566B; Sun, 9 Sep 2012 06:42:39 +0000 (UTC) (envelope-from michael@fuckner.net) Received: from mo6-p00-ob.rzone.de (mo6-p00-ob.rzone.de [IPv6:2a01:238:20a:202:5300::1]) by mx1.freebsd.org (Postfix) with ESMTP id 1E2238FC14; Sun, 9 Sep 2012 06:42:38 +0000 (UTC) X-RZG-AUTH: :IWUHfUGtd9+4Du6KUGxoqde+AFhxnvkTDzh0c7ueojHnW/eNeq6A82NJ3vfS7BrHnwU0 X-RZG-CLASS-ID: mo00 Received: from c64.rebootking.de (e176133008.adsl.alicedsl.de [85.176.133.8]) by smtp.strato.de (joses mo16) (RZmta 30.14 DYNA|AUTH) with ESMTPA id L014b7o894FZLd ; Sun, 9 Sep 2012 08:42:37 +0200 (CEST) Message-ID: <504C3A5D.4020402@fuckner.net> Date: Sun, 09 Sep 2012 08:42:37 +0200 From: Michael Fuckner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 MIME-Version: 1.0 To: Konstantin Belousov References: <20120908181019.GK33100@deviant.kiev.zoral.com.ua> In-Reply-To: <20120908181019.GK33100@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sun, 09 Sep 2012 11:21:52 +0000 Cc: amd64@freebsd.org, current@freebsd.org Subject: Re: Small Ivy features: FSGSBASE and SMEP. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Sep 2012 06:42:40 -0000 Hi all, I changed your patch slightly to apply to specialreh.h on STABLE root@c64:/root # diff smep.1.patch.bak smep.1.patch 80c80 < diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h --- > diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h 82,83c82,83 < --- a/sys/x86/include/specialreg.h < +++ b/sys/x86/include/specialreg.h --- > --- a/sys/amd64/include/specialreg.h > +++ b/sys/amd64/include/specialreg.h I got a new kernel, but it is stuck immediately (kerneltrap 9 with interrupts disabled), system doesn't boot on E3-1230 V2 on Supermicro X9SCM-IIF Anything else I could check? Regards, Michael! On 09/08/2012 08:10 PM, Konstantin Belousov wrote: > Please find at > http://people.freebsd.org/~kib/misc/smep.1.patch > the patch which should enable the FSGSBASE and SMEP features > supposedly present in the IvyBridge CPUs. > > FSGSBASE are four new instructions available in the 64bit mode only. > They allow to access bases for %fs and %gs without touching MSRs. > This makes it possible to both read and write bases in the user mode, > or in ring 0 with lower overhead. > > At the moment, WRFSBASE/WRGSBASE instructions should work, but are > useless since any interrupt or context switch overrides bases with the > values set by the arch syscall. Still, RDFSBASE/RDGSBASE might be useful > for some code and I see no reason not to enable them. > > SMEP is the nice feature of the processor which makes it trap if ring > 0 tries to execute an instruction from usermode-accessible page. It is > another mitigation for things like calling user-controllable function > pointer in kernel, as well as a protection for NULL function pointer > dereference. > > I am sure that we never execute anything in kernel from user page, but > I did not tested the patch since I have no Ivy machine. > > I need your reports about boot on Ivy with patch applied. Please include > the lines from verbose dmesg with CPU Features. In particular, the > 'Standard Extended Features' report should appear in output. > > Thanks. >