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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCIB3nZSUTBXr80O@google.com>
Date: Mon, 12 May 2025 07:13:08 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Chao Gao <chao.gao@...el.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org, 
	tglx@...utronix.de, dave.hansen@...el.com, pbonzini@...hat.com, 
	peterz@...radead.org, rick.p.edgecombe@...el.com, weijiang.yang@...el.com, 
	john.allen@....com, bp@...en8.de, chang.seok.bae@...el.com, xin3.li@...el.com, 
	Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, 
	"H. Peter Anvin" <hpa@...or.com>, Eric Biggers <ebiggers@...gle.com>, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH v7 3/6] x86/fpu: Initialize guest fpstate and FPU pseudo
 container from guest defaults

On Mon, May 12, 2025, Chao Gao wrote:
> @@ -535,10 +538,20 @@ void fpstate_init_user(struct fpstate *fpstate)
>  
>  static void __fpstate_reset(struct fpstate *fpstate, u64 xfd)
>  {
> -	/* Initialize sizes and feature masks */
> -	fpstate->size		= fpu_kernel_cfg.default_size;
> +	/*
> +	 * Initialize sizes and feature masks. Supervisor features and
> +	 * sizes may diverge between guest FPUs and host FPUs, whereas
> +	 * user features and sizes are always identical the same.

Pick of of "identical" or "the same" :-)

And maybe explain why supervisor features can diverge, while the kernel ensures
user features are identical?  Ditto for the XFD divergence.  E.g. I think this
would be accurate (though I may be reading too much into user features):

	/*
	 * Supervisor features (and thus sizes) may diverge between guest FPUs
	 * and host FPUs, as some supervisor features are supported for guests
	 * despite not being utilized by the host.  User features and sizes are
	 * always identical, which allows for common guest and userspace ABI.
	 *
	 * For the host, set XFD to the kernel's desired initialization value.
	 * For guests, set XFD to its architectural RESET value.
	 */

> +	 */
> +	if (fpstate->is_guest) {
> +		fpstate->size		= guest_default_cfg.size;
> +		fpstate->xfeatures	= guest_default_cfg.features;
> +	} else {
> +		fpstate->size		= fpu_kernel_cfg.default_size;
> +		fpstate->xfeatures	= fpu_kernel_cfg.default_features;
> +	}
> +
>  	fpstate->user_size	= fpu_user_cfg.default_size;
> -	fpstate->xfeatures	= fpu_kernel_cfg.default_features;
>  	fpstate->user_xfeatures	= fpu_user_cfg.default_features;
>  	fpstate->xfd		= xfd;
>  }
> -- 
> 2.47.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ