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]
Message-ID: <20150521133847.GC3689@pd.tnic>
Date:	Thu, 21 May 2015 15:38:47 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Prarit Bhargava <prarit@...hat.com>
Cc:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Andy Lutomirski <luto@...capital.net>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Igor Mammedov <imammedo@...hat.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	Brian Gerst <brgerst@...il.com>
Subject: Re: [PATCH] x86/cpu: Strip leading and trailing spaces from the
 /proc/cpuinfo CPU model field

On Wed, May 20, 2015 at 07:36:54AM -0400, Prarit Bhargava wrote:
> When comparing 'model name' fields in /proc/cpuinfo it was noticed that
> a simple test comparing the model name fields was failing.  After some
> quick investigation it was noticed that the model name fields were actually
> different -- processor 0's model name field had trailing white space removed,
> while the other processors did not.
> 
> Another way of seeing this behaviour is to convert spaces into underscores
> in the output of /proc/cpuinfo,
> 
> [thetango@...rit ~]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> ______1_model_name      :_AMD_Opteron(TM)_Processor_6272
> _____63_model_name      :_AMD_Opteron(TM)_Processor_6272_________________
> 
> which shows two different model name fields even though they should be the
> same.
> 
> This occurs because the kernel calls strim() on cpu 0's x86_model_id field
> to output a pretty message to the console in print_cpu_info(), and as a
> result truncates the whitespace at the end of the x86_model_id field.
> 
> The x86_model_id field should be the same for the same processors.  This
> patch uses string functions to remove both leading and trailing whitespace
> in the x86_model_id field.  As a result the print_cpu_info() output looks
> like
> 
> smpboot: CPU0: AMD Opteron(TM) Processor 6272 (fam: 15, model: 01, stepping: 02)
> 
> and the x86_model_id field is correct on all processors on AMD platforms
> 
> [thetango@...rit ~]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> _____64_model_name      :_AMD_Opteron(TM)_Processor_6272
> 
> and the functionality is correct on an Intel box:
> 
> [thetango@...rit2]# grep "^model name" /proc/cpuinfo | uniq -c | sed 's/\ /_/g'
> ____144_model_name      :_Intel(R)_Xeon(R)_CPU_E7-8890_v3_@...50GHz
> 
> [v2]: use memmove and update patch subject
> 
> Signed-off-by: Prarit Bhargava <prarit@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: x86@...nel.org
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Denys Vlasenko <dvlasenk@...hat.com>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Igor Mammedov <imammedo@...hat.com>
> Cc: Fenghua Yu <fenghua.yu@...el.com>
> Cc: Brian Gerst <brgerst@...il.com>
> ---
>  arch/x86/kernel/cpu/common.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ