Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756550AbdIHQO3 (ORCPT ); Fri, 8 Sep 2017 12:14:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:60742 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756308AbdIHQN4 (ORCPT ); Fri, 8 Sep 2017 12:13:56 -0400 Date: Fri, 8 Sep 2017 15:57:16 +0200 From: Borislav Petkov To: Ricardo Neri 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, ricardo.neri@intel.com, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren , Arnaldo Carvalho de Melo , Adrian Hunter , Kees Cook , Thomas Garnier , Dmitry Vyukov Subject: Re: [PATCH v8 11/28] x86/insn-eval: Add utility function to identify string instructions Message-ID: <20170908135715.hoppz4j3abvu6j6g@pd.tnic> References: <20170819002809.111312-1-ricardo.neri-calderon@linux.intel.com> <20170819002809.111312-12-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170819002809.111312-12-ricardo.neri-calderon@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2073 Lines: 47 On Fri, Aug 18, 2017 at 05:27:52PM -0700, Ricardo Neri wrote: > String instructions are special because, in protected mode, the linear > address is always obtained via the ES segment register in operands that > use the (E)DI register; the DS segment register in operands that use > the (E)SI register. Furthermore, segment override prefixes are ignored > when calculating a linear address involving the (E)DI register; segment > override prefixes can be used when calculating linear addresses involving > the (E)SI register. > > It follows that linear addresses are calculated differently for the case of > string instructions. The purpose of this utility function is to identify > such instructions for callers to determine a linear address correctly. > > Note that this function only identifies string instructions; it does not > determine what segment register to use in the address computation. That is > left to callers. A subsequent commmit introduces a function to determine > the segment register to use given the instruction, operands and > segment override prefixes. > > Cc: Dave Hansen > Cc: Adam Buchbinder > Cc: Colin Ian King > Cc: Lorenzo Stoakes > Cc: Qiaowei Ren > Cc: Arnaldo Carvalho de Melo > Cc: Masami Hiramatsu > Cc: Adrian Hunter > Cc: Kees Cook > Cc: Thomas Garnier > Cc: Peter Zijlstra > Cc: Borislav Petkov > Cc: Dmitry Vyukov > Cc: Ravi V. Shankar > Cc: x86@kernel.org > Signed-off-by: Ricardo Neri > --- > arch/x86/lib/insn-eval.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --