Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 02 Aug 2018 12:07:41 -0000 Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1flCOJ-0005WR-Ck for speck@linutronix.de; Thu, 02 Aug 2018 14:07:40 +0200 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0DC340216F4 for ; Thu, 2 Aug 2018 12:07:32 +0000 (UTC) Received: from [10.36.117.197] (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 238522142F20 for ; Thu, 2 Aug 2018 12:07:31 +0000 (UTC) Subject: [MODERATED] Re: [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0 References: <20180725143100.16309-1-pbonzini@redhat.com> <20180802025135.GA17681@0021ccb48c25> From: Paolo Bonzini Message-ID: <2411a831-7310-3e35-d469-66fdc15699fd@redhat.com> Date: Thu, 2 Aug 2018 14:07:30 +0200 MIME-Version: 1.0 In-Reply-To: <20180802025135.GA17681@0021ccb48c25> Content-Type: multipart/mixed; boundary="3MTzPPTgC6Ry6SN4lta8bIUIWEbRhiJKY"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --3MTzPPTgC6Ry6SN4lta8bIUIWEbRhiJKY Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 02/08/2018 04:51, speck for Konrad Rzeszutek Wilk wrote: > On Wed, Jul 25, 2018 at 04:30:56PM +0200, speck for Paolo Bonzini wrote= : >> Support for ARCH_CAPABILITIES bit 3, which can already be used to disa= ble >> the mitigations on a nested hypervisor. Patch 1 is already in Linus's= >> tree. >=20 > This is still not working for me. Attached is the 'dmesg' output > using the debug patch (also included). Here is my own test program... It prints 0 without the patches and 8 with. #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct vm { int sys_fd; int fd; }; struct vcpu { int fd; }; void vm_init(struct vm *vm) { vm->sys_fd =3D open("/dev/kvm", O_RDWR); if (vm->sys_fd < 0) { perror("open /dev/kvm"); exit(1); } vm->fd =3D ioctl(vm->sys_fd, KVM_CREATE_VM, 0); if (vm->fd < 0) { perror("KVM_CREATE_VM"); exit(1); } } void vcpu_init(struct vm *vm, struct vcpu *vcpu) { vcpu->fd =3D ioctl(vm->fd, KVM_CREATE_VCPU, 0); if (vcpu->fd < 0) { perror("KVM_CREATE_VCPU"); exit(1); } } int main(void) { struct vm vm; struct vcpu vcpu; vm_init(&vm); vcpu_init(&vm, &vcpu); struct { struct kvm_msrs m; struct kvm_msr_entry e[1]; } s =3D { .m.nmsrs =3D 1, .e[0].index =3D 0x10a }; ioctl(vm.sys_fd, KVM_GET_MSRS, &s); printf("%x\n", s.e[0].data); ioctl(vcpu.fd, KVM_GET_MSRS, &s); printf("%x\n", s.e[0].data); } // Paolo --3MTzPPTgC6Ry6SN4lta8bIUIWEbRhiJKY--