From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757520AbdELBz5 (ORCPT ); Thu, 11 May 2017 21:55:57 -0400 Received: from mga04.intel.com ([192.55.52.120]:57921 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751282AbdELBzz (ORCPT ); Thu, 11 May 2017 21:55:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,327,1491289200"; d="scan'208";a="1168071389" Message-ID: <1494554154.118905.44.camel@ranerica-desktop> Subject: Re: [v6 PATCH 12/21] x86/insn: Support both signed 32-bit and 64-bit effective addresses 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 , Alexandre Julliard , Stas Sergeev , Fenghua Yu , "Ravi V. Shankar" , Shuah Khan , linux-kernel@vger.kernel.org, x86@kernel.org, linux-msdos@vger.kernel.org, wine-devel@winehq.org, Adam Buchbinder , Colin Ian King , Lorenzo Stoakes , Qiaowei Ren , Arnaldo Carvalho de Melo , Adrian Hunter , Kees Cook , Thomas Garnier , Dmitry Vyukov Date: Thu, 11 May 2017 18:55:54 -0700 In-Reply-To: <20170508114224.lmsnxlkzgnmdtpc2@pd.tnic> References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <20170308003254.27833-13-ricardo.neri-calderon@linux.intel.com> <20170425135150.5sk4kwaw2qrsxre3@pd.tnic> <1493264026.36058.94.camel@ranerica-desktop> <20170508114224.lmsnxlkzgnmdtpc2@pd.tnic> 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 On Mon, 2017-05-08 at 13:42 +0200, Borislav Petkov wrote: > On Wed, Apr 26, 2017 at 08:33:46PM -0700, Ricardo Neri wrote: > > This is the reason I check the value of long_bytes. If long_bytes is not > > 4, being the only other possible value 8 (perhaps I need to issue an > > error when the value is not any of these values), > > Well, maybe I'm a bit too paranoid. Bottom line is, we should do the > address computations exactly like the hardware does them so that there > are no surprises. Doing them with longs looks ok to me. Using long is exactly what I intend to do. The problem that I am trying to resolve is to sign-extend signed memory offsets of 32-bit programs running on 64-bit kernels. For 64-bit programs running on 64-bit kernels I can simply use longs. I added error checking in my v7 of this series [1]. Thanks and BR, Ricardo [1]. https://lkml.org/lkml/2017/5/5/407 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Neri Subject: Re: [v6 PATCH 12/21] x86/insn: Support both signed 32-bit and 64-bit effective addresses Date: Thu, 11 May 2017 18:55:54 -0700 Message-ID: <1494554154.118905.44.camel@ranerica-desktop> References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <20170308003254.27833-13-ricardo.neri-calderon@linux.intel.com> <20170425135150.5sk4kwaw2qrsxre3@pd.tnic> <1493264026.36058.94.camel@ranerica-desktop> <20170508114224.lmsnxlkzgnmdtpc2@pd.tnic> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170508114224.lmsnxlkzgnmdtpc2@pd.tnic> Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" 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 , Alexandre Julliard , Stas Sergeev , Fenghua Yu On Mon, 2017-05-08 at 13:42 +0200, Borislav Petkov wrote: > On Wed, Apr 26, 2017 at 08:33:46PM -0700, Ricardo Neri wrote: > > This is the reason I check the value of long_bytes. If long_bytes is not > > 4, being the only other possible value 8 (perhaps I need to issue an > > error when the value is not any of these values), > > Well, maybe I'm a bit too paranoid. Bottom line is, we should do the > address computations exactly like the hardware does them so that there > are no surprises. Doing them with longs looks ok to me. Using long is exactly what I intend to do. The problem that I am trying to resolve is to sign-extend signed memory offsets of 32-bit programs running on 64-bit kernels. For 64-bit programs running on 64-bit kernels I can simply use longs. I added error checking in my v7 of this series [1]. Thanks and BR, Ricardo [1]. https://lkml.org/lkml/2017/5/5/407