On Wed, 2017-09-06 at 17:54 +0200, Borislav Petkov wrote: > 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?
I have updated this line to read "This new utility insn-eval.c aims to be used to resolve userspace linear addresses based on the contents of the instruction operands as well as the contents of pt_regs structure." > > > 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 <b...@suse.de> > > Cc: Andy Lutomirski <l...@kernel.org> > > Cc: Dave Hansen <dave.han...@linux.intel.com> > > Cc: Adam Buchbinder <adam.buchbin...@gmail.com> > > Cc: Colin Ian King <colin.k...@canonical.com> > > Cc: Lorenzo Stoakes <lstoa...@gmail.com> > > Cc: Qiaowei Ren <qiaowei....@intel.com> > > Cc: Arnaldo Carvalho de Melo <a...@redhat.com> > > Cc: Masami Hiramatsu <mhira...@kernel.org> > > Cc: Adrian Hunter <adrian.hun...@intel.com> > > Cc: Kees Cook <keesc...@chromium.org> > > Cc: Thomas Garnier <thgar...@google.com> > > Cc: Peter Zijlstra <pet...@infradead.org> > > Cc: Dmitry Vyukov <dvyu...@google.com> > > Cc: Ravi V. Shankar <ravi.v.shan...@intel.com> > > Cc: x...@kernel.org > > Signed-off-by: Ricardo Neri <ricardo.neri-calde...@linux.intel.com> > > --- > > <--- ... here. Put such notes here. Thanks for explaining this to me. I will move the note about the warning 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 <b...@suse.de> Thanks you! BR, Ricardo