From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933687AbaDVSAT (ORCPT ); Tue, 22 Apr 2014 14:00:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:52591 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933011AbaDVSAM (ORCPT ); Tue, 22 Apr 2014 14:00:12 -0400 Message-ID: <5356ADF9.5030401@zytor.com> Date: Tue, 22 Apr 2014 10:59:21 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Andrew Lutomirski CC: Linus Torvalds , Borislav Petkov , "H. Peter Anvin" , Linux Kernel Mailing List , Ingo Molnar , Alexander van Heukelum , Konrad Rzeszutek Wilk , Boris Ostrovsky , Arjan van de Ven , Brian Gerst , Alexandre Julliard , Andi Kleen , Thomas Gleixner Subject: Re: [PATCH] x86-64: espfix for 64-bit mode *PROTOTYPE* References: <20140422112312.GB15882@pd.tnic> <20140422144659.GF15882@pd.tnic> <53569467.1030809@zytor.com> <5356A70A.5090907@zytor.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/22/2014 10:46 AM, Andrew Lutomirski wrote: >> >> That is the whole impact of the IRET path. >> >> If using IST for #GP won't cause trouble (ISTs don't nest, so we need to >> make sure there is absolutely no way we could end up nested) then the >> rest of the fixup code can go away and we kill the common path >> exception-handling overhead; the only new overhead is the IST >> indirection for #GP, which isn't a performance-critical fault (good >> thing, because untangling #GP faults is a major effort.) > > I'd be a bit nervous about read_msr_safe and friends. Also, what > happens if userspace triggers a #GP and the signal stack setup causes > a page fault? > Yes, #GPs inside the kernel could be a real problem. MSRs generally don't trigger #SS. The second scenario shouldn't be a problem, the #PF will be delivered on the currently active stack. On the other hand, doing the espfix fixup only for #GP might be an alternative, as long as we can convince ourselves that it really is the only fault that could possibly be delivered on the espfix path. -hpa