-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PT initialization fails when mapping PT buffer #19
Comments
That happens if you didn't start the parent VM with the pt buffer size specified (ie |
I have that line in the .cfg file used when creating the domain. I installed the OS earlier without that setting though, can that be a problem? Does the position of this line matter in the config? When calling
|
No, you only need to add that when you need it, it's not exposed to the guest. It doesn't matter where in the config you have it either. The only time I ran into that was when I booted the VM without the option set. There is a tool in the Xen folder in |
Same result with
Is there maybe some BIOS setting I have to activate for PT (I had to manually enable VT-x for example)? Here's how one of my cores looks (running on bare hw):
|
Does |
will look tomorrow |
@tklengyel I think you are missing Andrew Cooper's acquire_resource patches, could you rebase It contains a whole lot of patches from Andrew that are fixing things around acquire_resource in particular. |
I tried the ipt-patch-v7s tag, but no luck :( I see this in
I'm attaching the full dmesg log: |
OK, I just realized, that my kernel doesn't have PT support somehow (/sys/devices/intel_pt doesn't exists). I don't have a clue what can cause this, but I keep digging, and close this issue for now. |
After a kernel upgrade I can use PT with bare metal:
dom0:
|
I think this is normal. Xen masks some features in such way that they couldn't be normally used. |
I think you've ran into some bug around acquire_resource. I will look at this soon. |
I added some debug strings:
Got this when creating the domain:
So it seems |
The ioctl is handled by the |
Full-spectrum printk()'s show that the
I noticed the unimplemented MSR's before, but they looked to be related to energy consumption sensors (the current list is longer than I remember though). I see MSR_RTIT_CTL referenced by |
So it seems your hardware is fine and PT gets setup correctly. Just have to figure out why mapping the pt buffer into dom0 fails for you. The XENMEM_resource_vmtrace_buf hypercall should eventually reach http://xenbits.xen.org/gitweb/?p=people/tklengyel/xen.git;a=blob;f=xen/common/memory.c;h=c0a22eb60f698b1a1dc45027adf7b3a5ed73a1d2;hb=refs/heads/ptcov2#l1010. Can you check if that's reached and what it returns? |
Interestingly I don't see |
Never mind, found it, it's at http://xenbits.xen.org/gitweb/?p=people/tklengyel/xen.git;a=blob;f=tools/libs/foreignmemory/linux.c;h=8daa5828e3da2f1d0dee158ff91e8ba2274a4625;hb=refs/heads/ptcov2#l328. So yea, let's check what the hypervisor is doing when this request reaches it, I doubt the issue would be on the linux kernel module side that handles the ioctl. |
Sorry for not looking at it, backlog overflow. Maybe this is hitting some blacklist/whitelist on the Xen side? I've already seen such thing twice, there are some code pieces that are performing numerous sanity checks. |
I'm still debugging this, but so far I wasn't able to trigger any gdprintk's in or on the way to Meanwhile can you tell me which kernel modules I should see in dom0? I can see some loading failures during boot, but I don't know what exactly is failing yet (systemd ftw!). Here's what I see:
|
I found that
Interestingly, the number of debug messages doesn't grow as I run the Any tips/help on this is appreciated! |
The ones you have look fine, really just the default list, no special kernel module is needed.
That's certainly a weird observation. That would mean the map resource from the dom0 userpsace never actually reaches Xen O.o |
@v-p-b I would certainly suggest trying it on another machine as well as this issue hasn't popped up on anything I tried so far. |
I don't have a spare machine that supports PT unfortunately :( Can you give me some high level description/pointers about how memory operations should reach Xen, so I can narrow down where the signal gets lost? |
OK, this is a bit embarrassing: a quick chat with @tklengyel revealed that I was using an outdated/unsupported Ubuntu version, where the kernel didn't have support for IOCTL_PRIVCMD_MMAP_RESOURCE. Upgrading to 20.04 (5.4 kernel) resolved the issue. |
xenforeignmemory_map_resource
fails (returns 0) when initializing PT:https://github.com/intel/kernel-fuzzer-for-xen-project/blob/master/src/ptcov.c#L113
Any tips on what can be the cause / how to debug this?
The text was updated successfully, but these errors were encountered: