Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932232AbdCGA0s (ORCPT ); Mon, 6 Mar 2017 19:26:48 -0500 Received: from mga11.intel.com ([192.55.52.93]:52858 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753787AbdCGA00 (ORCPT ); Mon, 6 Mar 2017 19:26:26 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,256,1484035200"; d="scan'208";a="1138767039" Message-ID: <1488846361.131264.0.camel@ranerica-desktop> Subject: Re: [v5 17/20] x86/umip: Force a page fault when unable to copy emulated result to user From: Ricardo Neri To: Andy Lutomirski Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Borislav Petkov , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Liang Z Li , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , Alexandre Julliard , Stas Sergeev , Fenghua Yu , "Ravi V. Shankar" , Shuah Khan , "linux-kernel@vger.kernel.org" , X86 ML , linux-msdos@vger.kernel.org, wine-devel@winehq.org Date: Mon, 06 Mar 2017 16:26:01 -0800 In-Reply-To: References: <20170303214132.77244-1-ricardo.neri-calderon@linux.intel.com> <20170303214132.77244-18-ricardo.neri-calderon@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1012 Lines: 26 On Sun, 2017-03-05 at 08:18 -0800, Andy Lutomirski wrote: > > + */ > > +static void __force_sig_info_umip_fault(void __user *address, > > + struct pt_regs *regs) > > +{ > > + siginfo_t info; > > + struct task_struct *tsk = current; > > + > > + if (show_unhandled_signals && unhandled_signal(tsk, > SIGSEGV)) { > > + printk_ratelimited("%s[%d] umip emulation segfault > ip:%lx sp:%lx error:%lx in %lx\n", > > + tsk->comm, task_pid_nr(tsk), > regs->ip, > > + regs->sp, UMIP_PF_USER | > UMIP_PF_WRITE, > > + regs->ip); > > + } > > + > > + tsk->thread.cr2 = (unsigned long)address; > > + tsk->thread.error_code = UMIP_PF_USER | UMIP_PF_WRITE; > > Please just move enum x86_pf_error_code into a header and rename the > fields X86_PF_USER, etc rather than duplicating it. Thanks again for your feedback! I will do this.