Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755158AbdIFPyo (ORCPT ); Wed, 6 Sep 2017 11:54:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:43917 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754125AbdIFPym (ORCPT ); Wed, 6 Sep 2017 11:54:42 -0400 Date: Wed, 6 Sep 2017 17:54:30 +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 08/28] x86/mpx, x86/insn: Relocate insn util functions to a new insn-eval file Message-ID: <20170906155430.afl6ym3lyfvpfs5g@pd.tnic> References: <20170819002809.111312-1-ricardo.neri-calderon@linux.intel.com> <20170819002809.111312-9-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-9-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: 3094 Lines: 78 On Fri, Aug 18, 2017 at 05:27:49PM -0700, Ricardo Neri wrote: > Other kernel submodules can benefit from using the utility functions > defined in mpx.c to obtain the addresses and values of operands contained > in the general purpose registers. An instance of this is the emulation code > used for instructions protected by the Intel User-Mode Instruction > Prevention feature. > > Thus, these functions are relocated to a new insn-eval.c file. The reason > to not relocate these utilities into insn.c is that the latter solely > analyses instructions given by a struct insn without any knowledge of the > meaning of the values of instruction operands. This new utility insn- > eval.c aims to be used to resolve and userspace linear addresses based on ^ | something's missing there - "kernel" maybe? > the contents of the instruction operands as well as the contents of pt_regs > structure. > > These utilities come with a separate header. This is to avoid taking insn.c > out of sync from the instructions decoders under tools/obj and tools/perf. > This also avoids adding cumbersome #ifdef's for the #include'd files > required to decode instructions in a kernel context. > > Functions are simply relocated. There are not functional or indentation > changes. That text below you don't need to have in the commit message. Patch handling and other modalities are usually put after the "---" and before the diffstat below... > The checkpatch script issues the following warning with this > commit: > > WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code > rather than BUG() or BUG_ON() > + BUG(); > > This warning will be fixed in a subsequent patch. > > Cc: Borislav Petkov > Cc: Andy Lutomirski > 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: Dmitry Vyukov > Cc: Ravi V. Shankar > Cc: x86@kernel.org > Signed-off-by: Ricardo Neri > --- <--- ... here. Put such notes here. > arch/x86/include/asm/insn-eval.h | 16 ++++ > arch/x86/lib/Makefile | 2 +- > arch/x86/lib/insn-eval.c | 163 +++++++++++++++++++++++++++++++++++++++ > arch/x86/mm/mpx.c | 156 +------------------------------------ > 4 files changed, 182 insertions(+), 155 deletions(-) > create mode 100644 arch/x86/include/asm/insn-eval.h > create mode 100644 arch/x86/lib/insn-eval.c Reviewed-by: Borislav Petkov -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --