On Wed, Jan 18, 2023 at 01:09:49AM +0000, Sean Christopherson wrote:
On Mon, Dec 05, 2022, Vishal Annapurve wrote:
This series implements selftests targeting the feature floated by Chao via: https://lore.kernel.org/lkml/20221202061347.1070246-10-chao.p.peng@linux.int...
Below changes aim to test the fd based approach for guest private memory in context of normal (non-confidential) VMs executing on non-confidential platforms.
private_mem_test.c file adds selftest to access private memory from the guest via private/shared accesses and checking if the contents can be leaked to/accessed by vmm via shared memory view before/after conversions.
Updates in V2:
- Simplified vcpu run loop implementation API
- Removed VM creation logic from private mem library
I pushed a rework version of this series to:
git@github.com:sean-jc/linux.git x86/upm_base_support
It still has build issue with lockdep enabled that I mentioned before:
https://lore.kernel.org/all/20230116134845.vboraky2nd56szos@box.shutemov.nam...
And when compiled with lockdep, it triggers a lot of warnings about missed locks, like this:
[ 59.632024] kvm: FIXME: Walk the memory attributes of the slot and set the mixed status appropriately [ 59.684888] ------------[ cut here ]------------ [ 59.690677] WARNING: CPU: 2 PID: 138 at include/linux/kvm_host.h:2307 kvm_mmu_do_page_fault+0x19a/0x1b0 [ 59.693531] CPU: 2 PID: 138 Comm: private_mem_con Not tainted 6.1.0-rc4-00624-g7e536bf3c45c-dirty #1 [ 59.696265] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 [ 59.699586] RIP: 0010:kvm_mmu_do_page_fault+0x19a/0x1b0 [ 59.700720] Code: d8 1c 00 00 eb e3 65 48 8b 0c 25 28 00 00 00 48 3b 4c 24 50 75 1b 48 83 c4 58 5b 41 5e 41 5f 5d c3 48 81 c0 [ 59.704711] RSP: 0018:ffffc90000323c80 EFLAGS: 00010246 [ 59.705830] RAX: 0000000000000000 RBX: ffff888103bc8000 RCX: ffffffff8107dff0 [ 59.707353] RDX: 0000000000000001 RSI: ffffffff82549d49 RDI: ffffffff825abe77 [ 59.708865] RBP: ffffc90000e59000 R08: 0000000000000000 R09: 0000000000000000 [ 59.710369] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 59.711859] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000180 [ 59.713338] FS: 00007f2e556de740(0000) GS:ffff8881f9d00000(0000) knlGS:0000000000000000 [ 59.714978] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 59.716168] CR2: 0000000000000000 CR3: 0000000100e90005 CR4: 0000000000372ee0 [ 59.717631] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 59.719086] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 59.721148] Call Trace: [ 59.722661] <TASK> [ 59.723986] ? lock_is_held_type+0xdb/0x150 [ 59.726501] kvm_mmu_page_fault+0x41/0x170 [ 59.728946] vmx_handle_exit+0x343/0x750 [ 59.731007] kvm_arch_vcpu_ioctl_run+0x1d12/0x2790 [ 59.733319] kvm_vcpu_ioctl+0x4a6/0x590 [ 59.735195] __se_sys_ioctl+0x6a/0xb0 [ 59.736976] do_syscall_64+0x3d/0x80 [ 59.738698] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 59.740743] RIP: 0033:0x7f2e557d8f6b [ 59.741907] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 c7 04 24 10 00 00 00 b0 [ 59.747836] RSP: 002b:00007ffe8b84eb50 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 59.750147] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f2e557d8f6b [ 59.751754] RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000007 [ 59.753361] RBP: 000000000042f880 R08: 0000000000000007 R09: 0000000000430210 [ 59.754952] R10: ca7f9f3d969d5d5c R11: 0000000000000246 R12: 000000000042d2a0 [ 59.756596] R13: 0000000100000000 R14: 0000000000422e00 R15: 00007f2e558f7000 [ 59.758231] </TASK> [ 59.758752] irq event stamp: 8637 [ 59.759540] hardirqs last enabled at (8647): [<ffffffff8119ae18>] __up_console_sem+0x68/0x90 [ 59.761309] hardirqs last disabled at (8654): [<ffffffff8119adfd>] __up_console_sem+0x4d/0x90 [ 59.763022] softirqs last enabled at (8550): [<ffffffff81123c7a>] __irq_exit_rcu+0xaa/0x130 [ 59.764731] softirqs last disabled at (8539): [<ffffffff81123c7a>] __irq_exit_rcu+0xaa/0x130 [ 59.766409] ---[ end trace 0000000000000000 ]---