[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVNnn3onV3N0b2UPxYL0kM_sY6NXE5O8RABkc+prnyRYg@mail.gmail.com>
Date: Mon, 12 Jan 2015 15:57:01 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Subject: Re: [PATCH 3.19 v2 2/3] x86, mpx: Short-circuit the instruction
decoder for unexpected opcodes
On Mon, Jan 12, 2015 at 3:47 PM, Dave Hansen
<dave.hansen@...ux.intel.com> wrote:
> Couple of typos...
>
> On 01/12/2015 03:04 PM, Andy Lutomirski wrote:
>> + /*
>> + * We only _really_ need to decode bndcl/bndcn/bndcu
>> + * Error out on anything else. Check this before decoding the
>> + * instruction to reduce our exposure to intentionally bad code
>> + * to some extent. Note that this shortcut cat incorrectly return
>
> "...can incorrectly return"
Will fix.
>
>> + * -EINVAL instead of -EFAULT under some circumstances. This
>> + * discrepency has no effect.
>> + */
>
> ^^ discrepancy
>
Will fix.
>
>> + if (nr_copied < 2)
>> + goto bad_opcode;
>> + if (buf[0] != 0x0f)
>> + goto bad_opcode;
>> + if (buf[1] != 0x1a && buf[1] != 0x1b)
>> + goto bad_opcode;
> ...
>> - /*
>> - * We only _really_ need to decode bndcl/bndcn/bndcu
>> - * Error out on anything else.
>> - */
>> - if (insn->opcode.bytes[0] != 0x0f)
>> - goto bad_opcode;
>> - if ((insn->opcode.bytes[1] != 0x1a) &&
>> - (insn->opcode.bytes[1] != 0x1b))
>> - goto bad_opcode;
>
> Otherwise, this looks OK to me. Have you tested this at all? I know
> you don't have any MPX hardware, but you can still hack something in to
> point the instruction decoder at an MPX binary.
I haven't tested this at all. ISTM it's more likely that any test
hack I write for this will mask any problem than that it will be a
real test.
That being said, it should be okay, given that the condition was
already there later in the function.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists