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] [day] [month] [year] [list]
Date:   Fri, 21 Feb 2020 10:28:13 -0800
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     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
Subject: Re: [PATCH v2 3/3] KVM: x86: Move #PF retry tracking variables into
 emulation context

On Fri, Feb 21, 2020 at 06:14:03PM +0100, Paolo Bonzini wrote:
> On 19/02/20 16:16, Sean Christopherson wrote:
> > The easy solution to that is to move retry_instruction() into emulate.c.
> > That would also allow making x86_page_table_writing_insn() static.  All
> > other functions invoked from retry_instruction() are exposed via kvm_host.h.
> 
> emulate.c is supposed to invoke no (or almost no) function outside the
> ctxt->ops struct.  In particular, retry_instruction() invokes
> kvm_mmu_gva_to_gpa_write and kvm_mmu_unprotect_page.

Ah, right.  We could split the logic, e.g.

	if (x86_retry_pf_instruction(ctxt, cr2_or_gpa, emulation_type)) {
		gpa_t = gpa = cr2_or_gpa;

		if (!vcpu->arch.mmu->direct_map)
			gpa = kvm_mmu_gva_to_gpa_write(vcpu, cr2_or_gpa, NULL);

		kvm_mmu_unprotect_page(vcpu->kvm, gpa_to_gfn(gpa));
		return 1;
	}

but that's probably a net negative in terms of clarity.  And there's also
vcpu->arch.write_fault_to_shadow_pgtable, which is consumed only by
reexecute_instruction(), and I 100% agree that that variable should stay
in vcpu->arch.  Moving one flag used to retry #PF instructions and not the
other would be weird.

That was a long winded way of saying I agree we should drop this patch :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ