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: <20210119091116.GA27433@zn.tnic>
Date:   Tue, 19 Jan 2021 10:11:16 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     Feng Tang <feng.tang@...el.com>
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 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.

-- 
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