Xen 4.0.0x allows for data corruption in Dom0
A message that is not in the archive (sent off-list or not yet received): C7B7F4C4.C5D8%[email protected]
Quoted 7 lines · Keir Fraser
Quoted 4 lines · Joanna Rutkowska
It's really interesting how much control does the VM have over the data (and location) that are corrupted in Dom0 -- if it has any control, then it might allow for an interesting VM escape attack perhaps :)
Quoted 7 lines
Quoted 2 lines
Unfortunately we don't have time to investigate this problem any further in our lab.
Thanks, I'll see if I can repro with your simple setup. It's an interesting one since presumably the domU is not doing much other waiting on its rootdelay timeout when the corruption manifests. Sounds like the dom0 kernel version doesn't matter at all?
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
-- Keir
Quoted 12 lines · Keir Fraser
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Joanna Rutkowska
It's really interesting how much control does the VM have over the data (and location) that are corrupted in Dom0 -- if it has any control, then it might allow for an interesting VM escape attack perhaps :)
Unfortunately we don't have time to investigate this problem any further in our lab.
Quoted 8 lines
Quoted 4 lines
Thanks, I'll see if I can repro with your simple setup. It's an interesting one since presumably the domU is not doing much other waiting on its rootdelay timeout when the corruption manifests. Sounds like the dom0 kernel version doesn't matter at all?
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20), but I'm not able to reproduce it with the current xen/stable 2.6.32.9.
I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
-- Pasi
Quoted 9 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
K.
Quoted 6 lines · Keir Fraser
Quoted 4 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
Quoted 8 lines
Quoted 5 lines
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
It seems to happen with the latest xen/master 2.6.31.6 aswell!
-- Pasi
Quoted 11 lines · Pasi Kärkkäinen
Quoted 10 lines · Keir Fraser
Quoted 8 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?
I have some initial trouble with the idea that zero.read() in a PV domU somehow unlearned to scrub a 1M user buffer.
Thanks,
Daniel
Quoted 17 lines · Daniel Stodden
Quoted 16 lines · Pasi Kärkkäinen
Quoted 14 lines · Keir Fraser
Quoted 9 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
Quoted 8 lines
Quoted 1 line
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?
I think there might be a chance that the above executes correctly, even if we have memory corruption -- this might be e.g. because the actual "dest" buffer here would be much smaller than the fs cache buffer used when we copy onto disk. And so our small dest buffer might just not be so likely to be hit with this presumably random corruption.
Perhaps dd'ing onto /dev/shm would be a better way to check this?
joanna.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 27 lines · Joanna Rutkowska
Quoted 17 lines · Daniel Stodden
Quoted 16 lines · Pasi Kärkkäinen
Quoted 14 lines · Keir Fraser
Quoted 9 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
Quoted 8 lines
Quoted 1 line
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?
Quoted 7 lines
I think there might be a chance that the above executes correctly, even if we have memory corruption -- this might be e.g. because the actual "dest" buffer here would be much smaller than the fs cache buffer used when we copy onto disk. And so our small dest buffer might just not be so likely to be hit with this presumably random corruption.
Perhaps dd'ing onto
/dev/shmwould be a better way to check this?
I agree that a negative doesn't mean much. I'm just poking around there because the positive would have mattered: If we still get to see it, we're out of the storage discussion and can focus on memory corruption.
Daniel
Quoted 34 lines · Daniel Stodden
Quoted 33 lines · Joanna Rutkowska
Quoted 17 lines · Daniel Stodden
Quoted 16 lines · Pasi Kärkkäinen
Quoted 14 lines · Keir Fraser
Quoted 9 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
Quoted 8 lines
Quoted 1 line
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?I think there might be a chance that the above executes correctly, even if we have memory corruption -- this might be e.g. because the actual "dest" buffer here would be much smaller than the fs cache buffer used when we copy onto disk. And so our small dest buffer might just not be so likely to be hit with this presumably random corruption.
Quoted 6 lines
Quoted 1 line
Perhaps dd'ing onto
/dev/shmwould be a better way to check this?I agree that a negative doesn't mean much. I'm just poking around there because the positive would have mattered: If we still get to see it, we're out of the storage discussion and can focus on memory corruption.
If you're thinking about a potential Dom0 disk-driver problem, then I think we can rule this out. This is because I have tried this on both encrypted and non-encrypted filesystems, but the pattern of corruptions was exactly the same. If the disk driver was feeding LUKS (the crypto driver) with a wrong data, the corruptions would definitely look differently.
I also tried ext4 and ext3 filesystems, but same results.
j.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 42 lines · Joanna Rutkowska
Quoted 34 lines · Daniel Stodden
Quoted 33 lines · Joanna Rutkowska
Quoted 17 lines · Daniel Stodden
Quoted 16 lines · Pasi Kärkkäinen
Quoted 14 lines · Keir Fraser
Quoted 9 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
Quoted 8 lines
Quoted 1 line
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?I think there might be a chance that the above executes correctly, even if we have memory corruption -- this might be e.g. because the actual "dest" buffer here would be much smaller than the fs cache buffer used when we copy onto disk. And so our small dest buffer might just not be so likely to be hit with this presumably random corruption.
Quoted 6 lines
Quoted 1 line
Perhaps dd'ing onto
/dev/shmwould be a better way to check this?I agree that a negative doesn't mean much. I'm just poking around there because the positive would have mattered: If we still get to see it, we're out of the storage discussion and can focus on memory corruption.
Quoted 6 lines
If you're thinking about a potential Dom0 disk-driver problem, then I think we can rule this out. This is because I have tried this on both encrypted and non-encrypted filesystems, but the pattern of corruptions was exactly the same. If the disk driver was feeding LUKS (the crypto driver) with a wrong data, the corruptions would definitely look differently.
I'm not considering the device drivers, rather everything on top of that. Also I didn't understand the issue is present in dom0 by the time I wrote that.
Still, it'd help to figure it of the corruption came in on the way up from /dev/zero or down to the disk.
That dd crossing the page cache means it's still got a long way to go.
For now I'm most of all glad to hear it's not in the backends, so far thanks for that :o)
Daniel
Quoted 19 lines · Daniel Stodden
Quoted 11 lines · Pasi Kärkkäinen
Quoted 10 lines · Keir Fraser
Quoted 8 lines · Pasi Kärkkäinen
Quoted 3 lines
Tried a few times and no luck reproducing so far. I hope some other people on the list also will give it a go, since it's so easy to try it out.
I'm able to reproduce this with xen/master 2.6.31.6 dom0 kernel (from 2010-02-20),
but I'm not able to reproduce it with the current xen/stable 2.6.32.9.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I'll try with the most recent 2.6.31.6 dom0 kernel aswell..
Thanks Pasi!
It seems to happen with the latest xen/master 2.6.31.6 aswell!
Quoted 9 lines
Does this look to you like we're corrupting memory or on-disk storage?
E.g. does a
$ dd if=/dev/zero bs=1M | hexdump -C have the same issue?I have some initial trouble with the idea that
zero.read()in a PV domU somehow unlearned to scrub a 1M user buffer.
My setup:
Dom0 distro: Fedora 12
Xen hypervisor: 4.0.0-rc5 x86_64
Dom0 kernel: latest xen/master 2.6.31.6 x86_64
Xen hypervisor boot options in grub.conf: dom0_mem=1G loglvl=all guest_loglvl=all
Dom0 kernel boot options in grub.conf: ro root=/dev/mapper/vg_f12test-lv01 SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 KEYTABLE=fi nomodeset
Steps to reproduce the bug:
1. Reboot the system
2. Start a dummy guest using the domU kernel (rpm) provided in the original bugreport:
# xm create -c /dev/null memory=400 kernel="vmlinuz-2.6.31.9-1.2.82.xendom0.fc12.x86_64" extra="rootdelay=1000"
3. run in dom0:
# dd if=/dev/zero of=test bs=1M count=10000 && sync && sync && xxd test | grep -v "0000 0000 0000 0000 0000 0000 0000 0000" 10000+0 records in 10000+0 records out 10485760000 bytes (10 GB) copied, 233.621 s, 44.9 MB/s
6039000: 1000 0000 0000 0000 c0b0 ffff 0300 0000 ................ 6039010: 1d5e 06ab b502 0000 1eb2 27b5 ff00 0000 .^........'..... 2dfe9000:3000 0000 0000 0000 a43c 7687 0e00 0000 0........<v..... 2dfe9010:cfc1 ba64 b902 0000 1eb2 27b5 ff00 0000 ...d......'..... 50685000:4800 0000 0000 0000 f954 0f6d 1600 0000 H........T.m.... 50685010:5b1d 0230 bc02 0000 1eb2 27b5 ff00 0000 [..0......'..... 743f9000:6200 0000 0000 0000 e0e2 1ffb 1e00 0000 b............... 743f9010:acc3 e436 bf02 0000 1eb2 27b5 ff00 0000 ...6......'.....
As you can see, very easy to reproduce.
Now, I "xm destroy" the domU, run "sync" and "echo 3 > /proc/sys/vm/drop_caches" in dom0, and then re-start the dummy domU, and try the other method as requested by Daniel:
# dd if=/dev/zero bs=1M | hexdump -C 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * ^C20984+0 records in 20983+0 records out 22002270208 bytes (22 GB) copied, 206.353 s, 107 MB/s
So that method didn't show the corruption..
Now immediately after (no domU restart) let's try to reproduce again with the dd + xxd method:
# dd if=/dev/zero of=test bs=1M count=10000 && sync && sync && xxd test | grep -v "0000 0000 0000 0000 0000 0000 0000 0000" 10000+0 records in 10000+0 records out 10485760000 bytes (10 GB) copied, 258.85 s, 40.5 MB/s 7dc2000: 5a02 0000 0000 0000 760d d90c c500 0000 Z.......v....... 7dc2010: 3785 8def 8003 0000 1eb2 27b5 ff00 0000 7.........'..... 2dc0d000:7802 0000 0000 0000 ec70 d8eb ce00 0000 x........p...... 2dc0d010:6fb9 a66d 8403 0000 1eb2 27b5 ff00 0000 o..m......'.....
So it seems to be related to disk IO in dom0?
-- Pasi
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Pasi Kärkkäinen<[email protected]> 09.03.10 09:25 >>>
6039000: 1000 0000 0000 0000 c0b0 ffff 0300 0000 ................ 6039010: 1d5e 06ab b502 0000 1eb2 27b5 ff00 0000 .^........'..... 2dfe9000:3000 0000 0000 0000 a43c 7687 0e00 0000 0........<v..... 2dfe9010:cfc1 ba64 b902 0000 1eb2 27b5 ff00 0000 ...d......'..... 50685000:4800 0000 0000 0000 f954 0f6d 1600 0000 H........T.m.... 50685010:5b1d 0230 bc02 0000 1eb2 27b5 ff00 0000 [..0......'..... 743f9000:6200 0000 0000 0000 e0e2 1ffb 1e00 0000 b............... 743f9010:acc3 e436 bf02 0000 1eb2 27b5 ff00 0000 ...6......'..... ... 7dc2000: 5a02 0000 0000 0000 760d d90c c500 0000 Z.......v....... 7dc2010: 3785 8def 8003 0000 1eb2 27b5 ff00 0000 7.........'..... 2dc0d000:7802 0000 0000 0000 ec70 d8eb ce00 0000 x........p...... 2dc0d010:6fb9 a66d 8403 0000 1eb2 27b5 ff00 0000 o..m......'.....
How about these being vcpu_time_info structures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.
Jan
Quoted 6 lines
Quoted 1 line
Quoted 1 line
"Jan Beulich" <[email protected]> 09.03.10 10:37 >>>
How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.
In particular I think the update_vcpu_system_time() invocation in schedule() isn't right - VCPUOP_register_vcpu_time_memory_area taking a virtual address, this call must not happen before context_switch().
And btw., 32-on-64 also seems to be broken for VCPUOP_register_vcpu_time_memory_area (since 64-bit Xen reads the full 64-bit field).
Jan
Quoted 7 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line
"Jan Beulich" <[email protected]> 09.03.10 10:37 >>>
How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.
Quoted 8 lines
In particular I think the
update_vcpu_system_time()invocation inschedule()isn't right -VCPUOP_register_vcpu_time_memory_areataking a virtual address, this call must not happen beforecontext_switch().And btw., 32-on-64 also seems to be broken for
VCPUOP_register_vcpu_time_memory_area(since 64-bit Xen reads the full 64-bit field).
Yeah, agreed. We'll stub it out for 4.0.0 I think. Things work quite okay without it.
-- Keir
Quoted 10 lines · Jan Beulich
Quoted 4 lines
7dc2000: 5a02 0000 0000 0000 760d d90c c500 0000 Z.......v....... 7dc2010: 3785 8def 8003 0000 1eb2 27b5 ff00 0000 7.........'..... 2dc0d000:7802 0000 0000 0000 ec70 d8eb ce00 0000 x........p...... 2dc0d010:6fb9 a66d 8403 0000 1eb2 27b5 ff00 0000 o..m......'.....How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.
Pasi, can you try the attached patch (which simply stubs out the new VCPUOP_register_vcpu_time_memory_area hypercall)? I'm pretty sure this is
it: just look at the implementation of __update_vcpu_system_time: when v!=current it will write to a virtual address in v, using current's page tables. This will happen on context switch dom0->domU for example.
A quite suitable fix for 4.0.0 is to leave the hypercall stubbed out imo.
-- Keir
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Jan Beulich
Quoted 4 lines
7dc2000: 5a02 0000 0000 0000 760d d90c c500 0000 Z.......v....... 7dc2010: 3785 8def 8003 0000 1eb2 27b5 ff00 0000 7.........'..... 2dc0d000:7802 0000 0000 0000 ec70 d8eb ce00 0000 x........p...... 2dc0d010:6fb9 a66d 8403 0000 1eb2 27b5 ff00 0000 o..m......'.....
Quoted 8 lines
Quoted 5 lines
How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.Pasi, can you try the attached patch (which simply stubs out the new
VCPUOP_register_vcpu_time_memory_areahypercall)?
Yeah, but there's no patch attached ;)
-- Pasi
Quoted 10 lines · Pasi Kärkkäinen
Quoted 8 lines
Quoted 5 lines
How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.Pasi, can you try the attached patch (which simply stubs out the new
VCPUOP_register_vcpu_time_memory_areahypercall)?Yeah, but there's no patch attached ;)
Good point. Attached now!
K.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 8 lines · Keir Fraser
Quoted 6 lines · Pasi Kärkkäinen
Quoted 6 lines
Quoted 5 lines
How about these being
vcpu_time_infostructures? The fields appear to all make sense. The only thing not matching this would be a few differently looking corruption entries sent earlier by Joanna, so this may not be the only thing. But it would explain why with 3.4.2 the issue is not present.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Pasi, can you try the attached patch (which simply stubs out the new
VCPUOP_register_vcpu_time_memory_areahypercall)?Yeah, but there's no patch attached ;)
Good point. Attached now!
I grabbed the latest rc6-pre xen-unstable.hg (*), applied your patch, compiled, copied xen-4.0.0-rc6-pre.gz to /boot and booted using it. I didn't change anything else.
It seems the bug went away. No more corruption. I repeated the test three times.
-- Pasi
(*) earlier on this system I was using 4.0.0-rc5 built from src.rpm.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 09.03.10 11:15 >>>
Pasi, can you try the attached patch (which simply stubs out the new
VCPUOP_register_vcpu_time_memory_areahypercall)?
No patch attached?
Jan
Quoted 2 lines · Keir Fraser
A quite suitable fix for 4.0.0 is to leave the hypercall stubbed out imo.
Agreed.
J
Am I correct in reading between the lines that this means that Xen 4.0 will not support fast (vsyscall) gettimeofday?
Quoted 22 lines
-----Original Message-----
From: Jeremy Fitzhardinge [mailto:[email protected]]
Sent: Tuesday, March 09, 2010 4:29 PM
To: Keir Fraser
Cc: [email protected]; Joanna Rutkowska; =?ISO-8859- [email protected]; Jan Beulich; Daniel Stodden
Subject: Re: [Xen-devel] Xen 4.0.0x allows for data corruption in Dom0Quoted 1 line · Keir Fraser
A quite suitable fix for 4.0.0 is to leave the hypercall stubbed out
imo.
Quoted 1 line
Agreed.
J
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 3 lines · Dan Magenheimer
Am I correct in reading between the lines that this means that Xen 4.0 will not support fast (vsyscall) gettimeofday?
Yep, unless someone comes up with a proper fix before release.
J