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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR1201MB013604A65801D2028225B20BDEAD0@CY4PR1201MB0136.namprd12.prod.outlook.com>
Date:   Wed, 29 Apr 2020 17:12:54 +0000
From:   Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>
To:     Vineet Gupta <Vineet.Gupta1@...opsys.com>
CC:     Alexey Brodkin <Alexey.Brodkin@...opsys.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-snps-arc@...ts.infradead.org" 
        <linux-snps-arc@...ts.infradead.org>
Subject: Re: [PATCH] ARC: guard dsp early init against non ARCv2

Hi Vineet, 

> From: Vineet Gupta <vgupta@...opsys.com>
> Sent: Tuesday, April 28, 2020 22:46
> To: Eugeniy Paltsev; linux-snps-arc@...ts.infradead.org
> Cc: Alexey Brodkin; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH] ARC: guard dsp early init against non ARCv2
> 
> On 4/28/20 11:50 AM, Eugeniy Paltsev wrote:
> > As of today we guard early DSP init code with
> > ARC_AUX_DSP_BUILD (0x7A) BCR check to verify that we have
> > CPU with DSP configured. However that's not enough as in
> > ARCv1 CPU the same BCR (0x7A) is used for checking MUL/MAC
> > instructions presence.
> >
> > So, let's guard DSP early init against non ARCv2.
> >
> > Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@...opsys.com>
> > ---
> >  arch/arc/include/asm/dsp-impl.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arc/include/asm/dsp-impl.h b/arch/arc/include/asm/dsp-impl.h
> > index e1aa212ca6eb..e64d945ae7df 100644
> > --- a/arch/arc/include/asm/dsp-impl.h
> > +++ b/arch/arc/include/asm/dsp-impl.h
> > @@ -15,12 +15,14 @@
> >
> >  /* clobbers r5 register */
> >  .macro DSP_EARLY_INIT
> > +#if defined(CONFIG_ISA_ARCV2)
> 
> ifdef is the canonical way for a single macro to check.
> 
> Also, this needs to be finer grained, i.e. CONFIG_ARC_DSP_KERNEL which is already
> tied to ARCV2 only configs.

We shouldn't limit the scope of this code part [dsp early init] to the cases
were DSP support is enabled in kconfig - and that is the reason why this code
initially was guarded with BCR check only.

So, I change the check to

#if defined(CONFIG_ARC_DSP_HANDLED) || defined(CONFIG_ARC_DSP_NONE)

which is actually the equivalent to

#if defined(CONFIG_ISA_ARCV2)

but I don't think it's worth thing to do.

> 
> >       lr      r5, [ARC_AUX_DSP_BUILD]
> >       bmsk    r5, r5, 7
> >       breq    r5, 0, 1f
> >       mov     r5, DSP_CTRL_DISABLED_ALL
> >       sr      r5, [ARC_AUX_DSP_CTRL]
> >  1:
> > +#endif
> >  .endm
> >
> >  /* clobbers r10, r11 registers pair */

---
 Eugeniy Paltsev

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ