Skip to contentSkip to conversation

New: reading segmented memory in kvm

Bug 197381 [email protected] 1 participant 1 message Oct 25, 2017 KVM

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=197381

            Bug ID: 197381
           Summary: reading segmented memory in kvm
           Product: Virtualization
           Version: unspecified
    Kernel Version: 4.9.0
          Hardware: i386
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: kvm
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

I am trying to get the "current" pointer of a running thread. The "current" resides in a per_cpu segment and translates to gs:current_task. I have added the following code to emulate.c at em_syscall() calling segmented_read():

{
    int rc;
    struct segmented_address addr;
    u64 *ptr;
    addr.ea = 0xd380;
    addr.seg = VCPU_SREG_GS;
    rc = segmented_read(ctxt, addr, &ptr, sizeof(ptr));

    printk("%s::%s - cr3 %p rc=%d ptr:%p\n",
            __BASE_FILE__, __func__,
            (void *)vcpu->nitro.event.sregs.cr3,
            rc, ptr);
}

in the log I see:

[49478.575263] arch/x86/kvm/emulate.c::em_syscall - cr3 000000007aaa2000 rc=2

ptr:0000000000000004

which implies that the segmented read failed. is there something else that needs to be done? alternatively, is there a way to get the "current" pointer?

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.