Giter Club home page Giter Club logo

Comments (9)

tandasat avatar tandasat commented on May 20, 2024 2

You are very welcome. I do not provide a dedicated place for Q&A and non-issue discussions for my projects, but feel free to ask questions if you struggle to make sense of things. I publish my projects to help anyone learn.

from minivisorpkg.

tandasat avatar tandasat commented on May 20, 2024 1

why am I only seeing 8B & no other write/read msrs.

It is because the MSR bitmap is used to specify other MSRs should not cause VM-exit. Search InitializeMsrBitmaps in the code base, and read 24.6.9 MSR-Bitmap Address for more details.

If you wonder "why I do/do not get VM-exit", I suggest looking up 25.1.3 Instructions That Cause VM Exits Conditionally too.

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

Yep, __readmsr not handling either.

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

To test, I handle common exception, and put

           LOG_INFO("__readmsr: %d", __readmsr((IA32_MSR_ADDRESS)IA32_GS_BASE));

result is 0, if that helps regardless, at this point, system is in KeInitAmd64SpecificState(). so vmexit is working, as the handle exception was called, because i see that log output. but i don't see this readmsr handled, or any other read/write msr calls handled in the HandleMsrAccess fn.

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

Nevermind, __readmsr/__writemsr are triggering just fine. I just didn't realize because none of the other MSRs were processing...

This is the code that matters in HandleMsrAccess:

static
VOID
HandleMsrAccess(
    _Inout_ GUEST_CONTEXT* GuestContext,
    _In_ OPERATION_TYPE OperationType
)
{
    IA32_MSR_ADDRESS msr;
    UINT64 value;

    msr = (IA32_MSR_ADDRESS)GuestContext->StackBasedRegisters->Rcx;
    LOG_INFO("[msr] %s >> %02X", (OperationType == OperationRead) ? "__readmsr" : "__writemsr", (unsigned long)msr);

Where the only log that ever is displayed over serial is: [msr] __readmsr >> 8B

Interestingly, that is the IA32_BIOS_UPDATE_SIGNATURE, which is left default from the github code where it sets value = MAXUINT64

No other msr are being written/read, only 8B.

Now, for the most unusual thing, if I call __readmsr like this:
LOG_INFO("__readmsr: %d", __readmsr((IA32_MSR_ADDRESS)IA32_GS_BASE));
I still see:
[msr] __readmsr >> 8B

which is clearly wrong.

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

Actually calling __readmsr at host level like I did to "test" shouldn't trigger a VM exit because we're already at host level... so ignore that. The issue still stands though, why am I only seeing 8B & no other write/read msrs.

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

OK, yeah I see it. Thank you Satoshi, you're always extremely helpful.

Love this project so far, I'm using it to get into HV development. It's so well commented it's insane. So I really appreciate that. Thanks!

from minivisorpkg.

nicholasdkunes avatar nicholasdkunes commented on May 20, 2024

@tandasat thank you. if I do have questions, where would you like them? As a new, individual issue to help other users in the future, or just one thread?

Regarding VMExits, from my understanding of reading the manual so far for Intel VT-x, there are times when the guest VM must exit the VM because of certain execution, and have the host (MiniVisor) execute that code for them on hardware. Is this the correct way of looking at it?

--edited out question as i solved this on my own--

from minivisorpkg.

nadiaivc avatar nadiaivc commented on May 20, 2024

You are very welcome. I do not provide a dedicated place for Q&A and non-issue discussions for my projects, but feel free to ask questions if you struggle to make sense of things. I publish my projects to help anyone learn.

You are doing very important things. Thank you very much for that!

from minivisorpkg.

Related Issues (14)

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.