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: <YrnBLLRljyHCyeOe@google.com>
Date:   Mon, 27 Jun 2022 14:39:40 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Mingwei Zhang <mizhang@...gle.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, David Matlack <dmatlack@...gle.com>
Subject: Re: [PATCH] kvm: nVMX: add tracepoint for kvm:kvm_nested_vmrun

On Sun, Jun 26, 2022, Mingwei Zhang wrote:
> From: David Matlack <dmatlack@...gle.com>
> 
> This tracepoint is called by nested SVM during emulated VMRUN. Call
> also during emulated VMLAUNCH and VMRESUME in nested VMX.
> 
> Attempt to use analagous VMCS fields to the VMCB fields that are
> reported in the SVM case:
> 
> "int_ctl": 32-bit field of the VMCB that the CPU uses to deliver virtual
> interrupts. The analagous VMCS field is the 16-bit "guest interrupt
> status".
> 
> "event_inj": 32-bit field of VMCB that is used to inject events
> (exceptions and interrupts) into the guest. The analagous VMCS field
> is the "VM-entry interruption-information field".
> 
> "npt": 1 when the VCPU has enabled nested paging. The analagous VMCS
> field is the enable-EPT execution control.
> 
> Signed-off-by: David Matlack <dmatlack@...gle.com>
> [Move the code into the nested_vmx_enter_non_root_mode().]
> Signed-off-by: Mingwei Zhang <mizhang@...gle.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f5cb18e00e78..29cc36cf2568 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -3367,6 +3367,13 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
>  	};
>  	u32 failed_index;
>  
> +	trace_kvm_nested_vmrun(
> +		kvm_rip_read(vcpu), vmx->nested.current_vmptr,
> +		vmcs12->guest_rip,

Be consistent; either put each parameter on it's own line or wrap only when
necessary.

> +		vmcs12->guest_intr_status,
> +		vmcs12->vm_entry_intr_info_field,
> +		vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT);
> +

Align the parameters to the opening '(', that "rule" trumps the 80 char soft limit.

	trace_kvm_nested_vmrun(kvm_rip_read(vcpu),
			       vmx->nested.current_vmptr,
			       vmcs12->guest_rip,
			       vmcs12->guest_intr_status,
			       vmcs12->vm_entry_intr_info_field,
			       vmcs12->secondary_vm_exec_control & SECONDARY_EXEC_ENABLE_EPT);

And if we're going to add nVMX, we should clean up the tracepoint output.  E.g.
pass in KVM_ISA_{SVM,VMX} to different VMCB vs. VMCS and npt vs. ept (and maybe
print nNPT and nEPT to make it obvious it's the vmcs12 setting?).  The "nrip"
field is wrong even for SVM; the tracepoint prints the L2 rip, not the next_rip
field in vmcs12.  Maybe "L2 rip"?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ