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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 14 Aug 2019 09:52:10 +0800
From:   Vincent Chen <vincent.chen@...ive.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        linux-riscv <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] riscv: Correct the initialized flow of FP register

On Mon, Aug 12, 2019 at 10:58 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> > +static inline void fstate_off(struct task_struct *task,
> > +                            struct pt_regs *regs)
> > +{
> > +     regs->sstatus = (regs->sstatus & ~(SR_FS)) | SR_FS_OFF;
>
> No need for the inner braces here.

Ok.

>
> > +}
> > +
> >  static inline void fstate_save(struct task_struct *task,
> >                              struct pt_regs *regs)
> >  {
> > diff --git a/arch/riscv/kernel/process.c b/arch/riscv/kernel/process.c
> > index f23794b..e3077ee 100644
> > --- a/arch/riscv/kernel/process.c
> > +++ b/arch/riscv/kernel/process.c
> > @@ -64,8 +64,16 @@ void start_thread(struct pt_regs *regs, unsigned long pc,
> >       unsigned long sp)
> >  {
> >       regs->sstatus = SR_SPIE;
> > -     if (has_fpu)
> > +     if (has_fpu) {
> >               regs->sstatus |= SR_FS_INITIAL;
> > +#ifdef CONFIG_FPU
> > +             /*
> > +              * Restore the initial value to the FP register
> > +              * before starting the user program.
> > +              */
> > +             fstate_restore(current, regs);
> > +#endif
>
> fstate_restore has a no-op stub for the !CONFIG_FPU case, so the ifdef
> here is not needed.
>
You are right. I will remove the Ifdef condition.

> Otherwise this looks good to me:
>
> Reviewed-by: Christoph Hellwig <hch@....de>

Thanks for your comments.

Regards,
Vincent Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ