Historical speck list archives
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0
Date: Thu, 2 Aug 2018 14:07:30 +0200	[thread overview]
Message-ID: <2411a831-7310-3e35-d469-66fdc15699fd@redhat.com> (raw)
In-Reply-To: <20180802025135.GA17681@0021ccb48c25>

[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]

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 disable
>> the mitigations on a nested hypervisor.  Patch 1 is already in Linus's
>> tree.
> 
> 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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdint.h>
#include <linux/kvm.h>
#include <assert.h>
#include <sys/mman.h>


struct vm {
	int sys_fd;
	int fd;
};

struct vcpu {
	int fd;
};


void vm_init(struct vm *vm)
{
	vm->sys_fd = open("/dev/kvm", O_RDWR);
	if (vm->sys_fd < 0) {
		perror("open /dev/kvm");
		exit(1);
	}

	vm->fd = 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 = 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 = {
		.m.nmsrs = 1,
		.e[0].index = 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


      reply	other threads:[~2018-08-02 12:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 14:30 [MODERATED] [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0 Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 1/4] L1TF KVM ARCH_CAPABILITIES #1 Paolo Bonzini
2018-07-25 19:43   ` [MODERATED] " Andrew Cooper
2018-07-26  8:15     ` Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 2/4] L1TF KVM ARCH_CAPABILITIES #2 Paolo Bonzini
2018-07-30 21:27   ` Thomas Gleixner
2018-07-31  8:22     ` [MODERATED] " Paolo Bonzini
2018-07-31  9:15       ` Thomas Gleixner
2018-07-31  9:35         ` [MODERATED] " Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 3/4] L1TF KVM ARCH_CAPABILITIES #3 Paolo Bonzini
2018-07-25 14:31 ` [MODERATED] [PATCH v2 4/4] L1TF KVM ARCH_CAPABILITIES #4 Paolo Bonzini
2018-07-30 21:36   ` Thomas Gleixner
2018-07-31  7:39     ` [MODERATED] " Paolo Bonzini
2018-07-31  7:59       ` Thomas Gleixner
2018-07-25 15:52 ` [MODERATED] Re: [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0 Greg KH
2018-07-26  8:12   ` Paolo Bonzini
2018-07-26 10:04     ` Greg KH
2018-07-26 10:41       ` Paolo Bonzini
2018-07-30 21:40         ` Thomas Gleixner
2018-08-02  2:51 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-08-02 12:07   ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2411a831-7310-3e35-d469-66fdc15699fd@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=speck@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).