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: <20140917150433.GC1273@potion.brq.redhat.com>
Date:	Wed, 17 Sep 2014 17:04:33 +0200
From:	Radim Krčmář <rkrcmar@...hat.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	Nadav Amit <namit@...technion.ac.il>,
	Ingo Molnar <mingo@...nel.org>,
	Paolo Bonzini <pbonzini@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	the arch/x86 maintainers <x86@...nel.org>,
	kvm <kvm@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [RESEND PATCH 1/3] x86: Adding structs to reflect cpuid fields

2014-09-17 16:06+0200, Borislav Petkov:
> On Wed, Sep 17, 2014 at 04:53:39PM +0300, Nadav Amit wrote:
> > AFAIK backward compatibility is usually maintained in x86. I did not
> > see in Intel SDM anything that says "this CPUID field means something
> > for CPU X and something else for CPU Y". Anyhow, it is not different
> > than bitmasks in this respect.
> 
> You still don't get my point: what are you going to do when
> min_monitor_line_size needs to be 17 bits all of a sudden?
> 
> Currently, you simply do an if-else check before using the respective
> mask and with your defined structs, you need to keep two versions:
> 
> union cpuid5_ebx_before_family_X {
>        struct {
>                unsigned int max_monitor_line_size:16;
>                unsigned int reserved:16;
>        } split;
>        unsigned int full;
> };
> 
> union cpuid5_ebx_after_family_X {
>        struct {
>                unsigned int max_monitor_line_size:17;
>                unsigned int reserved:15;
>        } split;
>        unsigned int full;
> };

New union wouldn't be very convenient if the change touched just a small
part of the register ... probably the best choice is using anonymous
elements like this,

  union cpuid5_ebx {
  	union {
  		struct {
  			unsigned int max_monitor_line_size:16;
  			unsigned int reserved:16;
  		};
  		struct {
  			unsigned int max_monitor_line_size_after_family_X:17;
  			unsigned int reserved_after_family_X:15;
  		};
  	} split;
  	unsigned int full;
  };

which would result in a similar if-else hack

  if (family > X)
  	ebx.split.max_monitor_line_size_after_family_X = 0
  else
  	ebx.split.max_monitor_line_size = 0

other options are
  ebx.split.after_family_X.max_monitor_line_size
or even
  ebx.split.max_monitor_line_size.after_family_X

Flat namespace is more flexible wrt. code.
--
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