lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJF2gTQjKXR9gpo06WAWG1aquiT87mATiMGorXs6ChxOxoe90Q@mail.gmail.com>
Date:   Tue, 12 Jan 2021 10:31:36 +0800
From:   Guo Ren <guoren@...nel.org>
To:     menglong8.dong@...il.com
Cc:     dong.menglong@....com.cn, linux-csky@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] csky: kprobe: fix unreachable code in simulate_blz32

Hi menglong,

On Mon, Jan 11, 2021 at 10:25 PM <menglong8.dong@...il.com> wrote:
>
> From: Menglong Dong <dong.menglong@....com.cn>
>
> The type of 'val' is 'unsigned long' in simulate_blz32, so 'val < 0'
> can't be true.
>
> When 'csky_insn_reg_get_val' fails, 'false' will be returned. We
> can directly use its return value here.
>
> Fixes: 33e53ae1ce41 ("csky: Add kprobes supported")
> Signed-off-by: Menglong Dong <dong.menglong@....com.cn>
> ---
>  arch/csky/kernel/probes/simulate-insn.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/csky/kernel/probes/simulate-insn.c b/arch/csky/kernel/probes/simulate-insn.c
> index 4e464fed52ec..b09ddcbcfa18 100644
> --- a/arch/csky/kernel/probes/simulate-insn.c
> +++ b/arch/csky/kernel/probes/simulate-insn.c
> @@ -346,9 +346,7 @@ simulate_blz32(u32 opcode, long addr, struct pt_regs *regs)
>         unsigned long tmp = opcode & 0x1f;
>         unsigned long val;
>
> -       csky_insn_reg_get_val(regs, tmp, &val);
> -
> -       if (val < 0) {
if ((long) val < 0) {
?

We need val to determine branch taken or not.

> +       if (!csky_insn_reg_get_val(regs, tmp, &val)) {
>                 instruction_pointer_set(regs,
>                         addr + sign_extend32((opcode & 0xffff0000) >> 15, 15));
>         } else
> --
> 2.17.1
>


-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ