From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751408AbdJDQsW (ORCPT ); Wed, 4 Oct 2017 12:48:22 -0400 Received: from mga06.intel.com ([134.134.136.31]:24404 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdJDQsU (ORCPT ); Wed, 4 Oct 2017 12:48:20 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,478,1500966000"; d="scan'208";a="135151530" Message-ID: <1507135670.2532.138.camel@linux.intel.com> Subject: Re: [PATCH v8 12/28] x86/insn-eval: Add utility functions to get segment selector From: Ricardo Neri To: Borislav Petkov Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Brian Gerst , Chris Metcalf , Dave Hansen , Paolo Bonzini , Masami Hiramatsu , Huang Rui , Jiri Slaby , Jonathan Corbet , "Michael S. Tsirkin" , Paul Gortmaker , Vlastimil Babka , Chen Yucong , "Ravi V. Shankar" , Shuah Khan , linux-kernel@vger.kernel.org, x86@kernel.org, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren , Arnaldo Carvalho de Melo , Adrian Hunter , Kees Cook , Thomas Garnier , Dmitry Vyukov Date: Wed, 04 Oct 2017 09:47:50 -0700 In-Reply-To: <20170929115611.ldpldjr7z7ygdgph@pd.tnic> References: <20170819002809.111312-1-ricardo.neri-calderon@linux.intel.com> <20170819002809.111312-13-ricardo.neri-calderon@linux.intel.com> <20170926104353.vmpxybv3v5immc56@pd.tnic> <1506486104.8286.142.camel@linux.intel.com> <20170927114713.wbee7ze2ud2ekvbw@pd.tnic> <1506551546.2532.36.camel@linux.intel.com> <20170928093639.nwvohdd7h7i4htft@pd.tnic> <1506665202.2532.118.camel@linux.intel.com> <20170929115611.ldpldjr7z7ygdgph@pd.tnic> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 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 On Fri, 2017-09-29 at 13:56 +0200, Borislav Petkov wrote: > On Thu, Sep 28, 2017 at 11:06:42PM -0700, Ricardo Neri wrote: > > > > I agree. In fact, insn_get_seg_base() does not need insn at all. All it > > needs is > > a INAT_SEG_REG_* index. This would make things clear. UMIP (and callers that > > need to copy_from_user code can do insn_get_seg_base(regs, INAT_SEG_REG_CS). > > No > > insn needed. > Yap. > > > > > In fact, it is only the insn_get_addr_ref_xx() family of functions that does > I think you mean get_addr_ref_xx() here. Yes. > > > > > Do you think the pseudocode above addresses your concerns? > > > > *insn_get_seg_base() will take a INAT_SEG_REG_* index > > *insn_get_ref_xx() receives an initialized insn that can check for NULL > > value. > > *a reworked resolve_seg_reg_idx will clearly check if it can use segment > > override prefixes and obtain them. If not, it will use default values. > Makes sense, but send me the final version to take a look at it too. I just sent a v9 with all these changes as they impacted several patches in the series. Thanks and BR, Ricardo