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]
Date:   Thu, 23 Jun 2022 18:37:19 +0800
From:   Huacai Chen <chenhuacai@...nel.org>
To:     Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc:     WANG Xuerui <kernel@...0n.name>,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] LoongArch: Make compute_return_era() return void

Hi, Tiezhu,

On Thu, Jun 23, 2022 at 5:36 PM Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
>
>
>
> On 06/23/2022 05:26 PM, Huacai Chen wrote:
> > Hi, Tiezhu,
> >
> > On Sat, Jun 18, 2022 at 4:39 PM Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
> >>
> >> compute_return_era() always returns 0, make it return void,
> >> and then no need to check its return value for its callers.
> >>
> >> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
> >> ---
> >>  arch/loongarch/include/asm/branch.h | 3 +--
> >>  arch/loongarch/kernel/traps.c       | 3 +--
> >>  2 files changed, 2 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/loongarch/include/asm/branch.h b/arch/loongarch/include/asm/branch.h
> >> index 3f33c89..9a133e4 100644
> >> --- a/arch/loongarch/include/asm/branch.h
> >> +++ b/arch/loongarch/include/asm/branch.h
> >> @@ -12,10 +12,9 @@ static inline unsigned long exception_era(struct pt_regs *regs)
> >>         return regs->csr_era;
> >>  }
> >>
> >> -static inline int compute_return_era(struct pt_regs *regs)
> >> +static inline void compute_return_era(struct pt_regs *regs)
> >>  {
> >>         regs->csr_era += 4;
> >> -       return 0;
> >>  }
> >>
> >>  #endif /* _ASM_BRANCH_H */
> >> diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c
> >> index e4060f8..1bf58c6 100644
> >> --- a/arch/loongarch/kernel/traps.c
> >> +++ b/arch/loongarch/kernel/traps.c
> >> @@ -475,8 +475,7 @@ asmlinkage void noinstr do_ri(struct pt_regs *regs)
> >>
> >>         die_if_kernel("Reserved instruction in kernel code", regs);
> >>
> >> -       if (unlikely(compute_return_era(regs) < 0))
> >> -               goto out;
> >> +       compute_return_era(regs);
> > Maybe it is better to simply remove the compute_return_era() function?
>
> Good idea, if so, I think we can also remove exception_era(), and then
> arch/loongarch/include/asm/branch.h can be removed.
>
> If you are OK, I will send a v2 patch to remove
> arch/loongarch/include/asm/branch.h
After some consideration, I think just taking this version is OK,
because maybe there will be more callers in future. Thanks.

Huacai
>
> Thanks,
> Tiezhu
>
> >
> > Huacai
> >>
> >>         if (unlikely(get_user(opcode, era) < 0)) {
> >>                 status = SIGSEGV;
> >> --
> >> 2.1.0
> >>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ