From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Neri Subject: Re: [v6 PATCH 04/21] x86/mpx, x86/insn: Relocate insn util functions to a new insn-kernel Date: Tue, 25 Apr 2017 19:05:53 -0700 Message-ID: <1493172353.36058.27.camel@ranerica-desktop> References: <20170308003254.27833-1-ricardo.neri-calderon@linux.intel.com> <20170308003254.27833-5-ricardo.neri-calderon@linux.intel.com> <20170412100308.uuai3hf3l2fsavhb@pd.tnic> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170412100308.uuai3hf3l2fsavhb@pd.tnic> Sender: linux-kernel-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 Wed, 2017-04-12 at 12:03 +0200, Borislav Petkov wrote: > > + * If mod is 0 and register R/EBP (regno=5) is > indicated in the > > + * base part of the SIB byte, the value of such > register should > > + * not be used in the address computation. Also, a > 32-bit > > + * displacement is expected in this case; the > instruction > > + * decoder takes care of it. This is true for both R13 > and > > + * R/EBP as REX.B will not be decoded. > > + */ > > + if (regno == 5 && X86_MODRM_MOD(insn->modrm.value) == > 0) > > + return -EDOM; > > + > > + if (X86_REX_B(insn->rex_prefix.value)) > > + regno += 8; > > + break; > > + > > + default: > > + pr_err("invalid register type"); > > + BUG(); > > WARNING: Avoid crashing the kernel - try using WARN_ON & recovery code > rather than BUG() or BUG_ON() > #211: FILE: arch/x86/lib/insn-eval.c:90: > + BUG(); > > And checkpatch is kinda right. We need to warn here, not explode. Oh > and > that function returns negative values on error... > > Please change that with a patch ontop of the move. Sure, I will change it.