diff --git a/image-index.md b/image-index.md index c85fd47b8..8ee6d406c 100644 --- a/image-index.md +++ b/image-index.md @@ -67,7 +67,13 @@ For the media type(s) that this document is compatible with, see the [matrix][ma - **`features`** *array of strings* - This OPTIONAL property specifies an array of strings, each specifying a mandatory CPU feature (for example `sse4` or `aes`). + This OPTIONAL property specifies an array of strings, each specifying a mandatory CPU feature. + + When `architecture` is `386` or `amd64`, image indexes SHOULD use, and implementations SHOULD understand, values [supported by Linux][cpufeatures.h] with the `X86_FEATURE_` prefix removed and the remainder lowercased. + For example, include `vmx` (for `X86_FEATURE_VMX`) if the image contains an executable compiled to use `VMXON` and related instructions with no fallback. + On Linux on these architectures, the features supported by host CPUs can be found in the `flags` entries in the `cpuinfo` file provided by the [proc filesystem][proc.5]. + + When `architecture` is neither `386` nor `amd64`, values are implementation-defined and SHOULD be submitted to this specification for standardization. - **`annotations`** *string-string map* @@ -99,8 +105,8 @@ For the media type(s) that this document is compatible with, see the [matrix][ma "platform": { "architecture": "amd64", "os": "linux", - "os.features": [ - "sse4" + "features": [ + "fpu" ] } } @@ -112,5 +118,7 @@ For the media type(s) that this document is compatible with, see the [matrix][ma } ``` +[cpufeatures.h]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/include/asm/cpufeatures.h +[proc.5]: http://man7.org/linux/man-pages/man5/proc.5.html [runtime-platform2]: /~https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc3/config.md#platform [matrix]: media-types.md#compatibility-matrix diff --git a/schema/imageindex_test.go b/schema/imageindex_test.go index 69d1a1fa0..37d33255e 100644 --- a/schema/imageindex_test.go +++ b/schema/imageindex_test.go @@ -61,7 +61,7 @@ func TestImageIndex(t *testing.T) { "architecture": "amd64", "os": "linux", "features": [ - "sse4" + "vmx" ] } } @@ -84,7 +84,7 @@ func TestImageIndex(t *testing.T) { "architecture": "amd64", "os": "linux", "features": [ - "sse4" + "vmx" ] } } @@ -128,7 +128,7 @@ func TestImageIndex(t *testing.T) { "architecture": "amd64", "os": "linux", "features": [ - "sse4" + "vmx" ] } } @@ -152,7 +152,7 @@ func TestImageIndex(t *testing.T) { "architecture": "amd64", "os": "linux", "features": [ - "sse4" + "vmx" ] } } @@ -185,7 +185,7 @@ func TestImageIndex(t *testing.T) { "architecture": "amd64", "os": "linux", "features": [ - "sse4" + "vmx" ] } } diff --git a/specs-go/v1/index.go b/specs-go/v1/index.go index c7d56ef66..0c8a35828 100644 --- a/specs-go/v1/index.go +++ b/specs-go/v1/index.go @@ -38,7 +38,7 @@ type Platform struct { Variant string `json:"variant,omitempty"` // Features is an optional field specifying an array of strings, each - // listing a required CPU feature (for example `sse4` or `aes`). + // listing a required CPU feature. Features []string `json:"features,omitempty"` }