Giter VIP home page Giter VIP logo

igvm's Introduction

igvm

crates.io docs.rs crates.io docs.rs

This project is the home of the Independent Guest Virtual Machine (IGVM) file format. The format specification can be found in the igvm_defs crate, with a Rust implementation of the binary format in the igvm crate.

The IGVM file format is designed to encapsulate all information required to launch a virtual machine on any given virtualization stack, with support for different isolation technologies such as AMD SEV-SNP and Intel TDX.

At a conceptual level, this file format is a set of commands created by the tool that generated the file, used by the loader to construct the initial guest state. The file format also contains measurement information that the underlying platform will use to confirm that the file was loaded correctly and signed by the appropriate authorities.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

igvm's People

Contributors

00xc avatar chris-oo avatar griffinstamp-msft avatar jinankjain avatar liuw avatar msft-jlange avatar osteffenrh avatar roy-hopkins avatar stefano-garzarella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

igvm's Issues

Clean up igvm_defs doc comments

Lets be consistent and have doc comments start with a capital letter and end with a period. Which also, matches the styling used by the official rust docs.

Add a C api for igvm

For non-Rust consumers it would be nice to have a C API for the parser. This can be gated behind a feature.

Current thoughts consist of perhaps having a to_c_struct function that would provide the igvm_defs C struct along with a void* of available filedata, along with iteration functions on IgvmFile to move forward/backwards thru different structures.

specification for page data structures with file offset of 0 are incorrect

The specification states that for page data structures with file offset zero are measured with hardware zero pages if possible:

If the file offset is zero, then a page of zeroes is to be loaded. If the page contents are to be measured, and the underlying platform supports measured zero pages as a native page type, then the loader must request this page type; otherwise, the loader must generate a page of zeroes to load as the page contents.

However, this is incorrect. These pages should be treated as normal private pages with contents of zero. A future page type will be required for specifying hardware zero pages, on platforms that support it.

open_enum doesn't respect cfg(feature) because of emitted debug impl

Gating say an enum variant behind the unstable feature causes open_enum to gate the derived enum correctly, but not the debug impl. This blocks us from having nice intra-doc links because it's quite annoying to then gate any doclink comments in that enum variant.

For example:

#[open_enum]
#[derive(AsBytes, FromBytes, FromZeroes, Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u32)]
pub enum IgvmVariableHeaderType {
    ....
    #[cfg(feature = "unstable")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
    IGVM_VHT_MEMORY_STATE_PARAMETER = 0x313,
}

becomes

    #[cfg(feature = "unstable")]
    #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
    pub const IGVM_VHT_MEMORY_STATE_PARAMETER: IgvmVariableHeaderType = IgvmVariableHeaderType(787);
    ....
impl ::core::fmt::Debug for IgvmVariableHeaderType {
    fn fmt(&self, fmt: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        #![allow(unreachable_patterns)]
        let s = match *self {
        ....    
            Self::IGVM_VHT_DEVICE_TREE => stringify!(IGVM_VHT_DEVICE_TREE),
            Self::IGVM_VHT_MEMORY_STATE_PARAMETER => stringify!(IGVM_VHT_MEMORY_STATE_PARAMETER),
        ....

which doesn't compile because the type must also be cfg(feature) attr-ed in the emitted debug impl

Redefine the "INVALID" platform type to Native

There's some scenarios where you'd want to use IGVM to launch a non-isolated guest. This is to allow a consistent launch packaging format to decouple loader code from the rest of the virtual machine manager (VMM). Today, the platform types don't have a good way to express this; there only exist types for isolated guests such as Hyper-V's VSM, AMD's SEV-SNP, etc.

This proposal is to rename the INVALID type to a Native type. This would mean that the VMM is free to load the data described by the IGVM file in any way it sees fit. There would be no measurement support since this is not the launch of an isolated VM. The key point here is that the platform type described by the IGVM file defines the load primitives used to bring the VM to life. Should it be loaded via the TDX module, or via the PSP, or natively into the VMM's infrastructure? It doesn't make any promise about what the VMM is willing to do to support the guest, because that can be determined at runtime.

Note that this does not mean Native IGVM files are not cross compatible between different VMMs. A guest may need to make sure that headers used support the least common denominator (and of course being able to run with potentially different VMM host interfaces), but already information about the guest is surfaced via runtime provided parameters, with many headers being applicable to non-isolated guests.

One point of discussion is initial launch context of VPs, especially the BSP. One proposal is to continue to allow the VSM definition where register state is provided by key/value pairs. If no VP context structure is specified, then the BSP will be placed into the architectural reset state.

Alternatively we could only support the architectural reset state. However, I think having the flexibility to allow an IGVM file to launch in the non-architectural state is required, for launch performance (run directly the entry point of a guest, rather than going thru different transitions) and flexibility.

Add flags for memory structures

Add flags for memory structures along with adding a flags type for device tree. This allows specifying memory ranges as shared along with other options in the future.

Additionally, update the device tree nodes with a flags field.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.