lkml.org 
[lkml]   [2020]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 10/13] KVM: x86: Shrink the usercopy region of the emulation context
On Mon, Mar 02, 2020 at 07:40:27PM +0100, Paolo Bonzini wrote:
> On 26/02/20 18:51, Vitaly Kuznetsov wrote:
> >> +
> >> + /* Here begins the usercopy section. */
> >> + struct operand src;
> >> + struct operand src2;
> >> + struct operand dst;
> > Out of pure curiosity, how certain are we that this is going to be
> > enough for userspaces?
> >
>
> And also, where exactly are the user copies done?

Anything that funnels into ctxt->ops->read_std() or ctxt->ops->write_std(),
e.g.

if (ctxt->src2.type == OP_MEM) {
rc = segmented_read(ctxt, ctxt->src2.addr.mem,
&ctxt->src2.val, ctxt->src2.bytes);
if (rc != X86EMUL_CONTINUE)
goto done;
}


segmented_read() : @data = &ctxt->src2.val
|
|-> read_emulated()
|
|-> ctxt->ops->read_emulated() / emulator_read_emulated()
|
|-> emulator_read_write()
|
|-> emulator_read_write_onepage()
|
|-> ops->read_write_emulate() / read_emulate()
|
|-> kvm_vcpu_read_guest()
|
...
|-> __kvm_read_guest_page()
|
|-> __copy_from_user(data, ...)

\
 
 \ /
  Last update: 2020-03-02 20:20    [W:0.105 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site