Project

General

Profile

Actions

Bug #5192

closed

cpuid_pass2 incorrectly asserts when disabling xsave

Added by Robert Mustacchi about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
2014-09-23
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When bogus xsave information is encountered -- generally from a hypervisor that has disabled xsave support in a more curious way, such as on Amazon or VMware, we end up blowing an ASSERT when more than one CPU exists:

WARNING: cpu1: CPUID.0xD returns invalid value: hw_low = 0, hw_high = 0, xsave_size = 832, ymm_size = 0, ymm_offset = 0

panic[cpu1]/thread=ffffff00396aac40: assertion failed: cpu->cpu_id == 0, file: ../../i86pc/os/cpuid.c, line: 1951

Warning - stack not written to the dump buffer

ffffff00396aab40 genunix:process_type+17b920 ()
ffffff00396aabd0 unix:cpuid_pass2+726 ()
ffffff00396aac20 unix:mp_startup_common+1f8 ()
ffffff00396aac30 unix:mp_startup_boot+e ()
>> warning! 8-byte aligned %fp = ffffff00396aac28
ffffff00396aac28 0 ()
>> mis-aligned %fp = fffffffffb83985e

syncing file systems... done
skipping system dump - no dump device configured
rebooting...

Importantly here the ASSERT that we blew was asserting that our current CPU was CPU0. In particular, this is the code path that is trying to disable xsave support. However, if we have multiple CPUs, we'll always end up down this code path that is trying to disable xsave support and blow the assertion. Most folks don't normally see this as they're not using debug bits.

The fix here is straightforward, rather than ASSERTing on the CPU, we need to turn that into a branch and if we're in the CPU 0 path, we'll disable xsave support and if we're in the non-CPU0 path we need to assert that it's already been disabled.

Actions #1

Updated by Electric Monk about 7 years ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit dcf050af29bc1c6bd38ba7f173dc18bb7c5629e1

commit  dcf050af29bc1c6bd38ba7f173dc18bb7c5629e1
Author: Robert Mustacchi <rm@joyent.com>
Date:   2014-09-25T02:11:36.000Z

    5192 cpuid_pass2 incorrectly asserts when disabling xsave
    Reviewed by: Richard Lowe <richlowe@richlowe.net>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
    Approved by: Gordon Ross <gordon.ross@nexenta.com>

Actions

Also available in: Atom PDF