Re: vmm(4): cpuid leaf 0x15 fixes clock speed problem in Linux guest [PATCH]

2020-12-05 Thread Pratik Vyas
* Jozef Hatala [2020-11-29 00:32:17 -0800]: On Sun, Nov 29, 2020 at 12:04:04AM -0800, I wrote: On Sun, Nov 29, 2020 at 06:36:17AM +, Mike wrote: > And what are you going to return for the other leaf nodes now that > you are claiming a CPUID level of 0x15, on CPUs that are less than >

Re: vmd(8) and thread safety: a quick proof of concept using libevent 2.1 from ports

2020-05-25 Thread Pratik Vyas
* Claudio Jeker [2020-05-25 10:14:11 +0200]: > The problem is that the vm exit is handled by a different thread then the > event loop. So some event_add/evtimer_add calls are done from a different > thread then the main event loop (mainly interrupt processing). > > One approach to fix this is

Re: vmm timer for linux guests

2020-05-22 Thread Pratik Vyas
* Renato Aguiar [2020-05-21 12:55:45 -0700]: Hi Sivaram, I'm the author of the e-mail thread that you mentioned. After feedback I got from OpenBSD community, I created a patch for Linux to enable kvm-clock when booting on VMM. It managed to keep clock in sync, but I experienced random

Re: FW: Add mprotect_ept ioctl to vmm(4)

2020-04-07 Thread Pratik Vyas
* Adam Steen [2020-04-07 08:18:19 +]: On Fri, Feb 07, 2020 at 01:25:38PM -0800, Mike Larkin wrote: > On Fri, Feb 07, 2020 at 04:20:16AM +, Adam Steen wrote: > > Hi > > > > Please see the attached patch to add an 'IOCTL handler to sets the access > > protections of the ept' > > > >

Re: some vulns

2020-02-25 Thread Pratik Vyas
* Maxime Villard [2020-02-22 12:16:35 +0100]: CVSROOT:/cvs Module name:src Changes by: morti...@cvs.openbsd.org2020/02/15 15:59:55 Modified files: sys/arch/amd64/amd64: vmm.c Log message: Add bounds check on addresses passed from guests in pvclock. Fixes an

Re: vmm(4): handle invalid writes to cr0 - patch

2020-02-18 Thread Pratik Vyas
* Adam Steen [2020-02-18 04:56:57 +]: Hi Please see the patch below to handle invalid writes to cr0 as per the Intel SDM Volume 3. The 3 cases i am handling with this change are 1. CR0.PG: Setting the PG flag when the PE flag is clear causes a general-protection exception (#GP). (Intel

Re: vmctl(8): uninitialized value

2020-01-02 Thread Pratik Vyas
* Benjamin Baier [2020-01-02 22:01:14 +0100]: On Thu, 2 Jan 2020 18:56:14 +0100 Klemens Nanni wrote: On Thu, Jan 02, 2020 at 04:37:17PM +0100, Benjamin Baier wrote: > "case CMD_SEND:" sets done=1 so ret will never be written to and > the uninitialized value of ret is used to determine the

Re: vmctl: parse_size(): Use local variable instead of function parameter

2019-12-16 Thread Pratik Vyas
* Klemens Nanni [2019-12-16 23:42:04 +0100]: On Fri, Dec 06, 2019 at 06:49:52PM +0100, Klemens Nanni wrote: The parse_size() wrapper around scan_scaled(3) writes its intermediate result to the function argument which is always passed as literal zero. This seems odd, the function parameter

[PATCH] staggered start of vms in vm.conf

2019-12-08 Thread Pratik Vyas
Hi! This is an attempt to address 'thundering herd' problem when a lot of vms are configured in vm.conf. A lot of vms booting in parallel can overload the host and also mess up tsc calibration in openbsd guests as it uses PIT which doesn't fire reliably if the host is overloaded. This diff

Re: [PATCH] attach pvclock with lower priority if tsc is unstable

2019-12-06 Thread Pratik Vyas
* Pratik Vyas [2019-11-24 23:07:26 -0800]: Hello tech@, This diff attaches pvclock with lower priority (500) in case of unstable tsc (PVCLOCK_FLAG_TSC_STABLE) instead of not attaching at all. For reference current priorities, tsc (variant) : -2000 i8254 : 0

[PATCH] fix vmm pvclock accuracy

2019-11-25 Thread Pratik Vyas
Hi tech@, This patch fixes vmm pvclock accuracy issues. Shift math error discovered by George Koehler. This diff also fixes the error in tsc multiplier which was correct only if the host timecounter is tsc. -- Pratik Index: sys/arch/amd64/amd64/vmm.c

[PATCH] attach pvclock with lower priority if tsc is unstable

2019-11-24 Thread Pratik Vyas
Hello tech@, This diff attaches pvclock with lower priority (500) in case of unstable tsc (PVCLOCK_FLAG_TSC_STABLE) instead of not attaching at all. For reference current priorities, tsc (variant) : -2000 i8254 : 0 acpitimer : 1000 acpihpet0 :

Re: Attach kvm-clock to Linux guests on VMM

2019-05-27 Thread Pratik Vyas
* Renato Aguiar [2019-05-27 03:53:11 -0700]: Hi, The following patch makes Linux guests use kvm-clock by setting KVM's CPUID signature on VMM: I think the right thing is to make linux attach pvclock if it's on OpenBSD vmm. You want to send them a patch? Otherwise, does vmm pvclock keep

Re: vmd: servicing virtio devices from separate processes

2018-10-20 Thread Pratik Vyas
* David Gwynne [2018-10-20 12:19:56 +1000]: Would sending and receiving a VM still work if I/O is run in different processes? dlg Hi dlg, It will have to be reworked completely but can be done, I think. -- Pratik

Re: vmd: rate-limit to avoid reboot loops

2018-10-08 Thread Pratik Vyas
* Reyk Floeter [2018-10-05 23:32:44 +0200]: Hi, it sometimes happens that a VM is stuck in a reboot loop. This isn't very pleasent for vmd, so this diff attempts to introduce a hard rate-limit: if the VM rebooted after less than VM_START_RATE_SEC (6) seconds, increment a counter. If this

Re: vmd: division by zero in vcpu_process_com_data

2018-10-03 Thread Pratik Vyas
* Mike Larkin [2018-10-03 12:19:09 -0700]: How about this? pd, thoughts? This code is just the rate limiter code. Today the code says "have I reached the number of characters output based on my baud rate that indicates I need to pause a bit?". And pausing after 0 characters has been output

Re: vmd: division by zero in vcpu_process_com_data

2018-10-03 Thread Pratik Vyas
* Greg Steuck [2018-10-03 11:40:22 -0700]: $ egdb /syzkaller/src/usr.sbin/vmd/obj/vmd /var/crash/vmd/38082.core Core was generated by `vmd'. Program terminated with signal SIGFPE, Arithmetic exception. #0 0x0c07a64174a0 in vcpu_process_com_data (vei=,

Re: vmd cores

2018-10-03 Thread Pratik Vyas
* Greg Steuck [2018-10-03 10:56:28 -0700]: Hi Mike, I'm getting core files from vmds. Here's the most recent one. Should I start collecting more stack traces and sending them to you? ci-openbsd$ doas /usr/local/bin/egdb /syzkaller/src/usr.sbin/vmd/obj/vmd /var/crash/vmd/89501.core Reading

Re: Newer unveil diffs

2018-07-31 Thread Pratik Vyas
* Theo de Raadt [2018-07-30 12:52:46 -0600]: unveil(2) is now enabled in -current. For those who want to play along at home, here are some diffs which use this in a variety of programs. Not all these diffs are correct or complete yet. This is a learning experience. Based upon what we

Re: vmd: enable pause/unpause for vm owners

2018-04-17 Thread Pratik Vyas
* Mohamed Aslan [2018-04-16 00:54:43 -0400]: Hello tech@, I noticed that vmd(8) only allows VM owners to start/stop their VMs, but does not let them to pause/unpause those VMs. I was just wondering if there are reasons behind that. If not, the patch below enables

vmm: Call for testing: Expose TSC to guest

2017-07-22 Thread Pratik Vyas
Hello tech@, The following diff should expose TSC to guest vm and OpenBSD guests should be able to choose tsc as a preferred timecounter if the host machine is >= skylake. This should improve the guest clock drift situation significantly. I am aware that this breaks received vms and am

Re: [PATCH] vmd: write and read device state to and from fd

2017-05-06 Thread Pratik Vyas
* Reyk Floeter [2017-05-05 18:11:22 +0200]: Once again and for the record: nice work! Thank you! See comments below, otherwise OK. Addressed and attached a patch inline. (As mentioned before, we should try to merge this part if init and restore later to make it easier

[PATCH] vmm: Add XCR0 to readregs / writeregs

2017-05-05 Thread Pratik Vyas
Hello tech@, This is a patch that extends the readregs and writeregs vmm(4) ioctl to read and write XCR0. This is required to send and receive FPU state correctly for vmctl send and vmctl receive. vmctl send / receive are two new options that will support snapshotting VMs and migrating VMs

[PATCH] vmd: write and read device state to and from fd

2017-05-04 Thread Pratik Vyas
Hello tech@, This patch adds functions to read and write state of devices in vmd. The atomicio parts are copied from usr.bin/ssh. Context: This is required for implementing vmctl send and vmctl receive. vmctl send / receive are two new options that will support snapshotting VMs and migrating

[PATCH] vmm: Add MSRs to readregs / writeregs

2017-04-29 Thread Pratik Vyas
Hello tech@, This is a patch that extends the readregs and writeregs vmm(4) ioctl to read and write MSRs as well. It also sets the IA32_VMX_IA32E_MODE_GUEST entry control in vcpu_reset_regs based on the value of EFER_LMA. There are changes to vmmvar.h and would require a `make includes` step