gramineproject / graphene

Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
https://grapheneproject.io
GNU Lesser General Public License v3.0
771 stars 260 forks source link

[Pal/Linux-SGX] Add handling for all reserved and unrecognized CPUID leaves #2440

Closed dimakuv closed 3 years ago

dimakuv commented 3 years ago

Description of the changes

Previously, Linux-SGX PAL failed on all CPUID leaves not mentioned in our internal CPUID table. This is not how the actual Intel CPUID instruction behaves: some CPUID leaves are explicitly reserved and always return zeros, and the rest CPUID leaves return the info as if they are the "highest basic information leaf".

This PR adds such handling to make our CPUID logic exactly the same as in the latest Intel SDM documentation.

Fixes #2439 .

How to test this PR?

Added more testing to the cpuid LibOS regression test.


This change is Reviewable