Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565AbcLaCIH (ORCPT ); Fri, 30 Dec 2016 21:08:07 -0500 Received: from mail-ua0-f178.google.com ([209.85.217.178]:34489 "EHLO mail-ua0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754386AbcLaCIF (ORCPT ); Fri, 30 Dec 2016 21:08:05 -0500 MIME-Version: 1.0 In-Reply-To: <1483075412.106950.86.camel@ranerica-desktop> References: <20161224013745.108716-1-ricardo.neri-calderon@linux.intel.com> <20161224013745.108716-6-ricardo.neri-calderon@linux.intel.com> <1482885582.106950.29.camel@ranerica-desktop> <1483075412.106950.86.camel@ranerica-desktop> From: Andy Lutomirski Date: Fri, 30 Dec 2016 18:07:44 -0800 Message-ID: Subject: Re: [v2 5/7] x86: Add emulation code for UMIP instructions To: Ricardo Neri Cc: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , "linux-kernel@vger.kernel.org" , X86 ML , linux-msdos@vger.kernel.org, wine-devel@winehq.org, Andrew Morton , "H . Peter Anvin" , Brian Gerst , Chen Yucong , Chris Metcalf , Dave Hansen , Fenghua Yu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S . Tsirkin" , Paul Gortmaker , "Ravi V . Shankar" , Shuah Khan , Vlastimil Babka , Tony Luck , Paolo Bonzini , "Liang Z . Li" , Alexandre Julliard , Stas Sergeev Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1058 Lines: 26 On Thu, Dec 29, 2016 at 9:23 PM, Ricardo Neri wrote: > On Tue, 2016-12-27 at 16:48 -0800, Andy Lutomirski wrote: >> >> >> > + if (nr_copied > 0) >> >> > + return -EFAULT; >> >> >> >> This should be the only EFAULT case. >> > Should this be EFAULT event if the caller cares only about successful >> > (return 0) vs failed (return non-0) emulation? >> >> In theory this particular error would be a page fault not a general >> protection fault (in the UMIP off case). If you were emulating it >> extra carefully, you could change the signal accordingly. But, as I >> said, I really doubt this matters. > > If simple enough and for the sake of accuracy, I could try to issue the > page fault. It seems to me that this entitles calling > force_sig_info_fault in this particular case as opposed to the > force_sig_info(SIGSEGV, SEND_SIG_PRIV, tsk) that do_general_protection > calls. Sure. You could even do it by sending the signal in the emulation code and returning true. --Andy