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]
Date:   Tue, 19 Jan 2021 20:56:39 +0800
From:   Feng Tang <feng.tang@...el.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Dave Hansen <dave.hansen@...el.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, nivedita@...m.mit.edu,
        thomas.lendacky@....com, yazen.ghannam@....com, wei.huang2@....com
Subject: Re: [PATCH v4] tools/x86: Add a kcpuid tool to show raw CPU features

On Tue, Jan 19, 2021 at 10:11:16AM +0100, Borislav Petkov wrote:
> On Tue, Jan 19, 2021 at 01:19:42PM +0800, Feng Tang wrote:
> > Sorry, after testing on more platforms, the following is needed to fix
> > a potential array overflow ((a full patch with fix is also attached)
> > 
> > diff --git a/tools/arch/x86/kcpuid/kcpuid.c b/tools/arch/x86/kcpuid/kcpuid.c
> > index 3ea607b..bf68335 100644
> > --- a/tools/arch/x86/kcpuid/kcpuid.c
> > +++ b/tools/arch/x86/kcpuid/kcpuid.c
> > @@ -329,7 +329,8 @@ static int parse_line(char *line)
> >  		range = leafs_basic;
> >  
> >  	index &= 0x7FFFFFFF;
> > -	if ((int)index > range->nr)
> > +	/* range->nr equals to max index plus 1 */
> > +	if ((int)index >= range->nr)
> 
> That comment is basically repeating the code. What it should do is
> explain *why* that test is being done or not be there at all.
 
Right! So this is better?
/* Skip line parsing for non-existing indexes */ 

Thanks,
Feng

> -- 
> Regards/Gruss,
>     Boris.
> 
> https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ