[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20201203132032.392d7dce940ed89c34341169@kernel.org>
Date: Thu, 3 Dec 2020 13:20:32 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc: x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
Kees Cook <keescook@...omium.org>,
"H . Peter Anvin" <hpa@...or.com>, Joerg Roedel <jroedel@...e.de>,
Tom Lendacky <thomas.lendacky@....com>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
Jann Horn <jannh@...gle.com>,
Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] x86/uprobes: Fix not using prefixes.nbytes for loop
over prefixes.bytes
On Wed, 2 Dec 2020 20:21:35 +0530
Srikar Dronamraju <srikar@...ux.vnet.ibm.com> wrote:
> * Masami Hiramatsu <mhiramat@...nel.org> [2020-12-02 17:51:16]:
>
> > Since the insn.prefixes.nbytes can be bigger than the size of
> > insn.prefixes.bytes[] when a same prefix is repeated, we have to
> > check whether the insn.prefixes.bytes[i] != 0 and i < 4 instead
> > of insn.prefixes.nbytes.
> >
> > Fixes: 2b1444983508 ("uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints")
> > Cc: stable@...r.kernel.org
> > Reported-by: Kees Cook <keescook@...omium.org>
> > Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
>
> Looks good to me.
>
> Reviewed-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Thanks Srikar!
>
> > ---
> > arch/x86/kernel/uprobes.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
> > index 3fdaa042823d..bb3ea3705b99 100644
> > --- a/arch/x86/kernel/uprobes.c
> > +++ b/arch/x86/kernel/uprobes.c
> > @@ -257,7 +257,7 @@ static bool is_prefix_bad(struct insn *insn)
> > {
> > int i;
> >
> > - for (i = 0; i < insn->prefixes.nbytes; i++) {
> > + for (i = 0; insn->prefixes.bytes[i] && i < 4; i++) {
> > insn_attr_t attr;
> >
> > attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]);
> > @@ -746,7 +746,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
> > * Intel and AMD behavior differ in 64-bit mode: Intel ignores 66 prefix.
> > * No one uses these insns, reject any branch insns with such prefix.
> > */
> > - for (i = 0; i < insn->prefixes.nbytes; i++) {
> > + for (i = 0; insn->prefixes.bytes[i] && i < 4; i++) {
> > if (insn->prefixes.bytes[i] == 0x66)
> > return -ENOTSUPP;
> > }
> >
>
> --
> Thanks and Regards
> Srikar Dronamraju
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists