lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230227213201.GH4175971@ls.amr.corp.intel.com>
Date:   Mon, 27 Feb 2023 13:32:01 -0800
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     "Huang, Kai" <kai.huang@...el.com>
Cc:     "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "Yamahata, Isaku" <isaku.yamahata@...el.com>,
        "Li, Xiaoyao" <xiaoyao.li@...el.com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "Shahar, Sagi" <sagis@...gle.com>,
        "Aktas, Erdem" <erdemaktas@...gle.com>,
        "isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
        "dmatlack@...gle.com" <dmatlack@...gle.com>,
        "Christopherson,, Sean" <seanjc@...gle.com>
Subject: Re: [PATCH v11 019/113] KVM: TDX: initialize VM with TDX specific
 parameters

On Mon, Jan 16, 2023 at 10:04:19AM +0000,
"Huang, Kai" <kai.huang@...el.com> wrote:

> On Thu, 2023-01-12 at 08:31 -0800, isaku.yamahata@...el.com wrote:
> > +struct kvm_tdx_init_vm {
> > +	__u64 attributes;
> > +	__u64 mrconfigid[6];	/* sha384 digest */
> > +	__u64 mrowner[6];	/* sha384 digest */
> > +	__u64 mrownerconfig[6];	/* sha348 digest */
> > +	union {
> > +		/*
> > +		 * KVM_TDX_INIT_VM is called before vcpu creation, thus before
> > +		 * KVM_SET_CPUID2.  CPUID configurations needs to be passed.
> > +		 *
> > +		 * This configuration supersedes KVM_SET_CPUID{,2}.
> 
> What does "{,2}" mean?

Both KVM_SET_CPUID and KVM_SET_CPUID2.  For comment purpose, only KVM_SET_CPUID2
suffice. I'll drop "{,2}".

> 
> > +		 * The user space VMM, e.g. qemu, should make them consistent
> > +		 * with this values.
> 
> You are already using 'struct kvm_cpuid2' below.  Isn't it enough to imply that
> userspace should organize data in the format of 'struct kvm_cpuid2'?
> 
> > +		 * sizeof(struct kvm_cpuid_entry2) * KVM_MAX_CPUID_ENTRIES(256)
> > +		 * = 8KB.
> > +		 */
> 
> What does this comment try to imply?
> 
> > +		struct {
> > +			struct kvm_cpuid2 cpuid;
> > +			/* 8KB with KVM_MAX_CPUID_ENTRIES. */
> > +			struct kvm_cpuid_entry2 entries[];
> 
> I don't understand what's the purpose of the second field?
> 
> Shouldn't the 'struct kvm_cpuid2' already have all the CPUID entries?
> 
> > +		};
> > +		/*
> > +		 * For future extensibility.
> > +		 * The size(struct kvm_tdx_init_vm) = 16KB.
> > +		 * This should be enough given sizeof(TD_PARAMS) = 1024
> > +		 */
> > +		__u64 reserved[2029];
> 
> I think this is just wrong.  How can you extend something after a dynamic size
> CPUID array?
> 
> If you want extensibility, you need to put the space before the flexible array.
> 
> > +	};
> > +};

I changed the struct as follows.

struct kvm_tdx_init_vm {
        __u64 attributes;
        __u64 mrconfigid[6];    /* sha384 digest */
        __u64 mrowner[6];       /* sha384 digest */
        __u64 mrownerconfig[6]; /* sha348 digest */
        /*
         * For future extensibility to make sizeof(struct kvm_tdx_init_vm) = 8KB.
         * This should be enough given sizeof(TD_PARAMS) = 1024.
         * 8KB was chosen given because
         * sizeof(struct kvm_cpuid_entry2) * KVM_MAX_CPUID_ENTRIES(=256) = 8KB.
         */
        __u64 reserved[1004];

        /*
         * KVM_TDX_INIT_VM is called before vcpu creation, thus before
         * KVM_SET_CPUID2.
         * This configuration supersedes KVM_SET_CPUID2s for VCPUs. The user
         * space VMM, e.g. qemu, should make KVM_SET_CPUID2 consistent with this
         * values.
         */
        struct kvm_cpuid2 cpuid;
};

-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ