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: <f5387b72-0c2d-0603-b630-2aca25d16ccb@linux.intel.com>
Date:   Wed, 20 Sep 2017 08:54:33 -0700
From:   Dave Hansen <dave.hansen@...ux.intel.com>
To:     Eric Biggers <ebiggers3@...il.com>, x86@...nel.org
Cc:     linux-kernel@...r.kernel.org, kernel-hardening@...ts.openwall.com,
        Andy Lutomirski <luto@...nel.org>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Ingo Molnar <mingo@...nel.org>, Kevin Hao <haokexin@...il.com>,
        Oleg Nesterov <oleg@...hat.com>,
        Wanpeng Li <wanpeng.li@...mail.com>,
        Yu-cheng Yu <yu-cheng.yu@...el.com>,
        Michael Halcrow <mhalcrow@...gle.com>,
        Eric Biggers <ebiggers@...gle.com>
Subject: Re: [PATCH v2 2/3] x86/fpu: tighten validation of user-supplied
 xstate_header

On 09/19/2017 05:44 PM, Eric Biggers wrote:
> +static inline int validate_xstate_header(const struct xstate_header *hdr)
> +{
> +	/* No unknown or supervisor features may be set */
> +	if (hdr->xfeatures & (~xfeatures_mask | XFEATURE_MASK_SUPERVISOR))
> +		return -EINVAL;
> +
> +	/* Userspace must use the uncompacted format */
> +	if (hdr->xcomp_bv)
> +		return -EINVAL;
> +
> +	/* No reserved bits may be set */
> +	if (memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved)))
> +		return -EINVAL;
> +
> +	return 0;
> +}

BTW, the whole series looks pretty sane to me.  Tou're definitely
leaving the code better than you found it.  Feel free to add my acked-by
on all 3 patches.

One nit about this validate function, though.  Let's say we go and
change 'struct xstate_header' and shrink ->reserved because we add a new
field.  This validator will silently break.

Could we add a

	BUILD_BUG_ON(sizeof(hdr->reserved) != 48);

That way, the next hapless kernel developer can't miss updating this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ