Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a new insn-utils

2017-01-03 Thread Ricardo Neri
On Tue, 2017-01-03 at 08:44 -0800, Dave Hansen wrote:
> On 12/23/2016 05:37 PM, 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.
> 
> I haven't looked at this in detail, but as long as this is pretty much a
> straight code move, I don't see any issues with it from an MPX
> perspective.  I'm glad to see it getting reused.

Yes, this is only a relocation of code.
> 
> Feel free to add my Acked-by on it if you like.

Great! Thanks!
Ricardo


--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [v2 2/7] x86/mpx: Fail when implicit zero-displacement is used along with R/EBP

2017-01-03 Thread Dave Hansen
On 12/27/2016 02:33 PM, Ricardo Neri wrote:
>>> diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
>>> index 6a75a75..71681d0 100644
>>> --- a/arch/x86/mm/mpx.c
>>> +++ b/arch/x86/mm/mpx.c
>>> @@ -120,6 +120,13 @@ static int get_reg_offset(struct insn *insn, struct 
>>> pt_regs *regs,
>>>
>>> case REG_TYPE_BASE:
>>> regno = X86_SIB_BASE(insn->sib.value);
>>> +   if (regno == 5 && X86_MODRM_RM(insn->modrm.value) == 0) {
>>> +   WARN_ONCE(1, "An explicit displacement is required 
>>> when %sBP used as SIB base.",
>>> + (IS_ENABLED(CONFIG_X86_64) && 
>>> insn->x86_64) ?
>>> + "R13 or R" : "E");
>>> +   return -EINVAL;
>>> +   }
>>> +
>> Now that I've read the cover letter, I see what's going on.  This
>> should not warn -- user code can easily trigger this deliberately.
> OK, I'll remove it. Are you concerned about the warning printing the
> calltrace, even only once?

Yes.  We don't let userspace spam the kernel, even once.  If we have a
couple thousand "only once" places, then userspace can overwhelm the
kernel log.

Also, this needs a much better description of what's going on in the
code.  Could you add a comment explaining what's going on, and why
regno==5, etc...?
--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [v2 3/7] x86/mpx, x86/insn: Relocate insn util functions to a new insn-utils

2017-01-03 Thread Dave Hansen
On 12/23/2016 05:37 PM, 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.

I haven't looked at this in detail, but as long as this is pretty much a
straight code move, I don't see any issues with it from an MPX
perspective.  I'm glad to see it getting reused.

Feel free to add my Acked-by on it if you like.
--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html