Skip to content

Guest kernel uses ring-0 interrupts #62

@chc4

Description

@chc4

In https://info.varnish-software.com/blog/tinykvm-the-fastest-sandbox it says:

We also enter in usermode and try to avoid kernel mode except where impossible. Did you know that you can handle CPU exceptions in usermode on x86?

However, tinykvm doesn't seem to actually do this.

set_entry(idt.entry[vec], handler, 0x8, IDT_PRESENT | IDT_CPL0 | IDT_GATE_INTR);
only sets up a single IDT gate which runs at ring-0 (CPL0), and with ring-0 segment selectors.

I am using tinykvm for a side project which wants specifically ring-3 -> ring-3 interrupts for speed reasons, and so this behavior was surprising to me. I was able to add a second CPL3 gate, along with another usermode accessible mapping of the kernel interrupt code and usermode accessible interrupt stack, fairly easily so this isn't a blocker, but I wasn't sure if this was unintentional behavior or a design decision which has changed since the block post was written.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions